コード例 #1
0
ファイル: basetab.py プロジェクト: jonntd/Tapp
 def __init__(self,helpLink,commandIterator):
     from ngSkinTools.ui.actions import BaseAction
     
     self.buttons = []
     self.outerLayout = FormLayout()
     self.helpButton = BaseTab.createHelpButton(helpLink)
     scrollLayout = BaseTab.createScrollLayout(self.outerLayout)
     self.innerLayout = cmds.columnLayout(adjustableColumn=1)        
     
     self.buttonForm = FormLayout(parent=self.outerLayout,numberOfDivisions=100,height=Constants.BUTTON_HEIGHT)
     for name,command,annotation in commandIterator:
         button = cmds.button(label=name,height=Constants.BUTTON_HEIGHT)
         if isinstance(command, BaseAction):
             cmds.button(button,e=True,command=ActionCommandWrapper(command))
             command.addUpdateControl(button)
         else:
             cmds.button(button,e=True,command=command)
             
         if annotation is not None:
             cmds.button(button,e=True,annotation=annotation)
         self.buttons.append(button)
         
     BaseTab.layoutButtonForm(self.buttonForm, self.buttons)
     
     self.outerLayout.attachForm(scrollLayout, 0, 0, None, 0)
     self.outerLayout.attachForm(self.buttonForm,None,Constants.MARGIN_SPACING_HORIZONTAL,Constants.MARGIN_SPACING_VERTICAL,None)
     self.outerLayout.attachControl(scrollLayout, self.buttonForm, None, None, 5, None)
     self.outerLayout.attachControl(self.buttonForm, self.helpButton, None, None, None, Constants.MARGIN_SPACING_HORIZONTAL)
     self.outerLayout.attachForm(self.helpButton,None,None,Constants.MARGIN_SPACING_VERTICAL,Constants.MARGIN_SPACING_HORIZONTAL)
