Ejemplo n.º 1
0
    def create(self):
        form = FormLayout(width=100)

        self.intensityIndicator = cmds.textField(width=Constants.NUMBER_FIELD_WIDTH,editable=False,annotation=self.annotation);
        self.sliderIntensity = cmds.floatSlider(min=0, max=1, step=0.05, value=self.__value,cc=self.sliderChange,annotation=self.annotation )

        form.attachForm(self.intensityIndicator,0,None,0,0)
        form.attachForm(self.sliderIntensity,2,0,None,None)
        form.attachControl(self.sliderIntensity,self.intensityIndicator,None,None,None,0)

        self.updateIntensityDisplay()
        return form
Ejemplo n.º 2
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)
     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()
     
     return self.outerLayout
Ejemplo n.º 3
0
    def createLayerListsUI(self,parent):
        cmds.setParent(parent)
        #self.outerFrame = cmds.frameLayout(label='Skinning Layers',collapsable=False,borderVisible=True,borderStyle="etchedIn",labelAlign="center")

        if Utils.getMayaVersion()<Utils.MAYA2011:
            # pane layout is ugly if it's non-QT UI; just use simple 50:50 form layout
            paneLayout = FormLayout(numberOfDivisions=100)
        else:
            paneLayout = cmds.paneLayout(configuration="vertical2",width=100,height=200)
            
        

        leftForm = form = FormLayout()
        label = cmds.text("Layers:",align="left",font='boldLabelFont')
        list = self.controls.layerDisplay = LayersTreeView()
        list.onSelectionChanged.addHandler(self.layerSelectionChanged)
        
        form.attachForm(label,10,0,None,Constants.MARGIN_SPACING_HORIZONTAL)
        form.attachForm(list.control,None,0,0,Constants.MARGIN_SPACING_HORIZONTAL)
        form.attachControl(list.control,label,3,None,None,None)
        
        cmds.setParent("..")
        rightForm = form = FormLayout()
        label = cmds.text("Influences:",align="left",font='boldLabelFont')
        

        list = self.controls.influenceDisplay = TreeViewIDList(allowMultiSelection=True)
        list.onSelectionChanged.addHandler(self.execInfluenceSelected)
        
        self.createLayersListRMBMenu()
        self.createInfluenceListRMBMenu()

        form.attachForm(label,10,Constants.MARGIN_SPACING_HORIZONTAL,None,0)
        form.attachForm(list.control,None,Constants.MARGIN_SPACING_HORIZONTAL,0,0)
        form.attachControl(list.control,label,3,None,None,None)

        

        if Utils.getMayaVersion()<Utils.MAYA2011:
            paneLayout.attachForm(leftForm, 0, None, 0, 0)
            paneLayout.attachForm(rightForm, 0, 0, 0, None)
            cmds.formLayout(paneLayout,e=True,attachPosition=[[leftForm,'right',3,50],[rightForm,'left',3,50]])
            
        return paneLayout
Ejemplo n.º 4
0
    def createUI(self,parent):
        baseForm = FormLayout(parent=parent)
        self.baseLayout = baseForm
        self.controls.layerListsUI = self.createLayerListsUI(baseForm)

        
        self.filterUi = InfluenceFilterUi(self)
        self.filterUi.filterChanged.addHandler(self.updateInfluenceList)
        filterLayout = self.filterUi.createUI(baseForm)
        baseForm.attachForm(self.controls.layerListsUI, 0, 0, None, 0)
        baseForm.attachForm(filterLayout,None,0,0,0)
        baseForm.attachControl(self.controls.layerListsUI, filterLayout, None, None, Constants.MARGIN_SPACING_VERTICAL, None)

        LayerEvents.nameChanged.addHandler(self.updateLayerList,parent)
        LayerEvents.layerAvailabilityChanged.addHandler(self.update,parent)
        LayerEvents.layerListModified.addHandler(self.update,parent)
        LayerEvents.influenceListChanged.addHandler(self.updateInfluenceList,parent)
        MayaEvents.undoRedoExecuted.addHandler(self.update,parent)
        LayerEvents.currentLayerChanged.addHandler(self.currentLayerChangedHandler,parent)
        MayaEvents.nodeSelectionChanged.addHandler(self.update,parent)


        self.update()
Ejemplo n.º 5
0
 def createUI(self,parent):
     result = group = self.mainLayout = cmds.frameLayout(parent=parent,label="Influence Filter", marginWidth=Constants.MARGIN_SPACING_HORIZONTAL,marginHeight=Constants.MARGIN_SPACING_VERTICAL, collapsable=True,
                              expandCommand=self.isVisible.save,collapseCommand=self.isVisible.save,
                              borderStyle='etchedIn')
     cmds.frameLayout(group,e=True,collapse = self.isVisible.get())
     
     column = cmds.columnLayout(parent=group,adjustableColumn=1,rowSpacing=Constants.MARGIN_SPACING_VERTICAL)
     
     form = FormLayout(parent=column)
     
     label=cmds.text(label='Influence Filter:')
     textField = self.influenceNameFilter = TextEdit(annotation="Filter influence list by name")
     clearButton = cmds.button(label='clear',width=50,command=self.clearNameFilter)
     
     
     form.attachForm(label, 10, None, 0, Constants.MARGIN_SPACING_HORIZONTAL)
     form.attachForm(clearButton, 10, Constants.MARGIN_SPACING_HORIZONTAL, 0, None)
     form.attachForm(textField,10,None,0,None)
     form.attachControl(textField,label,None,None,None,Constants.MARGIN_SPACING_HORIZONTAL)
     form.attachControl(textField,clearButton,None,Constants.MARGIN_SPACING_HORIZONTAL,None,None)
     
     
     textField.changeCommand.addHandler(self.filterChanged.emit)
     
     cmds.setParent(result)
     cmds.radioCollection()
     
     
     form = FormLayout(parent=column)
     
     self.radioAllInfluences = RadioButtonField(self.VAR_PREFIX+"allInfluences",defaultValue=1,label='Show all influences')
     self.radioAllInfluences.changeCommand.addHandler(self.radioAllInfluencesChanged)
     self.radioActiveInfluences = RadioButtonField(self.VAR_PREFIX+"activeInfluences",defaultValue=0,label='Only influences with non-zero weights')
     form.attachForm(self.radioAllInfluences, 0, 0, None, 90)
     form.attachForm(self.radioActiveInfluences, None, 0, None, 90)
     form.attachControl(self.radioActiveInfluences, self.radioAllInfluences, 0, None, None, None)
     
     return result
