Ejemplo n.º 1
0
    def setupButtonGridUi(self, parent):
        gridLayout = QtWidgets.QGridLayout(parent)
        gridLayout.setMargin(0)
        gridLayout.setSpacing(2)

        jointToolBtn = QPushButton(parent)
        jointToolBtn.setText("Joint Tool")
        jointToolBtn.clicked.connect(cmd(pm.mel.JointTool))

        insertToolBtn = QPushButton(parent)
        insertToolBtn.setText("Insert Joint Tool")
        insertToolBtn.clicked.connect(cmd(pm.mel.InsertJointTool))

        centerBtn = QPushButton(parent)
        centerBtn.setText("Center")
        centerBtn.clicked.connect(cmd(editorutils.centerSelectedJoints))

        insertBtn = QPushButton(parent)
        insertBtn.setText("Insert")
        insertBtn.clicked.connect(cmd(editorutils.insertJointForSelected))

        disableSSCBtn = QPushButton(parent)
        disableSSCBtn.setText("Disable Scale Compensate")
        disableSSCBtn.clicked.connect(
            cmd(editorutils.disableSegmentScaleCompensateForSelected))

        gridItems = [
            [jointToolBtn, insertToolBtn],
            [centerBtn, insertBtn],
            [disableSSCBtn],
        ]
        viewutils.addItemsToGrid(gridLayout, gridItems)
Ejemplo n.º 2
0
    def setupPanelUi(self, parent):
        layout = QtWidgets.QVBoxLayout(parent)
        layout.setMargin(0)

        frame = self.createPanelFrame(parent)
        layout.addWidget(frame)

        gridLayout = QtWidgets.QGridLayout(frame)
        gridLayout.setMargin(0)
        gridLayout.setSpacing(2)

        snapToTargetsBtn = QtWidgets.QPushButton(frame)
        snapToTargetsBtn.setText("Snap To Targets")
        snapToTargetsBtn.setStatusTip(
            "Snap controls and linked objects to their target positions")
        snapToTargetsBtn.clicked.connect(cmd(
            editorutils.snapToLinkForSelected))

        linkEditorBtn = QtWidgets.QPushButton(frame)
        linkEditorBtn.setText("Link Editor")
        linkEditorBtn.setStatusTip(
            "Open the Layout Link Editor for managing how nodes are connected "
            "to each other during blueprint design")
        linkEditorBtn.clicked.connect(cmd(LayoutLinkEditorWindow.toggleWindow))

        gridItems = [
            [snapToTargetsBtn, linkEditorBtn],
        ]
        viewutils.addItemsToGrid(gridLayout, gridItems)
Ejemplo n.º 3
0
 def orientToWorldForSelected(self):
     kw = dict(
         includeChildren=self.orientIncludeChildren,
         preserveChildren=self.orientPreserveChildren,
         preserveShapes=self.orientPreserveShapes,
         syncJointAxes=self.syncJointAxes,
     )
     cmd(editorutils.orientToWorldForSelected, **kw)()
Ejemplo n.º 4
0
 def rotateSelectedOrientsAroundAxis(self, axis, degrees):
     kw = dict(
         preserveChildren=self.orientPreserveChildren,
         preserveShapes=self.orientPreserveShapes,
         syncJointAxes=self.syncJointAxes,
     )
     cmd(editorutils.rotateSelectedOrientsAroundAxis,
         axis, degrees, **kw)()
Ejemplo n.º 5
0
 def mirrorSelected(self):
     kw = dict(
         recursive=self.mirrorRecursive,
         create=self.mirrorAllowCreate,
         reparent=self.mirrorParenting,
         transform=self.mirrorTransforms,
         appearance=self.mirrorAppearance,
     )
     cmd(editorutils.mirrorSelected, **kw)()
Ejemplo n.º 6
0
 def orientToJointForSelected(self):
     kw = dict(
         axisOrder=self.getOrientAxisOrderStr(),
         upAxisStr=self.getOrientUpAxisStr(),
         includeChildren=self.orientIncludeChildren,
         preserveChildren=self.orientPreserveChildren,
         preserveShapes=self.orientPreserveShapes,
         syncJointAxes=self.syncJointAxes,
     )
     cmd(editorutils.orientToJointForSelected, **kw)()
Ejemplo n.º 7
0
    def setupUi(self, parent):
        gridLayout = QtWidgets.QGridLayout(parent)
        gridLayout.setMargin(0)
        gridLayout.setSpacing(2)
        self.setLayout(gridLayout)

        linkBtn = QtWidgets.QPushButton(parent)
        linkBtn.setText("Link")
        linkBtn.clicked.connect(cmd(editorutils.linkSelected))

        unlinkBtn = QtWidgets.QPushButton(parent)
        unlinkBtn.setText("Unlink")
        unlinkBtn.clicked.connect(cmd(editorutils.unlinkSelected))

        viewutils.addItemsToGrid(gridLayout, [[linkBtn, unlinkBtn]])
