Example #1
0
    def createMakePruneWeightsGroup(self,layout):
        self.controls.pruneWeightsGroup = group = self.createUIGroup(layout, 'Prune Small Weights')

        self.createFixedTitledRow(group, title="Prune elements")
        self.controls.pruneWeights = CheckBoxField(self.VAR_PRUNE_PREFIX+"pruneWeights",
                    "Influence weights", True);
        self.controls.pruneMask = CheckBoxField(self.VAR_PRUNE_PREFIX+"pruneMask",
                    "Mask", True);

        self.createFixedTitledRow(group, title="Prune influences below")
        self.controls.pruneWeightsThreshold = FloatField(self.VAR_PRUNE_PREFIX+'pruneWeightsThreshold', minValue=0, maxValue=1,step=0.001,defaultValue=0.01, 
                annotation='Influence weights lower than this value will be set to zero')
        
        
        self.createFixedTitledRow(group, title="Prune mask below")
        self.controls.pruneMaskThreshold = FloatField(self.VAR_PRUNE_PREFIX+'pruneMaskThreshold', minValue=0, maxValue=1,step=0.001,defaultValue=0.01, 
                annotation='Mask values lower than this value will be set to zero')

        cmds.setParent(group)

        cmds.rowLayout(nc=2,adjustableColumn=2,columnWidth2=[Constants.BUTTON_WIDTH_SMALL,50], columnAttach2=["both","both"],columnAlign2=["center","center"])
        BaseTab.createHelpButton(SkinToolsDocs.ASSIGNWEIGHTS_MAKERIGID_INTERFACE)
        cmds.button(height=Constants.BUTTON_HEIGHT,label='Prune',command=lambda *args:self.execPruneWeights())

        cmds.setParent(layout)  
Example #2
0
    def createInitializationGroup(self):
        group = self.createUIGroup(self.cmdLayout.innerLayout,
                                   'Initialization')

        self.createFixedTitledRow(group, 'Infl. Distance Error')
        self.controls.influenceDistanceError = FloatField(
            self.VAR_PREFIX + 'distanceError',
            minValue=0,
            maxValue=None,
            step=0.01,
            defaultValue=0.001,
            annotation=
            'Defines maximum inaccuracy between left and right influence positions'
        )

        self.createTitledRow(group, 'Influence Prefixes')
        self.controls.influencePrefixes = StoredTextEdit(
            self.VAR_PREFIX + 'inflPrefix',
            annotation=
            'Defines maximum inaccuracy between left and right influence positions'
        )

        self.createFixedTitledRow(group, 'Mirror Axis')
        cmds.columnLayout()
        self.controls.mirrorAxis = DropDownField(self.VAR_PREFIX +
                                                 'mirrorAxis')
        self.controls.mirrorAxis.beginRebuildItems()
        self.controls.mirrorAxis.addOption("X")
        self.controls.mirrorAxis.addOption("Y")
        self.controls.mirrorAxis.addOption("Z")
        self.controls.mirrorAxis.endRebuildItems()
Example #3
0
    def create(self, parent):
        cmds.rowLayout(parent=parent,
                       nc=2,
                       adjustableColumn=2,
                       columnWidth2=[Constants.MARGIN_COLUMN2, 50])
        self.useSoftSelect = CheckBoxField(
            self.name + 'On',
            label='Use soft selection',
            defaultValue=0,
            annotation=
            'extend effect outside selection with a fade out by defined distance'
        )
        self.useSoftSelect.changeCommand.addHandler(self.uiChanged)

        self.nativeSoftSelect = CheckBoxField(
            self.name + 'Native',
            label='Native soft selection',
            defaultValue=0,
            annotation=
            'use maya\'s soft selection instead of soft selection radius')
        self.nativeSoftSelect.changeCommand.addHandler(self.uiChanged)

        BaseTab.createFixedTitledRow(parent, "Selection radius")
        self.softSelectRadius = FloatField(
            self.name + 'Radius',
            minValue=0,
            defaultValue=1,
            step=0.1,
            annotation='soft selection radius is defined in world units')

        self.checkUiEnabled()