コード例 #2
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
コード例 #3
0
    def createUI(self, parent):
        self.data = LayerDataModel.getInstance()
        self.data.setLayerListsUI(self)

        baseForm = FormLayout(cmds.formLayout("LayerListsUI", 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()
コード例 #4
0
ファイル: tabSettings.py プロジェクト: jonntd/Tapp
    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()

        cmds.setParent(parent)

        return self.outerLayout
コード例 #5
0
ファイル: tabSettings.py プロジェクト: BigMacchia/ngSkinTools
 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
コード例 #6
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
コード例 #7
0
 def createLayerOrderGroup(self, parent):
     group = self.createUIGroup(parent, "Layer Ordering")
     buttonForm = FormLayout(parent=group,
                             numberOfDivisions=100,
                             height=Constants.BUTTON_HEIGHT)
     buttons = []
     buttons.append(cmds.button(label="Move Up", command=self.moveLayerUp))
     buttons.append(
         cmds.button(label="Move Down", command=self.moveLayerDown))
     self.layoutButtonForm(buttonForm, buttons)
コード例 #8
0
 def createManageLayersGroup(self, parent):
     group = self.createUIGroup(parent, "Manager Layers")
     buttonForm = FormLayout(parent=group,
                             numberOfDivisions=100,
                             height=Constants.BUTTON_HEIGHT)
     buttons = []
     buttons.append(
         cmds.button(label="Add Layer", command=self.execAddWeightsLayer))
     buttons.append(
         cmds.button(label="Del Layer", command=self.execRemoveLayer))
     self.layoutButtonForm(buttonForm, buttons)
コード例 #9
0
    def createTitledRow(parent,
                        title,
                        innerContentConstructor=None,
                        adjustable=True):
        '''
        creates a layout piece with a title and inner content layout
        '''

        result = FormLayout(parent=parent)

        if innerContentConstructor is None:
            innerContent = cmds.columnLayout(width=1)
            if adjustable:
                cmds.columnLayout(innerContent, e=True, adjustableColumn=1)
        else:
            innerContent = innerContentConstructor()

        result.attachForm(innerContent, 0, 0, None, Constants.MARGIN_COLUMN2)

        if title != None:
            label = cmds.text(parent=result,
                              label=title + ':',
                              width=Constants.MARGIN_COLUMN2 -
                              Constants.MARGIN_SPACING_HORIZONTAL,
                              align="right")
            result.attachForm(label, 0, None, 0, 0)

        if cmds.layout(innerContent, q=True, exists=True):
            cmds.setParent(innerContent)

        return result
コード例 #10
0
ファイル: layerListsUI.py プロジェクト: jonntd/Tapp
    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
コード例 #11
0
ファイル: layerListsUI.py プロジェクト: xtoof/Tapp
    def createLayerListsUI(self, parent):
        cmds.setParent(parent)
        #self.outerFrame = cmds.frameLayout(label='Skinning Layers',collapsable=False,borderVisible=True,borderStyle="etchedIn",labelAlign="center")

        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)
        list.itemDropped = self.layerDropped

        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 = InfluencesTreeView(
            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)

        return paneLayout
コード例 #12
0
    def create(self, parent):
        LayerEvents.layerAvailabilityChanged.addHandler(
            self.updateUiVisibility, parent)
        result = self.uiSwitchLayout = FormLayout(parent=parent)

        self.noLayersUI.createUI(self.uiSwitchLayout)
        result.attachForm(self.noLayersUI.baseLayout, 0, 0, 0, 0)
        self.layersUI.createUI(self.uiSwitchLayout)
        result.attachForm(self.layersUI.baseLayout, 0, 0, 0, 0)

        self.noLayersUI.update()
        self.layersUI.update()
        self.updateUiVisibility()

        return result
コード例 #13
0
    def createUI(self, parent):
        self.baseLayout = form = FormLayout(parent=parent)
        t1 = self.controls.label1 = TextLabel('', align=TextLabel.ALIGN_LEFT)
        t2 = self.controls.label2 = TextLabel('', align=TextLabel.ALIGN_LEFT)
        t2.setBold()
        b = self.controls.addLayerDataButton = cmds.button(
            "Initialize Skinning Layers", command=self.execAttachLayerData)

        for i in (t1, t2, b):
            form.attachForm(i, None, Constants.MARGIN_SPACING_HORIZONTAL, None,
                            Constants.MARGIN_SPACING_HORIZONTAL)
        form.attachForm(t1, Constants.MARGIN_SPACING_VERTICAL, None, None,
                        None)
        form.attachControl(t2, t1, 0, None, None, None)
        form.attachControl(b, t2, Constants.MARGIN_SPACING_VERTICAL, None,
                           None, None)

        LayerEvents.layerAvailabilityChanged.addHandler(self.update, parent)
        MayaEvents.nodeSelectionChanged.addHandler(self.update, parent)
        MayaEvents.undoRedoExecuted.addHandler(self.update, parent)
コード例 #14
0
    def createUI(self,parent):
        self.data = LayerDataModel.getInstance()

        self.baseLayout = form = FormLayout(parent=parent)
        t1 = self.controls.label1 = TextLabel('',align=TextLabel.ALIGN_LEFT)
        t2 = self.controls.label2 = TextLabel('',align=TextLabel.ALIGN_LEFT)
        t2.setBold()
        b = self.controls.addLayerDataButton = cmds.button("Initialize Skinning Layers",command=self.execAttachLayerData)
        
        for i in (t1,t2,b):
            form.attachForm(i,None,Constants.MARGIN_SPACING_HORIZONTAL,None,Constants.MARGIN_SPACING_HORIZONTAL)
        form.attachForm(t1,Constants.MARGIN_SPACING_VERTICAL,None,None,None)
        form.attachControl(t2,t1,0,None,None,None)
        form.attachControl(b,t2,Constants.MARGIN_SPACING_VERTICAL,None,None,None)

        self.controls.nonCommercialBanner = t = cmds.text(label="non-commercial use license",backgroundColor=(1.0, 204/255.0, 0),height=20,font='smallObliqueLabelFont')
        form.attachForm(t,None,Constants.MARGIN_SPACING_HORIZONTAL,None,Constants.MARGIN_SPACING_HORIZONTAL)
        form.attachControl(t,b,10,None,None,None)


        license.status.changed.addHandler(self.update, parent)
        LayerEvents.layerAvailabilityChanged.addHandler(self.update,parent)
        MayaEvents.nodeSelectionChanged.addHandler(self.update,parent)
        MayaEvents.undoRedoExecuted.addHandler(self.update,parent)
コード例 #15
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()
コード例 #16
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
コード例 #17
0
ファイル: tabSettings.py プロジェクト: leandropim/Tapp
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
コード例 #18
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
コード例 #19
0
ファイル: layerListsUI.py プロジェクト: xtoof/Tapp
    def createUI(self, parent):
        result = group = self.mainLayout = uiWrappers.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
コード例 #20
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__), 'icons', 'logo.png'))
        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
コード例 #21
0
ファイル: tabSettings.py プロジェクト: xtoof/Tapp
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
コード例 #22
0
ファイル: dlgAbout.py プロジェクト: leandropim/Tapp
 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
コード例 #23
0
ファイル: basedialog.py プロジェクト: leandropim/Tapp
    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)
コード例 #24
0
ファイル: basedialog.py プロジェクト: lazerdaze/lancer
    def createUi(self):
        def getButtonClickHandler(button):
            'helper function to create separate instances of button click handler for each button'

            def handler(*args):
                self.closeDialogWithResult(button)

            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 button in reversed(self.buttons):

            btn = cmds.button(label=button.title,
                              height=Constants.BUTTON_HEIGHT,
                              width=Constants.BUTTON_WIDTH,
                              command=getButtonClickHandler(button))

            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)
コード例 #25
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)
        
        
        # take something from the bottom of this stack and execute it now.
        if len(self.stuffToRunInNextModalDialogHack)!=0:
            self.stuffToRunInNextModalDialogHack.pop(0)(self)