Ejemplo n.º 8
0
 def createControlShapeButton(text, shapeData):
     btn = QtWidgets.QPushButton(parent)
     btn.setStatusTip("Create a new control")
     if 'icon' in shapeData:
         btn.setIcon(getIcon("controls/" + shapeData["icon"]))
         btn.setIconSize(QtCore.QSize(32, 32))
     else:
         btn.setText(text)
     btn.clicked.connect(
         cmd(pulse.controlshapes.createControlsForSelected, shapeData))
     return btn
Ejemplo n.º 9
0
        def createRotateComponentsButton(text, color, axis, degrees):
            _axes = {0: 'X', 1: 'Y', 2: 'Z'}

            btn = QtWidgets.QPushButton(parent)
            btn.setText(text)
            btn.setStatusTip(
                "Rotate the components of the selected controls "
                "{0} degrees around the {1} axis".format(degrees, _axes[axis]))
            btn.setStyleSheet(UIColors.asBGColor(color))
            btn.clicked.connect(
                cmd(editorutils.rotateSelectedComponentsAroundAxis, axis, degrees))
            return btn
Ejemplo n.º 10
0
    def setupPanelUi(self, parent):
        layout = QtWidgets.QVBoxLayout(parent)
        layout.setMargin(0)

        frame = self.createPanelFrame(parent)
        layout.addWidget(frame)

        gridLayout = QtWidgets.QGridLayout(frame)
        gridLayout.setMargin(0)
        gridLayout.setSpacing(2)

        nameEditorBtn = QtWidgets.QPushButton(frame)
        nameEditorBtn.setText("Name Editor")
        nameEditorBtn.clicked.connect(
            cmd(QuickNameWindow.toggleWindow))

        colorEditorBtn = QtWidgets.QPushButton(frame)
        colorEditorBtn.setText("Color Editor")
        colorEditorBtn.clicked.connect(
            cmd(QuickColorWindow.toggleWindow))

        parentSelBtn = QtWidgets.QPushButton(frame)
        parentSelBtn.setText("Parent Selected")
        parentSelBtn.setStatusTip(
            "Parent the selected nodes, select one leader then followers")
        parentSelBtn.clicked.connect(cmd(editorutils.parentSelected))

        parentInOrderBtn = QtWidgets.QPushButton(frame)
        parentInOrderBtn.setText("Parent in Order")
        parentInOrderBtn.setStatusTip(
            "Parent the selection in order, select leaders to followers")
        parentInOrderBtn.clicked.connect(
            cmd(editorutils.parentSelectedInOrder))

        createOffsetBtn = QtWidgets.QPushButton(frame)
        createOffsetBtn.setText("Create Offset")
        createOffsetBtn.setStatusTip(
            "Group the selected transform, creating the group "
            "exactly where the transform is")
        createOffsetBtn.clicked.connect(
            cmd(editorutils.createOffsetForSelected))

        selectChildrenBtn = QtWidgets.QPushButton(frame)
        selectChildrenBtn.setText("Select Hierarchy")
        selectChildrenBtn.setStatusTip(
            "Select all descendants of the selected node")
        selectChildrenBtn.clicked.connect(cmd(self.selectChildren))

        freezeScaleBtn = QtWidgets.QPushButton(frame)
        freezeScaleBtn.setText("Freeze Scales")
        freezeScaleBtn.setStatusTip(
            "Freeze the scales of the selected node and its children "
            "without affecting their pivots")
        freezeScaleBtn.clicked.connect(
            cmd(editorutils.freezeScalesForSelectedHierarchies))

        freezePivotBtn = QtWidgets.QPushButton(frame)
        freezePivotBtn.setText("Freeze Pivots")
        freezePivotBtn.setStatusTip(
            "Freeze the local pivots of the selected node and its "
            "children by baking the values into translate")
        freezePivotBtn.clicked.connect(
            cmd(editorutils.freezePivotsForSelectedHierarchies))

        gridItems = [
            [nameEditorBtn, colorEditorBtn],
            [parentSelBtn, parentInOrderBtn],
            [createOffsetBtn, selectChildrenBtn],
            [freezeScaleBtn, freezePivotBtn],
        ]
        viewutils.addItemsToGrid(gridLayout, gridItems)
