Exemplo n.º 1
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
Exemplo n.º 2
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)
Exemplo n.º 3
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)
Exemplo n.º 4
0
class CommandLayout:
    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)
Exemplo n.º 5
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()
Exemplo n.º 6
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
Exemplo n.º 7
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
Exemplo n.º 8
0
    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
Exemplo n.º 9
0
    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)
Exemplo n.º 10
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()
Exemplo n.º 11
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
Exemplo n.º 12
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