Example #4
0
    def createVolumeAssociationGroup(self, layout):
        group = self.createUIGroup(layout,
                                   "Surface and Volume Association Rules")

        self.controls.softSelection = SoftSelectionRow(self.VAR_RELAX_PREFIX +
                                                       'softSelection')
        self.controls.softSelection.create(group)

        cmds.setParent(group)
        self.controls.useVolumeAssociation = CheckBoxField(
            self.VAR_RELAX_PREFIX + 'associateByVolume',
            defaultValue=0,
            label="Associate by volume",
            annotation=
            'when turned on, smoothing will extend across vertices that are not connected by edges (across shell borders, seams, close-by meshes, etc)'
        )

        self.controls.useVolumeAssociation.changeCommand.addHandler(
            self.updateUIEnabled)

        self.controls.volumeSearchRow = self.createFixedTitledRow(
            group, "Volume search radius")
        self.controls.volumeAssociationRadius = FloatField(
            self.VAR_RELAX_PREFIX + 'associateByVolumeRadius',
            minValue=0,
            maxValue=10000,
            step=0.1,
            defaultValue=10,
            annotation=
            'search radius of volume association. set this to a fairly little value, just a little above distance of the gap you are trying to "close"'
        )
Example #5
0
    def createPrecisionControlGroup(self, layout):
        group = self.createUIGroup(layout, "Intensity/Precision Control")

        self.createTitledRow(group, "Intensity preset")
        self.controls.intensitySlider = IntensitySlider(
            'Drag slider to quickly set "number of steps" and "step size" aproximatelly corresponding to low or high relax intensity values',
            self.VAR_RELAX_PREFIX + 'relaxIntensity', 0.5)
        self.controls.intensitySlider.changeCommand.addHandler(
            self.intensitySliderPreset)
        self.controls.intensitySlider.create()

        self.createFixedTitledRow(group, 'Number of steps')
        self.controls.numSteps = IntField(
            self.VAR_RELAX_PREFIX + 'NumSteps',
            minValue=1,
            maxValue=1000,
            step=1,
            defaultValue=30,
            annotation=
            'Defines amount of times to repeat relax procedure. Recommended: 20 - 50'
        )

        self.createFixedTitledRow(group, 'Step size')
        self.controls.stepSize = FloatField(
            self.VAR_RELAX_PREFIX + 'StepSize',
            minValue=0,
            maxValue=1,
            step=0.001,
            defaultValue=0.15,
            annotation=
            'Defines a slight amount of relax applied with each step (0 - 1.0). Recommended: 0.02 - 0.15'
        )
    def createUI(self, parent):
        from mainwindow import MainWindow

        mainActions = MainWindow.getInstance().actions
        self.setTitle('Mirror')

        # base layout
        self.cmdLayout = self.createCommandLayout(
            [('Initialize', self.execInitMirror, ''),
             ('Mirror Weights', mainActions.mirrorWeights, '')],
            SkinToolsDocs.MIRRORWEIGHTS_INTERFACE)

        mainActions.mirrorWeights.addUpdateControl(self.cmdLayout.innerLayout)

        # mirror options group

        group = self.controls.mirrorOptionsGroup = self.createUIGroup(
            self.cmdLayout.innerLayout, 'Mirroring Options')

        self.createFixedTitledRow(group, 'Mirror direction')
        self.controls.mirrorDirection = DropDownField(self.VAR_PREFIX +
                                                      'mirrorDirection')
        self.rebuildMirrorDirectionDropDown()
        LayerEvents.mirrorCacheStatusChanged.addHandler(
            self.rebuildMirrorDirectionDropDown, parent)

        self.createFixedTitledRow(group, 'Mirror Seam Width')
        self.controls.mirrorWidth = FloatField(
            self.VAR_PREFIX + 'mirrorWidth',
            minValue=0,
            maxValue=None,
            step=1.0,
            defaultValue=0.1,
            annotation=
            'Defines width of the interpolation from left to right side on the model center line.'
        )
        cmds.setParent(group)
        self.createTitledRow(group, 'Elements')
        self.controls.mirrorWeights = CheckBoxField(
            self.VAR_PREFIX + 'MirrorWeights',
            label="Mirror weights",
            annotation=
            'Check this if mirror operation should be mirroring weights',
            defaultValue=1)
        self.controls.mirrorMask = CheckBoxField(
            self.VAR_PREFIX + 'MirrorMask',
            label="Mirror mask",
            annotation=
            'Check this if mirror operation should be mirroring layer mask',
            defaultValue=1)

        return self.cmdLayout.outerLayout.layout
