コード例 #1
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
コード例 #2
0
    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')