Ejemplo n.º 6
0
 def createInnerUi(self,parent):
     layout = FormLayout(parent=parent,width=400,height=180)
     
     
     labelTitle = cmds.text(label=Version.getReleaseName(), font='boldLabelFont')
     
     logoFrame = cmds.tabLayout(parent=layout,tv=False,childResizable=True,scrollable=False,width=130,height=130,innerMarginWidth=10)
     cmds.image(image=os.path.join(os.path.dirname(__file__),'images','logo.jpg'))
     layout.attachForm(logoFrame,10,10,None,None)
     
     cmds.setParent(layout)
     labelCopyright = cmds.text(label=Version.COPYRIGHT)
     labelUrl = cmds.text(label=Version.PRODUCT_URL)
     
     
     layout.attachForm(labelTitle, 10, None, None, 10)
     
     layout.attachControl(labelCopyright, labelTitle, 25,None,None,None)
     layout.attachForm(labelCopyright,None,None,None,10)
     layout.attachControl(labelUrl, labelCopyright, 0,None,None,None)
     layout.attachForm(labelUrl,None,None,None,10)
     
     return layout
Ejemplo n.º 7
0
    def createUi(self):
        def getButtonClickHandler(buttonId):
            'helper function to create separate instances of button click handler for each button'
            def handler(*args):
                self.closeDialogWithResult(buttonId)
                
            return handler

        form = FormLayout(useExisting=cmds.setParent(q=True))
        
        
        innerUi = self.createInnerUi(form)
        buttonsForm = FormLayout(parent=form,height=Constants.BUTTON_HEIGHT+Constants.MARGIN_SPACING_VERTICAL*2)
        prevBtn = None
        for i in reversed(self.buttons):
            
            btn = cmds.button(label=self.BUTTON_LABELS[i],height=Constants.BUTTON_HEIGHT,width=Constants.BUTTON_WIDTH,
                              command=getButtonClickHandler(i));
            
            buttonsForm.attachForm(btn, 0, None if prevBtn is not None else Constants.MARGIN_SPACING_HORIZONTAL*2, None, None)
            if prevBtn is not None:
                buttonsForm.attachControl(btn, prevBtn, None, Constants.MARGIN_SPACING_HORIZONTAL, None, None)
            prevBtn = btn
            
            
        form.attachForm(innerUi, Constants.MARGIN_SPACING_VERTICAL, Constants.MARGIN_SPACING_HORIZONTAL, None, Constants.MARGIN_SPACING_HORIZONTAL)
        form.attachForm(buttonsForm, None, True, True, True)
        form.attachControl(innerUi, buttonsForm, None, None, Constants.MARGIN_SPACING_VERTICAL, None)
Ejemplo n.º 8
0
class TabSettings(BaseTab):
    '''
    '''
    
    # prefix for preset variables for this tab
    SETTINGS_PREFIX = 'ngSkinToolsSettingsTab_'
    
    def __init__(self):
        BaseTab.__init__(self)
        
    def updateUIEnabled(self):
        layersAvailable = LayerDataModel.getInstance().getLayersAvailable()
        
        Layout.setEnabled(self.controls.selectedSkinSettingsGroup,layersAvailable)
        if not layersAvailable:
            return
        
        self.controls.influenceLimitRow.setEnabled(self.controls.useInfluenceLimit.getModelValue())
        self.controls.pruneFilterRow.setEnabled(self.controls.usePruneFilter.getModelValue())
        
    def applyCurrentSkinSettings(self):
        limit = 0 if not self.controls.useInfluenceLimit.isChecked() else self.controls.numMaxInfluences.getModelValue()
        LayerDataModel.getInstance().mll.setInfluenceLimitPerVertex(limit)

        pruneFilter = 0.00 if not self.controls.usePruneFilter.isChecked() else self.controls.pruneFilterValue.getModelValue()
        LayerDataModel.getInstance().mll.setPruneWeightsFilter(threshold=pruneFilter)
        
        self.updateUIEnabled()
        
    def refreshSettingsFromSelection(self):
        layersAvailable = LayerDataModel.getInstance().getLayersAvailable()

        currentLimit = 0 if not layersAvailable else LayerDataModel.getInstance().mll.getInfluenceLimitPerVertex()
        self.controls.numMaxInfluences.setValue(max(3,currentLimit))
        self.controls.useInfluenceLimit.setValue(currentLimit!=0)
        
        pruneFilterValue = 0 if not layersAvailable else LayerDataModel.getInstance().mll.getPruneWeightsFilter()
        self.controls.pruneFilterValue.setValue(max(0.01,min(1,pruneFilterValue)))
        self.controls.usePruneFilter.setValue(pruneFilterValue!=0)
        
        self.updateUIEnabled()

    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