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)
def setupCreateControlsUi(self, parent): gridLayout = QtWidgets.QGridLayout(parent) gridLayout.setSpacing(2) pulse.controlshapes.loadBuiltinControlShapes() def createControlShapeButton(text, shapeData): btn = QtWidgets.QPushButton(parent) btn.setStatusTip("Create a new control") if 'icon' in shapeData: btn.setIcon(viewutils.getIcon("controls/" + shapeData["icon"])) btn.setIconSize(QtCore.QSize(32, 32)) else: btn.setText(text) btn.clicked.connect( buttonCommand(pulse.controlshapes.createControlsForSelected, shapeData)) return btn shapes = pulse.controlshapes.getControlShapes() row = 0 col = 0 columnCount = 5 for s in shapes: btn = createControlShapeButton(s['name'], s) gridLayout.addWidget(btn, row, col, 1, 1) col += 1 if col == columnCount: row += 1 col = 0
def setupPanelUi(self, parent): layout = QtWidgets.QVBoxLayout(parent) layout.setMargin(0) frame = self.createPanelFrame(parent) layout.addWidget(frame) gridLayout = QtWidgets.QGridLayout(frame) gridLayout.setSpacing(4) jointToolBtn = QtWidgets.QPushButton(frame) jointToolBtn.setText("Joint Tool") jointToolBtn.clicked.connect(buttonCommand(pm.mel.JointTool)) gridLayout.addWidget(jointToolBtn, 0, 0, 1, 1) insertToolBtn = QtWidgets.QPushButton(frame) insertToolBtn.setText("Insert Joint Tool") insertToolBtn.clicked.connect(buttonCommand(pm.mel.InsertJointTool)) gridLayout.addWidget(insertToolBtn, 0, 1, 1, 1) centerBtn = QtWidgets.QPushButton(frame) centerBtn.setText("Center") centerBtn.clicked.connect(buttonCommand(pulse.joints.centerSelectedJoints)) gridLayout.addWidget(centerBtn, 1, 0, 1, 1) insertBtn = QtWidgets.QPushButton(frame) insertBtn.setText("Insert") insertBtn.clicked.connect(buttonCommand(pulse.joints.insertJointForSelected)) gridLayout.addWidget(insertBtn, 1, 1, 1, 1) disableSSCBtn = QtWidgets.QPushButton(frame) disableSSCBtn.setText("Disable Scale Compensate") disableSSCBtn.clicked.connect(buttonCommand(pulse.joints.disableSegmentScaleCompensateForSelected)) gridLayout.addWidget(disableSSCBtn, 2, 0, 1, 2)
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)
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]])
def setupPanelUi(self, parent): layout = QtWidgets.QVBoxLayout(parent) layout.setMargin(0) frame = self.createPanelFrame(parent) layout.addWidget(frame) gridLayout = QtWidgets.QGridLayout(frame) gridLayout.setSpacing(4) 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(buttonCommand(pulse.nodes.freezeScalesForSelectedHierarchies)) gridLayout.addWidget(freezeScaleBtn, 0, 0, 1, 1) 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(buttonCommand(pulse.nodes.freezePivotsForSelectedHierarchies)) gridLayout.addWidget(freezePivotBtn, 0, 1, 1, 1) parentSelBtn = QtWidgets.QPushButton(frame) parentSelBtn.setText("Parent Selected") parentSelBtn.setStatusTip("Parent the selected nodes, select one leader then followers") parentSelBtn.clicked.connect(buttonCommand(pulse.nodes.parentSelected)) gridLayout.addWidget(parentSelBtn, 1, 0, 1, 1) parentInOrderBtn = QtWidgets.QPushButton(frame) parentInOrderBtn.setText("Parent in Order") parentInOrderBtn.setStatusTip("Parent the selection in order, select leaders to followers") parentInOrderBtn.clicked.connect(buttonCommand(pulse.nodes.parentSelectedInOrder)) gridLayout.addWidget(parentInOrderBtn, 1, 1, 1, 1) 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(buttonCommand(pulse.nodes.createOffsetForSelected)) gridLayout.addWidget(createOffsetBtn, 2, 0, 1, 1) selectChildrenBtn = QtWidgets.QPushButton(frame) selectChildrenBtn.setText("Select Hierarchy") selectChildrenBtn.setStatusTip("Select all descendants of the selected node") selectChildrenBtn.clicked.connect(buttonCommand(self.selectChildren)) gridLayout.addWidget(selectChildrenBtn, 2, 1, 1, 1)
def setupKeywordCategoryUi(self, parent, name, keywords): """ Build a keyword category layout and button grid. Returns the layout. Args: name: A string name of the category keywords: A list of string names of the keywords in the category """ layout = QtWidgets.QVBoxLayout(parent) catLabel = self.createLabel(parent, pulse.names.toTitle(name)) catLabel.setStyleSheet( 'background-color: rgba(255, 255, 255, 5); border-radius: 2px') layout.addWidget(catLabel) catBtnGrid = QtWidgets.QGridLayout() # create button for all keywords x = 0 y = 0 for name in keywords: btn = QtWidgets.QPushButton() btn.setObjectName('keywordBtn_' + name) btn.setText(name) catBtnGrid.addWidget(btn, y, x, 1, 1) self.keywordBtns[name] = btn btn.installEventFilter(self) btn.clicked.connect(partial(self.onKeywordClicked, name)) x += 1 if x > 3: x = 0 y += 1 if y == 0: while x <= 3: spacer = QtWidgets.QLabel() catBtnGrid.addWidget(spacer, y, x, 1, 1) x += 1 layout.addLayout(catBtnGrid) return layout
def setupSuffixesUi(self, parent): """ Build the suffixes layout and button grid. Returns the layout. """ suffixLayout = QtWidgets.QVBoxLayout(parent) suffixesLabel = self.createLabel(parent, "Suffixes", bold=True) suffixLayout.addWidget(suffixesLabel) self.suffixBtnGrid = QtWidgets.QGridLayout() self.suffixBtnGrid.setObjectName("suffixBtnGrid") # create button for all suffixes self.suffixBtns = {} suffixes = self.namesConfig.get('suffixes', {}) x = 0 y = 0 for suffix in suffixes: name = suffix['name'] btn = QtWidgets.QPushButton() btn.setText(name) btn.setCheckable(True) btn.clicked.connect(self.onPrefixOrSuffixClicked) self.suffixBtnGrid.addWidget(btn, y, x, 1, 1) self.suffixBtns[name] = btn x += 1 if x > 1: x = 0 y += 1 suffixLayout.addLayout(self.suffixBtnGrid) spacerItem = QtWidgets.QSpacerItem(0, 2, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding) suffixLayout.addItem(spacerItem) return suffixLayout
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)
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)
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)