Ejemplo n.º 11
0
    def setupContentUi(self, parent):
        layout = QtWidgets.QVBoxLayout(parent)

        # mirror settings
        # ---------------

        check = QtWidgets.QCheckBox(parent)
        check.setText("Include All Children")
        check.setStatusTip(
            "Recursively mirror the selected nodes and all of their children")
        check.setChecked(self.mirrorRecursive)
        check.stateChanged.connect(self.setMirrorRecursive)
        layout.addWidget(check)

        check = QtWidgets.QCheckBox(parent)
        check.setText("Transforms")
        check.setStatusTip("Mirror the transform matrices of the nodes")
        check.setChecked(self.mirrorTransforms)
        check.stateChanged.connect(self.setMirrorTransforms)
        layout.addWidget(check)

        check = QtWidgets.QCheckBox(parent)
        check.setText("Parenting")
        check.setStatusTip("Mirror the parenting structure of the nodes")
        check.setChecked(self.mirrorParenting)
        check.stateChanged.connect(self.setMirrorParenting)
        layout.addWidget(check)

        check = QtWidgets.QCheckBox(parent)
        check.setText("Appearance")
        check.setStatusTip("Mirror the name and color of the nodes")
        check.setChecked(self.mirrorAppearance)
        check.stateChanged.connect(self.setMirrorAppearance)
        layout.addWidget(check)

        check = QtWidgets.QCheckBox(parent)
        check.setText("Allow Node Creation")
        check.setStatusTip(
            "Allow the creation of nodes when mirroring recursively")
        check.setChecked(self.mirrorAllowCreate)
        check.stateChanged.connect(self.setMirrorAllowCreate)
        layout.addWidget(check)

        # mirror axis

        # mirror mode toggle

        # mirror actions
        # --------------
        gridLayout = QtWidgets.QGridLayout(parent)
        gridLayout.setMargin(0)
        gridLayout.setSpacing(2)

        pairBtn = QtWidgets.QPushButton(parent)
        pairBtn.setText("Pair")
        pairBtn.setStatusTip(
            "Pair the two selected nodes as mirroring counterparts")
        pairBtn.clicked.connect(cmd(editorutils.pairSelected))

        unpairBtn = QtWidgets.QPushButton(parent)
        unpairBtn.setText("Unpair")
        unpairBtn.setStatusTip(
            "Unpair the selected node or nodes (can be many at once)")
        unpairBtn.clicked.connect(cmd(editorutils.unpairSelected))

        mirrorBtn = QtWidgets.QPushButton(parent)
        mirrorBtn.setText("Mirror")
        mirrorBtn.setStatusTip(
            "Mirror the selected nodes using the current options")
        mirrorBtn.clicked.connect(self.mirrorSelected)

        gridItems = [
            [pairBtn, unpairBtn],
        ]
        viewutils.addItemsToGrid(gridLayout, gridItems)
        gridLayout.addWidget(mirrorBtn, 2, 0, 1, 2)
        layout.addLayout(gridLayout)
Ejemplo n.º 12
0
 def matchJointRotationToOrientForSelected(self):
     kw = dict(
         preserveChildren=self.orientPreserveChildren,
     )
     cmd(editorutils.matchJointRotationToOrientForSelected, **kw)()
Ejemplo n.º 13
0
 def toggleLocalRotationAxesForSelected(self):
     kw = dict(
         includeChildren=self.orientIncludeChildren,
     )
     cmd(editorutils.toggleLocalRotationAxesForSelected, **kw)()