Example #7
0
    def create(self):
        result = self.mainLayout = cmds.rowLayout(nc=2, adjustableColumn=2)
        step = (self.range[1] - self.range[0]) / 100.0

        self.floatField = FloatField(self.model, step=step)
        if not self.flexibleRange:
            self.floatField.editUI(minValue=self.range[0],
                                   maxValue=self.range[1])

        self.floatField.changeCommand.addHandler(self.fieldChanged)
        self.slider = cmds.floatSlider(value=self.floatField.getValue(),
                                       dragCommand=self.sliderChanging,
                                       changeCommand=self.sliderChanged,
                                       step=step,
                                       minValue=self.range[0],
                                       maxValue=self.range[1])

        self.__updateSliderValue()
        return result
    def createUI(self, tab, parent):
        LayerEvents.currentLayerChanged.addHandler(self.update, parent)
        LayerEvents.layerListUpdated.addHandler(self.update, parent)
        MayaEvents.undoRedoExecuted.addHandler(self.update, parent)

        group = tab.createUIGroup(parent, "Layer Properties")
        cmds.setParent(group)

        cmds.rowLayout(parent=group,
                       nc=2,
                       adjustableColumn=2,
                       columnWidth2=[Constants.MARGIN_COLUMN2, 50],
                       columnAttach2=["both", "left"],
                       columnAlign2=["right", "left"])
        TextLabel('Layer name:')
        self.controls.layerName = TextEdit()
        self.controls.layerName.changeCommand.addHandler(self.layerNameChanged)

        cmds.rowLayout(parent=group,
                       adjustableColumn=3,
                       nc=3,
                       columnWidth3=[Constants.MARGIN_COLUMN2, 50, 100],
                       columnAttach3=["both", "left", "both"],
                       columnAlign3=["right", "left", "center"])
        TextLabel('Opacity:')
        self.controls.layerOpacity = FloatField(
            None,
            minValue=0.0,
            maxValue=1.0,
            step=0.1,
            defaultValue=1.0,
            annotation="overall intensity of this layer")
        self.controls.layerOpacity.changeCommand.addHandler(
            self.layerOpacityChanged)
        self.controls.sliderIntensity = cmds.floatSlider(
            min=0,
            max=1,
            step=0.05,
            value=1.0,
            cc=self.layerOpacitySliderChanged,
            dc=self.layerOpacitySliderChanged,
            annotation='Drag slider to change layer opacity')
Example #9
0
    def createInfluenceMappingGroup(self):
        group = self.createUIGroup(self.cmdLayout.innerLayout,
                                   'Influence Mapping')

        self.createFixedTitledRow(group, 'Infl. Distance Error')
        self.controls.influenceDistanceError = FloatField(
            self.VAR_PREFIX + 'distanceError',
            minValue=0,
            maxValue=None,
            step=0.01,
            defaultValue=0.001,
            annotation=
            'Defines maximum inaccuracy between left and right influence positions'
        )
        self.controls.influenceDistanceError.changeCommand.addHandler(
            self.previewInfluenceMapping, group)

        self.createTitledRow(parent=group, title="Namespaces")
        self.controls.ignoreNamespaces = CheckBoxField(
            self.VAR_PREFIX + 'IgnoreNamespaces',
            label="Ignore",
            annotation='ignore influence namespaces when matching by name',
            defaultValue=1)
        self.controls.ignoreNamespaces.changeCommand.addHandler(
            self.previewInfluenceMapping, ownerUI=group)

        self.influenceMappingPreview.mirrorMode = False
        self.influenceMappingPreview.createUI(parent=group)
        self.influenceMappingPreview.onDelete.addHandler(
            self.influencesManualMapping.removeSelectedManualMappings, group)

        manualGroup = uiGroup.create(self.cmdLayout.innerLayout,
                                     'Manual influence mapping')
        self.influencesManualMapping.mirrorMode = False
        self.influencesManualMapping.createUI(parent=manualGroup)
        self.influencesManualMapping.getSelectedInfluences = lambda: self.influenceMappingPreview.currentInfluencesSelection
        self.influencesManualMapping.manualOverridesChanged.addHandler(
            self.previewInfluenceMapping, group)

        cmds.setParent(group)
Example #10
0
    def createUI(self, parent):

        group = self.mirrorOptionsGroup = uiGroup.create(
            parent, 'Influences Mapping')

        titledRow.createFixed(group, 'Position Tolerance')
        self.influenceDistanceError = FloatField(
            self.VAR_PREFIX + 'distanceError',
            minValue=0,
            maxValue=None,
            step=0.01,
            defaultValue=0.001,
            annotation=
            'Defines maximum inaccuracy between left and right influence positions'
        )

        self.influencePrefixSuffixSelector = InfluencePrefixSuffixSelector()
        self.influencePrefixSuffixSelector.createUI(group)
        titledRow.createFixed(group, None)

        cmds.button(label="Edit influence associations...",
                    command=self.showEditInfluencesWindow)