Ejemplo n.º 14
0
    def setupContenUi(self, parent):
        layout = QtWidgets.QVBoxLayout(parent)
        layout.setMargin(0)

        # settings
        # --------
        self.keepChildPosCheck = QtWidgets.QCheckBox(parent)
        self.keepChildPosCheck.setText("Preserve Children")
        self.keepChildPosCheck.setStatusTip(
            "Preseve the positions of child nodes when rotating "
            "or orienting a transform or joint")
        self.keepChildPosCheck.setChecked(self.orientPreserveChildren)
        self.keepChildPosCheck.stateChanged.connect(
            self.setOrientPreserveChildren)

        self.keepShapeCheck = QtWidgets.QCheckBox(parent)
        self.keepShapeCheck.setText("Preserve Shapes")
        self.keepShapeCheck.setStatusTip(
            "Preseve the orientation of shapes when rotating nodes")
        self.keepShapeCheck.setChecked(self.orientPreserveShapes)
        self.keepShapeCheck.stateChanged.connect(self.setOrientPreserveShapes)

        self.syncJointAxesCheck = QtWidgets.QCheckBox(parent)
        self.syncJointAxesCheck.setText('Keep Axes Synced')
        self.syncJointAxesCheck.setStatusTip(
            "When enabled, joint translate and scale axes are automatically "
            "updated when the jointOrient and rotateAxis values are changed.")
        self.syncJointAxesCheck.setChecked(self.syncJointAxes)
        self.syncJointAxesCheck.stateChanged.connect(self.setSyncJointAxes)

        self.includeChildrenCheck = QtWidgets.QCheckBox(parent)
        self.includeChildrenCheck.setText("Include All Children")
        self.includeChildrenCheck.setStatusTip(
            "Update all child joints when using orient to joint or world")
        self.includeChildrenCheck.setChecked(self.orientIncludeChildren)
        self.includeChildrenCheck.stateChanged.connect(
            self.setOrientIncludeChildren)

        # joint orient axes
        hlayout = QtWidgets.QHBoxLayout(parent)
        hlayout.setSpacing(4)

        axisOrderLabel = QtWidgets.QLabel(parent)
        axisOrderLabel.setText("Orient Axes")

        self.axisOrderCombo = QtWidgets.QComboBox(parent)
        for option in self.AXIS_ORDER_OPTIONS:
            optionStr = '{0} forward, {1} up'.format(option[0], option[1])
            self.axisOrderCombo.addItem(optionStr)
        self.axisOrderCombo.setCurrentIndex(self.orientAxisOrder)
        self.axisOrderCombo.setStatusTip(
            "The local axes to use for forward / up / secondary")
        self.axisOrderCombo.currentIndexChanged.connect(
            self.setOrientAxisOrder)

        self.upAxisCombo = QtWidgets.QComboBox(parent)
        for option in self.UP_AXIS_OPTIONS:
            optionStr = '{0} world up'.format(option)
            self.upAxisCombo.addItem(optionStr)
        self.upAxisCombo.setCurrentIndex(self.orientUpAxis)
        self.upAxisCombo.setStatusTip(
            "The world axis that up vector of the joint should point towards")
        self.upAxisCombo.currentIndexChanged.connect(self.setOrientUpAxis)

        hlayout.addWidget(axisOrderLabel)
        hlayout.addWidget(self.axisOrderCombo)
        hlayout.addWidget(self.upAxisCombo)
        hlayout.addItem(viewutils.createHSpacer())

        layout.addWidget(self.keepChildPosCheck)
        layout.addWidget(self.keepShapeCheck)
        layout.addWidget(self.syncJointAxesCheck)
        layout.addWidget(self.includeChildrenCheck)
        layout.addLayout(hlayout)

        # button grid
        # -----------
        gridLayout = QtWidgets.QGridLayout(parent)
        gridLayout.setMargin(0)
        gridLayout.setSpacing(2)

        toggleCBBtn = QPushButton(parent)
        toggleCBBtn.setText('Toggle Channel Box Attrs')
        toggleCBBtn.setStatusTip(
            "Toggle the display of rotateAxis, localPivot, and other "
            "attributes in the channel box")
        toggleCBBtn.clicked.connect(
            cmd(editorutils.toggleDetailedChannelBoxForSelected))

        toggleLRABtn = QPushButton(parent)
        toggleLRABtn.setText('Toggle LRAs')
        toggleLRABtn.setStatusTip(
            "Toggle the display of local rotation axes")
        toggleLRABtn.clicked.connect(
            cmd(self.toggleLocalRotationAxesForSelected))

        syncAxesBtn = QtWidgets.QPushButton(parent)
        syncAxesBtn.setText("Sync Axes")
        syncAxesBtn.setStatusTip(
            "Match the translate and scale axes of a "
            "joint to its orientation")
        syncAxesBtn.clicked.connect(self.matchJointRotationToOrientForSelected)

        orientToJointBtn = QtWidgets.QPushButton(parent)
        orientToJointBtn.setText("Orient to Joint")
        orientToJointBtn.clicked.connect(self.orientToJointForSelected)

        orientToWorldBtn = QtWidgets.QPushButton(parent)
        orientToWorldBtn.setText("Orient to World")
        orientToWorldBtn.clicked.connect(self.orientToWorldForSelected)

        interactiveOrientBtn = QtWidgets.QPushButton(parent)
        interactiveOrientBtn.setText("Interactive Orient")
        interactiveOrientBtn.setEnabled(False)

        gridItems = [
            [orientToJointBtn, orientToWorldBtn],
            [interactiveOrientBtn, syncAxesBtn],
            [toggleCBBtn, toggleLRABtn],
        ]
        viewutils.addItemsToGrid(gridLayout, gridItems)
        layout.addLayout(gridLayout)

        # rotate orient buttons
        # ---------------------
        rotateForm = self.createRotateAxisForm(parent)
        layout.addWidget(rotateForm)