Example #11
0
    def createUI(self, parent):
        self.setTitle('Settings')
        self.outerLayout = FormLayout()
        scrollLayout = BaseTab.createScrollLayout(self.outerLayout)
        self.baseLayout = cmds.columnLayout(adjustableColumn=1)
        self.outerLayout.attachForm(scrollLayout, 0, 0, 0, 0)

        self.controls.selectedSkinSettingsGroup = group = self.createUIGroup(
            self.baseLayout, 'Selected Skin Settings')

        self.controls.useInfluenceLimit = CheckBoxField(
            None,
            defaultValue=0,
            label="Use maximum influences per vertex limit",
            annotation=
            'Turn this on to enforce a max influences per vertex limit')
        self.controls.useInfluenceLimit.changeCommand.addHandler(
            self.updateUIEnabled, ownerUI=parent)
        self.controls.influenceLimitRow = self.createFixedTitledRow(
            group, 'Influence limit')
        self.controls.numMaxInfluences = IntField(
            None,
            minValue=1,
            maxValue=None,
            annotation="Number of max influences per vertex")

        cmds.setParent(group)
        self.controls.usePruneFilter = CheckBoxField(
            None,
            defaultValue=0,
            label="Prune small weights before writing to skin cluster")
        self.controls.usePruneFilter.changeCommand.addHandler(
            self.updateUIEnabled, ownerUI=parent)
        self.controls.pruneFilterRow = self.createFixedTitledRow(
            group, 'Prune below')
        self.controls.pruneFilterValue = FloatField(
            None,
            minValue=0.0,
            defaultValue=.01,
            maxValue=1.0,
            step=0.01,
            annotation=
            "Influence values lower than this limit will be set to zero")

        cmds.setParent(group)
        cmds.rowLayout(nc=2,
                       adjustableColumn=2,
                       columnWidth2=[Constants.BUTTON_WIDTH_SMALL, 50],
                       columnAttach2=["both", "both"],
                       columnAlign2=["center", "center"])
        BaseTab.createHelpButton(SkinToolsDocs.CURRENTSKINSETTINGS_INTERFACE)
        cmds.button(height=Constants.BUTTON_HEIGHT,
                    label='Apply',
                    command=lambda *args: self.applyCurrentSkinSettings())

        LayerEvents.layerAvailabilityChanged.addHandler(
            self.refreshSettingsFromSelection, parent)
        MayaEvents.nodeSelectionChanged.addHandler(
            self.refreshSettingsFromSelection, parent)
        MayaEvents.undoRedoExecuted.addHandler(
            self.refreshSettingsFromSelection, parent)

        self.refreshSettingsFromSelection()

        cmds.setParent(parent)

        return self.outerLayout
Example #12
0
    def createUI(self, parent):
        group = self.mirrorOptionsGroup = uiGroup.create(
            parent, 'Mirroring Options')

        titledRow.createFixed(group, 'Mirror direction')
        self.mirrorDirection = DropDownField(self.VAR_PREFIX +
                                             'mirrorDirection')

        def getMirrorSideTexts():
            axis = selectionState.mirrorInfo.get()['axis']
            if axis is None:
                axis = 'x'
            return self.MIRROR_TEXTS[axis]

        def rebuildMirrorDirectionDropDown():
            self.mirrorDirection.beginRebuildItems()
            self.mirrorDirection.addOption(self.MIRROR_GUESS)
            for mirrorText in getMirrorSideTexts():
                self.mirrorDirection.addOption(mirrorText)
            self.mirrorDirection.addOption(self.MIRROR_FLIP)
            self.mirrorDirection.endRebuildItems()

        selectionState.mirrorInfo.changed.addHandler(
            rebuildMirrorDirectionDropDown, parent)

        def updateEnabled():
            data = LayerDataModel.getInstance()
            self.mirrorDq.setEnabled(data.layerDataAvailable
                                     and data.isDqMode())

        MayaEvents.nodeSelectionChanged.addHandler(updateEnabled, parent)

        titledRow.createFixed(group, 'Mirror Seam Width')
        self.mirrorWidth = FloatField(
            self.VAR_PREFIX + 'mirrorWidth',
            minValue=0,
            maxValue=None,
            step=1.0,
            defaultValue=0.1,
            annotation=
            'Defines width of the interpolation from left to right side on the model center line.'
        )
        cmds.setParent(group)
        titledRow.create(group, 'Elements')
        self.mirrorWeights = CheckBoxField(
            self.VAR_PREFIX + 'MirrorWeights',
            label="Mirror weights",
            annotation=
            'Check this if mirror operation should be mirroring weights',
            defaultValue=1)
        self.mirrorMask = CheckBoxField(
            self.VAR_PREFIX + 'MirrorMask',
            label="Mirror mask",
            annotation=
            'Check this if mirror operation should be mirroring layer mask',
            defaultValue=1)
        self.mirrorDq = CheckBoxField(
            self.VAR_PREFIX + 'MirrorDualQuaternion',
            label="Mirror dual quaternion weights",
            annotation=
            'Check this if mirror operation should be mirroring dual quaternion weights',
            defaultValue=1)

        LayerEvents.mirrorConfigurationChanged.addHandler(
            rebuildMirrorDirectionDropDown, parent)
        rebuildMirrorDirectionDropDown()
        updateEnabled()
Example #13
0
    def createInfluenceMappingGroup(self):
        group = self.createUIGroup(self.cmdLayout.innerLayout,
                                   'Influence Mapping')

        self.createFixedTitledRow(group, 'Infl. Distance Error')
        self.controls.influenceDistanceError = FloatField(
            self.VAR_PREFIX + 'distanceError',
            minValue=0,
            maxValue=None,
            step=0.01,
            defaultValue=0.001,
            annotation=
            'Defines maximum inaccuracy between left and right influence positions'
        )
        self.controls.influenceDistanceError.changeCommand.addHandler(
            self.previewInfluenceMapping, group)

        if self.mirrorMode:
            self.createTitledRow(group, 'Ignore')
            cmds.radioCollection()
            for index, i in enumerate(['Prefixes', 'Suffixes']):
                ctrl = self.controls.__dict__['ignore' + i] = RadioButtonField(
                    self.VAR_PREFIX + 'ignoreMode' + i,
                    defaultValue=1 if index == 0 else 0,
                    label=i)
                ctrl.changeCommand.addHandler(self.ignoreModeChanged, group)

            self.controls.prefixesGroup = self.createTitledRow(
                group, 'Influence Prefixes')
            self.controls.influencePrefixes = StoredTextEdit(
                self.VAR_PREFIX + 'inflPrefix',
                annotation=
                'Specifies influence prefixes to be ignored when matching by name;\nUsually you would put your left/right influence prefixes here;\nseparate them with commas, e.g. "L_, R_"'
            )
            self.controls.influencePrefixes.changeCommand.addHandler(
                self.previewInfluenceMapping, group)

            self.controls.suffixesGroup = self.createTitledRow(
                group, 'Influence Suffixes')
            self.controls.influenceSuffixes = StoredTextEdit(
                self.VAR_PREFIX + 'inflSuffix',
                annotation=
                'Specifies influence suffixes to be ignored when matching by name;\nUsually you would put your left/right influence suffixes here;\nseparate them with commas, e.g. "_Lf, _Rt"'
            )
            self.controls.influenceSuffixes.changeCommand.addHandler(
                self.previewInfluenceMapping, group)

        influencesLayout = cmds.columnLayout(
            parent=group,
            adjustableColumn=1,
            rowSpacing=Constants.MARGIN_SPACING_VERTICAL)
        cmds.text(parent=influencesLayout,
                  label="Influence mapping to be used:",
                  align='left')
        self.controls.influencesList = cmds.textScrollList(
            parent=influencesLayout,
            height=200,
            numberOfRows=5,
            allowMultiSelection=True,
            selectCommand=self.onInfluenceSelected,
            deleteKeyCommand=lambda *args: self.removeSelectedManualMappings())

        manualGroup = self.createUIGroup(self.cmdLayout.innerLayout,
                                         'Manual influence mapping')
        cmds.rowLayout(parent=manualGroup, nc=3)

        buttonWidth = 110
        cmds.button(
            'Disconnect link',
            width=buttonWidth,
            command=lambda *args: self.doDisconnectMapping(),
            annotation=
            'Disconnect two associated influences, and make each influence point to itself'
        )
        if self.mirrorMode:
            cmds.button(
                'Link, both ways',
                width=buttonWidth,
                command=lambda *args: self.doConnectMapping(bidirectional=True
                                                            ),
                annotation=
                'Connect two selected influences and link them both ways')
        cmds.button(
            'Link, one way' if self.mirrorMode else "Link",
            width=buttonWidth,
            command=lambda *args: self.doConnectMapping(bidirectional=False),
            annotation=
            'Connect two selected influences and link on source to destination'
        )
        cmds.rowLayout(parent=manualGroup, nc=2)
        cmds.button(
            'Remove manual rule',
            width=buttonWidth,
            command=lambda *args: self.removeSelectedManualMappings(),
            annotation=
            'Remove manual rule; influence will be a subject to automatic matching'
        )

        self.ignoreModeChanged()

        cmds.setParent(group)