Exemple #1
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)
Exemple #2
0
    def setupUi(self, parent):
        layout = QtWidgets.QVBoxLayout(self)

        formLayout1 = QtWidgets.QFormLayout(self)
        rigNameLabel = QtWidgets.QLabel(self)
        rigNameLabel.setText("Rig Name")
        self.rigNameText = QtWidgets.QLineEdit(self)
        self.rigNameText.setText(self.blueprintModel.getRigName())
        self.rigNameText.textChanged.connect(self.rigNameTextChanged)
        formLayout1.setWidget(0, QtWidgets.QFormLayout.LabelRole, rigNameLabel)
        formLayout1.setWidget(0, QtWidgets.QFormLayout.FieldRole,
                              self.rigNameText)
        layout.addLayout(formLayout1)

        initBtn = QtWidgets.QPushButton(self)
        initBtn.setText("Initialize Blueprint")
        initBtn.clicked.connect(self.initBlueprint)
        layout.addWidget(initBtn)

        debugPrintBtn = QtWidgets.QPushButton(self)
        debugPrintBtn.setText("Debug Print YAML")
        debugPrintBtn.clicked.connect(self.debugPrintSerialized)
        layout.addWidget(debugPrintBtn)

        spacer = QtWidgets.QSpacerItem(0, 0, QtWidgets.QSizePolicy.Minimum,
                                       QtWidgets.QSizePolicy.Expanding)
        layout.addItem(spacer)

        self.refreshState()
    def __init__(self, parent=None):
        super(BlueprintEditorWidget, self).__init__(parent=parent)

        self.model = ActionTreeItemModel.getSharedModel()
        self.model.modelReset.connect(self.onBlueprintLoaded)

        layout = QtWidgets.QVBoxLayout(self)

        self.rigNameText = QtWidgets.QLineEdit(self)
        self.rigNameText.setText(self.blueprint.rigName)
        self.rigNameText.textChanged.connect(self.rigNameTextChanged)
        layout.addWidget(self.rigNameText)

        createBtn = QtWidgets.QPushButton(self)
        createBtn.setText("Create Default Blueprint")
        createBtn.clicked.connect(self.createDefaultBlueprint)
        layout.addWidget(createBtn)

        saveBtn = QtWidgets.QPushButton(self)
        saveBtn.setText("Debug Save Blueprint")
        saveBtn.clicked.connect(self.debugSaveBlueprint)
        layout.addWidget(saveBtn)

        debugPrintBtn = QtWidgets.QPushButton(self)
        debugPrintBtn.setText("Debug Print Serialized")
        debugPrintBtn.clicked.connect(self.debugPrintSerialized)
        layout.addWidget(debugPrintBtn)

        debugOpenBpBtn = QtWidgets.QPushButton(self)
        debugOpenBpBtn.setText("Debug Open Blueprint Scene")
        debugOpenBpBtn.clicked.connect(self.debugOpenBlueprintScene)
        layout.addWidget(debugOpenBpBtn)

        spacer = QtWidgets.QSpacerItem(0, 0, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
        layout.addItem(spacer)
Exemple #4
0
    def setupUi(self, parent):
        layout = QtWidgets.QVBoxLayout(parent)
        self.setLayout(layout)

        copyBtn = QtWidgets.QPushButton(parent)
        copyBtn.setText('Copy')
        copyBtn.setStatusTip('Copy the world matrices of the selected nodes')
        copyBtn.clicked.connect(self.copySelected)
        layout.addWidget(copyBtn)

        pasteBtn = QtWidgets.QPushButton(parent)
        pasteBtn.setText('Paste')
        copyBtn.setStatusTip('Paste copied matrices onto the selected nodes')
        pasteBtn.clicked.connect(self.pasteSelected)
        layout.addWidget(pasteBtn)

        relativeCopyBtn = QtWidgets.QPushButton(parent)
        relativeCopyBtn.setText('Relative Copy')
        copyBtn.setStatusTip(
            'Copy the relative matrices of the selected nodes')
        relativeCopyBtn.clicked.connect(self.relativeCopySelected)
        layout.addWidget(relativeCopyBtn)

        relativePasteBtn = QtWidgets.QPushButton(parent)
        relativePasteBtn.setText('Relative Paste')
        copyBtn.setStatusTip(
            'Paste copied matrices on the selected nodes relative '
            'to the node used during copy or first selected node')
        relativePasteBtn.clicked.connect(self.relativePasteSelected)
        layout.addWidget(relativePasteBtn)
Exemple #5
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)
Exemple #6
0
    def setupUi(self, parent):
        widget = QtWidgets.QWidget(parent)
        widget.setMinimumWidth(300)
        self.setCentralWidget(widget)

        layout = QtWidgets.QVBoxLayout(parent)
        widget.setLayout(layout)

        buildToolbar = BuildToolbarWidget(parent)
        layout.addWidget(buildToolbar)

        tabWidget = QtWidgets.QTabWidget(parent)

        # config tab
        configTab = BlueprintEditorWidget(parent)
        tabWidget.addTab(configTab, "Config")

        # design tab
        designTab = DesignViewWidget(parent)
        tabWidget.addTab(designTab, "Design")

        # actions tab
        actionsTab = QtWidgets.QWidget(parent)
        actionsLayout = QtWidgets.QVBoxLayout(actionsTab)

        actionEditorBtn = QtWidgets.QPushButton(actionsTab)
        actionEditorBtn.setText("Action Editor")
        actionEditorBtn.clicked.connect(self.showActionEditor)
        actionsLayout.addWidget(actionEditorBtn)

        actionsSplitter = QtWidgets.QSplitter(parent)
        actionsSplitter.setOrientation(QtCore.Qt.Orientation.Vertical)
        actionsLayout.addWidget(actionsSplitter)

        actionTree = ActionTreeWidget(actionsTab)
        actionTree.layout().setMargin(0)
        actionsSplitter.addWidget(actionTree)

        actionButtons = ActionButtonsWidget(actionsTab)
        actionButtons.layout().setMargin(0)
        actionsSplitter.addWidget(actionButtons)

        tabWidget.addTab(actionsTab, "Actions")


        layout.addWidget(tabWidget)

        # debug controls
        refreshBtn = QtWidgets.QPushButton(parent)
        refreshBtn.setText('Refresh')
        model = ActionTreeItemModel.getSharedModel()
        refreshBtn.clicked.connect(model.reloadBlueprint)
        layout.addWidget(refreshBtn)
Exemple #7
0
    def setupUi(self, parent):
        layout = QtWidgets.QVBoxLayout(parent)
        layout.setMargin(4)

        self.frame = QtWidgets.QFrame(parent)
        self.frame.setObjectName("panelFrame")
        layout.addWidget(self.frame)

        hlayout = QtWidgets.QHBoxLayout(self.frame)

        labelLayout = QtWidgets.QVBoxLayout(parent)
        hlayout.addLayout(labelLayout)

        font = QtGui.QFont()
        font.setPointSize(10)
        font.setWeight(75)
        font.setBold(True)
        self.rigNameLabel = QtWidgets.QLabel(parent)
        self.rigNameLabel.setFont(font)
        self.rigNameLabel.setSizePolicy(QtWidgets.QSizePolicy.Expanding,
                                        QtWidgets.QSizePolicy.Minimum)
        self.rigNameLabel.setText(
            self.getRigNameText(self.blueprintModel.getRigName()))
        labelLayout.addWidget(self.rigNameLabel)

        font = QtGui.QFont()
        font.setItalic(True)
        self.rigOrBlueprintLabel = QtWidgets.QLabel(parent)
        self.rigOrBlueprintLabel.setFont(font)
        labelLayout.addWidget(self.rigOrBlueprintLabel)

        self.checkBtn = QtWidgets.QPushButton(parent)
        self.checkBtn.setText("Validate")
        self.checkBtn.setMaximumWidth(80)
        self.checkBtn.clicked.connect(self.runValidation)
        hlayout.addWidget(self.checkBtn)

        self.buildBtn = QtWidgets.QPushButton(parent)
        self.buildBtn.setText("Build")
        self.buildBtn.setMaximumWidth(80)
        self.buildBtn.clicked.connect(self.runBuild)
        hlayout.addWidget(self.buildBtn)

        self.openBPBtn = QtWidgets.QPushButton(parent)
        self.openBPBtn.setText("Open Blueprint")
        self.openBPBtn.clicked.connect(self.openBlueprintAndReload)
        hlayout.addWidget(self.openBPBtn)

        self.cleanState()
Exemple #8
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]])
Exemple #9
0
    def setupUi(self, parent):
        self.setupDefaultFormUi(parent)

        hlayout = QtWidgets.QHBoxLayout(parent)
        hlayout.setSpacing(4)

        self.listWidget = QtWidgets.QListWidget(parent)
        self.listWidget.setSortingEnabled(True)
        self.listWidget.setSizePolicy(QtWidgets.QSizePolicy.Expanding,
                                      QtWidgets.QSizePolicy.Fixed)
        self.listWidget.setSelectionMode(
            QtWidgets.QAbstractItemView.SelectionMode.ExtendedSelection)
        self.listWidget.itemSelectionChanged.connect(
            self.onItemSelectionChanged)
        hlayout.addWidget(self.listWidget)

        self.pickButton = QtWidgets.QPushButton(parent)
        self.pickButton.setIcon(viewutils.getIcon("select.png"))
        self.pickButton.setFixedSize(QtCore.QSize(20, 20))
        self.pickButton.clicked.connect(self.setFromSelection)
        hlayout.addWidget(self.pickButton)
        hlayout.setAlignment(self.pickButton, QtCore.Qt.AlignTop)

        self.setDefaultFormLayout(hlayout)

        if self._isValueTypeValid(self.attrValue):
            self._setFormValue(self.attrValue)
Exemple #10
0
    def setupVariantsUi(self, parent, layout):
        # variant header
        variantHeader = QtWidgets.QFrame(parent)
        variantHeader.setStyleSheet(
            ".QFrame{ background-color: rgb(255, 255, 255, 15); border-radius: 2px }"
        )
        layout.addWidget(variantHeader)

        variantHeaderLayout = QtWidgets.QHBoxLayout(variantHeader)
        variantHeaderLayout.setContentsMargins(10, 4, 4, 4)
        variantHeaderLayout.setSpacing(4)

        self.variantsLabel = QtWidgets.QLabel(variantHeader)
        self.variantsLabel.setText("Variants: ")
        variantHeaderLayout.addWidget(self.variantsLabel)

        spacer = QtWidgets.QSpacerItem(20, 4, QtWidgets.QSizePolicy.Expanding,
                                       QtWidgets.QSizePolicy.Minimum)
        layout.addItem(spacer)

        # add variant button
        addVariantBtn = QtWidgets.QPushButton(variantHeader)
        addVariantBtn.setText('+')
        addVariantBtn.setFixedSize(QtCore.QSize(20, 20))
        addVariantBtn.clicked.connect(self.addVariant)
        variantHeaderLayout.addWidget(addVariantBtn)

        # variant list layout
        self.variantListLayout = QtWidgets.QVBoxLayout(parent)
        self.variantListLayout.setContentsMargins(0, 0, 0, 0)
        self.variantListLayout.setSpacing(4)
        layout.addLayout(self.variantListLayout)
Exemple #11
0
    def createAttrForm(self, actionData, attr, parent):
        isVariant = False
        # duck type of actionProxy
        if hasattr(actionData, 'isVariantAttr'):
            isVariant = actionData.isVariantAttr(attr['name'])

        if isVariant:
            attrForm = BatchAttrForm.createForm(self.index,
                                                attr,
                                                parent=parent)
        else:
            attrForm = ActionAttrForm.createForm(self.index,
                                                 attr,
                                                 self.variantIndex,
                                                 parent=parent)

        attrForm.isBatchForm = isVariant

        # add toggle variant button to label layout
        toggleVariantBtn = QtWidgets.QPushButton(parent)
        toggleVariantBtn.setCheckable(True)
        toggleVariantBtn.setText("·")
        toggleVariantBtn.setFixedSize(QtCore.QSize(14, 20))
        attrForm.labelLayout.insertWidget(0, toggleVariantBtn)
        attrForm.labelLayout.setAlignment(toggleVariantBtn, QtCore.Qt.AlignTop)
        toggleVariantBtn.clicked.connect(
            partial(self.toggleIsVariantAttr, attr['name']))

        attrForm.toggleVariantBtn = toggleVariantBtn
        return attrForm
Exemple #12
0
 def createColorButton(self, name, color, parent):
     btn = QtWidgets.QPushButton(parent)
     btn.setText(name)
     # colors are given in range 0..1, convert to 0..255 for Qt
     btn.setStyleSheet(style.UIColors.asBGColor([c * 255 for c in color]))
     btn.clicked.connect(
         cmd(pulse.editorutils.setOverrideColorForSelected, color))
     return btn
Exemple #13
0
    def setupUi(self, parent):
        layout = QtWidgets.QHBoxLayout(parent)

        self.rigNameLabel = QtWidgets.QLabel(parent)
        self.rigNameLabel.setText(self.blueprint.rigName)
        layout.addWidget(self.rigNameLabel)

        checkBtn = QtWidgets.QPushButton(parent)
        checkBtn.setText("Check")
        checkBtn.setMaximumWidth(80)
        checkBtn.clicked.connect(self.runCheck)
        layout.addWidget(checkBtn)

        buildBtn = QtWidgets.QPushButton(parent)
        buildBtn.setText("Build")
        buildBtn.setMaximumWidth(80)
        buildBtn.clicked.connect(self.runBuild)
        layout.addWidget(buildBtn)
Exemple #14
0
    def setupUi(self, parent):
        super(BatchActionForm, self).setupUi(parent)

        # add action conversion button to header
        convertToActionBtn = QtWidgets.QPushButton(parent)
        convertToActionBtn.setIcon(
            viewutils.getIcon("convertBatchToAction.png"))
        convertToActionBtn.setFixedSize(QtCore.QSize(18, 18))
        convertToActionBtn.clicked.connect(self.convertToActionClicked.emit)
        self.headerLayout.addWidget(convertToActionBtn)
Exemple #15
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
Exemple #16
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
Exemple #17
0
    def setupVariantsUi(self, parent):
        viewutils.clearLayout(self.variantLayout)

        self.variantsLabel.setText("Variants: {0}".format(
            len(self.buildItem.variantValues)))
        for i, variant in enumerate(self.buildItem.variantValues):

            if i > 0:
                # divider line
                dividerLine = QtWidgets.QFrame(parent)
                dividerLine.setStyleSheet(
                    ".QFrame{ background-color: rgb(0, 0, 0, 15); border-radius: 2px }"
                )
                dividerLine.setMinimumHeight(2)
                self.variantLayout.addWidget(dividerLine)

            variantHLayout = QtWidgets.QHBoxLayout(parent)

            # remove variant button
            removeVariantBtn = QtWidgets.QPushButton(parent)
            removeVariantBtn.setText('x')
            removeVariantBtn.setFixedSize(QtCore.QSize(20, 20))
            removeVariantBtn.clicked.connect(
                partial(self.removeVariantAtIndex, i))
            variantHLayout.addWidget(removeVariantBtn)

            # create attr form for all variant attributes
            variantVLayout = QtWidgets.QVBoxLayout(parent)
            variantVLayout.setSpacing(0)
            variantHLayout.addLayout(variantVLayout)

            if self.buildItem.variantAttributes:
                for attr in self.buildItem.actionClass.config['attrs']:
                    if attr['name'] not in self.buildItem.variantAttributes:
                        continue
                    attrValue = variant[attr['name']]
                    # context = variant
                    attrForm = ActionAttrForm.createForm(attr,
                                                         attrValue,
                                                         parent=parent)
                    attrForm.valueChanged.connect(
                        partial(self.attrValueChanged, variant, attrForm))
                    variantVLayout.addWidget(attrForm)
            else:
                noAttrsLabel = QtWidgets.QLabel(parent)
                noAttrsLabel.setText("No variant attributes")
                noAttrsLabel.setMinimumHeight(24)
                noAttrsLabel.setContentsMargins(10, 0, 0, 0)
                noAttrsLabel.setEnabled(False)
                variantVLayout.addWidget(noAttrsLabel)

            self.variantLayout.addLayout(variantHLayout)
Exemple #18
0
    def setupContentUi(self, parent):
        """
        Build the content ui for this BatchBuildAction.
        Creates ui to manage the array of variant attributes.
        """

        # constants main layout
        self.constantsLayout = QtWidgets.QVBoxLayout(parent)
        self.constantsLayout.setContentsMargins(0, 0, 0, 0)
        self.mainLayout.addLayout(self.constantsLayout)

        spacer = QtWidgets.QSpacerItem(20, 4, QtWidgets.QSizePolicy.Expanding,
                                       QtWidgets.QSizePolicy.Minimum)
        self.mainLayout.addItem(spacer)

        # variant header
        variantHeader = QtWidgets.QFrame(parent)
        variantHeader.setStyleSheet(
            ".QFrame{ background-color: rgb(255, 255, 255, 15); border-radius: 2px }"
        )
        self.mainLayout.addWidget(variantHeader)

        variantHeaderLayout = QtWidgets.QHBoxLayout(variantHeader)
        variantHeaderLayout.setContentsMargins(10, 4, 4, 4)
        variantHeaderLayout.setSpacing(4)

        self.variantsLabel = QtWidgets.QLabel(variantHeader)
        self.variantsLabel.setText("Variants: {0}".format(
            len(self.buildItem.variantValues)))
        variantHeaderLayout.addWidget(self.variantsLabel)

        spacer = QtWidgets.QSpacerItem(20, 4, QtWidgets.QSizePolicy.Expanding,
                                       QtWidgets.QSizePolicy.Minimum)
        self.mainLayout.addItem(spacer)

        # add variant button
        addVariantBtn = QtWidgets.QPushButton(variantHeader)
        addVariantBtn.setText('+')
        addVariantBtn.setFixedSize(QtCore.QSize(20, 20))
        addVariantBtn.clicked.connect(self.addVariant)
        variantHeaderLayout.addWidget(addVariantBtn)

        # variant list main layout
        self.variantLayout = QtWidgets.QVBoxLayout(parent)
        self.variantLayout.setContentsMargins(0, 0, 0, 0)
        self.variantLayout.setSpacing(4)
        self.mainLayout.addLayout(self.variantLayout)

        self.setupConstantsUi(parent)
        self.setupVariantsUi(parent)
    def setupUi(self, parent):
        hlayout = QtWidgets.QHBoxLayout(parent)
        hlayout.setContentsMargins(2, 2, 2, 2)

        pickButton = QtWidgets.QPushButton(parent)
        pickButton.setIcon(viewutils.getIcon("select.png"))
        pickButton.setFixedSize(QtCore.QSize(20, 20))
        pickButton.clicked.connect(self.setFromSelection)
        hlayout.addWidget(pickButton)
        hlayout.setAlignment(pickButton, QtCore.Qt.AlignTop)
        # body spacer
        spacer = QtWidgets.QSpacerItem(20, 20, QtWidgets.QSizePolicy.Expanding,
                                       QtWidgets.QSizePolicy.Minimum)
        hlayout.addItem(spacer)
Exemple #20
0
    def setupUi(self, parent):
        layout = QtWidgets.QHBoxLayout(parent)

        self.rigNameLabel = QtWidgets.QLabel(parent)
        self.rigNameLabel.setText(self.blueprintModel.getRigName())
        layout.addWidget(self.rigNameLabel)

        self.saveBtn = QtWidgets.QPushButton(parent)
        self.saveBtn.setText("Save")
        self.saveBtn.setMaximumWidth(80)
        self.saveBtn.clicked.connect(self.saveBlueprintAndFile)
        layout.addWidget(self.saveBtn)

        self.loadBtn = QtWidgets.QPushButton(parent)
        self.loadBtn.setText("Load")
        self.loadBtn.setMaximumWidth(80)
        self.loadBtn.clicked.connect(self.blueprintModel.loadFromFile)
        layout.addWidget(self.loadBtn)

        self.checkBtn = QtWidgets.QPushButton(parent)
        self.checkBtn.setText("Check")
        self.checkBtn.setMaximumWidth(80)
        self.checkBtn.clicked.connect(self.runCheck)
        layout.addWidget(self.checkBtn)

        self.buildBtn = QtWidgets.QPushButton(parent)
        self.buildBtn.setText("Build")
        self.buildBtn.setMaximumWidth(80)
        self.buildBtn.clicked.connect(self.runBuild)
        layout.addWidget(self.buildBtn)

        self.openBPBtn = QtWidgets.QPushButton(parent)
        self.openBPBtn.setText("Open Blueprint")
        self.openBPBtn.clicked.connect(self.openBlueprintAndReload)
        layout.addWidget(self.openBPBtn)

        self.cleanState()
Exemple #21
0
 def createRotateComponentsButton(text, color, axis, degrees):
     btn = QtWidgets.QPushButton(parent)
     btn.setText(text)
     btn.setStatusTip(
         'Rotate the components of the selected controls {0} degrees around the {1} axis'
         .format(degrees, {
             0: 'X',
             1: 'Y',
             2: 'Z'
         }[axis]))
     self.setPresetColor(btn, color)
     btn.clicked.connect(
         buttonCommand(pulse.shapes.rotateSelectedComponentsAroundAxis,
                       axis, degrees))
     return btn
Exemple #22
0
    def createVariantActionDataForm(self, variantIndex, parent):
        """
        Create a widget that wraps a BuildActionDataForm widget
        for use in the variants list. Adds a button to remove the variant.
        """
        dataForm = BuildActionDataForm(self.index, variantIndex, parent=parent)

        # add remove variant button
        removeVariantBtn = QtWidgets.QPushButton(parent)
        removeVariantBtn.setText('x')
        removeVariantBtn.setFixedSize(QtCore.QSize(20, 20))
        removeVariantBtn.clicked.connect(
            partial(self.removeVariantAtIndex, variantIndex))
        dataForm.layout.insertWidget(0, removeVariantBtn)

        return dataForm
Exemple #23
0
    def setupUi(self, parent):
        """
        Build the UI for the main body of the window
        """
        layout = QtWidgets.QVBoxLayout(parent)

        # preview text
        self.namePreviewBtn = QtWidgets.QPushButton(parent)
        font = QtGui.QFont()
        font.setPointSize(10)
        font.setWeight(75)
        font.setBold(True)
        self.namePreviewBtn.setFont(font)
        self.namePreviewBtn.setStatusTip("The current constructed name. "
                                         "Click to apply to the selected node")
        # self.namePreviewBtn.setAlignment(QtCore.Qt.AlignCenter)
        self.namePreviewBtn.setContentsMargins(10, 10, 10, 10)
        # self.namePreviewBtn.setStyleSheet(
        #     'background-color: rgba(0, 0, 0, 40); border-radius: 2px')
        self.namePreviewBtn.clicked.connect(self.onPreviewBtnClicked)
        layout.addWidget(self.namePreviewBtn)

        # prefixes / suffixes
        self.prefixSuffixLayout = QtWidgets.QHBoxLayout()

        prefixLayout = self.setupPrefixesUi(parent)
        self.prefixSuffixLayout.addLayout(prefixLayout)

        suffixLayout = self.setupSuffixesUi(parent)
        self.prefixSuffixLayout.addLayout(suffixLayout)

        layout.addLayout(self.prefixSuffixLayout)

        # keywords
        keywordsLayout = self.setupKeywordsUi(parent)
        layout.addLayout(keywordsLayout)

        # help text
        self.helpText = QtWidgets.QLabel()
        self.helpText.setFont(style.UIFonts.getHelpTextFont())
        layout.addWidget(self.helpText)

        layout.setStretch(2, 1)
Exemple #24
0
    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
Exemple #25
0
    def setupUi(self, parent):
        layout = QtWidgets.QVBoxLayout(parent)

        # clear color btn
        clearBtn = QtWidgets.QPushButton(parent)
        clearBtn.setText("Remove Color")
        clearBtn.clicked.connect(
            cmd(pulse.editorutils.disableColorOverrideForSelected))
        layout.addWidget(clearBtn)

        bodyLayout = self.setupBodyUi(parent)
        layout.addLayout(bodyLayout)

        # help text
        self.helpText = QtWidgets.QLabel()
        self.helpText.setFont(style.UIFonts.getHelpTextFont())
        layout.addWidget(self.helpText)

        layout.setStretch(2, 1)
Exemple #26
0
    def setupUi(self, parent):
        layout = QtWidgets.QVBoxLayout(parent)

        grpBtn = QtWidgets.QPushButton(parent)
        grpBtn.setText("New Group")
        grpBtn.clicked.connect(self.createBuildGroup)
        layout.addWidget(grpBtn)

        searchField = QtWidgets.QLineEdit(parent)
        searchField.setPlaceholderText("Search")
        layout.addWidget(searchField)

        tabScrollWidget = QtWidgets.QWidget(parent)
        tabScroll = QtWidgets.QScrollArea(parent)
        tabScroll.setFrameShape(QtWidgets.QScrollArea.NoFrame)
        tabScroll.setWidgetResizable(True)
        tabScroll.setWidget(tabScrollWidget)

        self.setupContentUi(tabScrollWidget)

        layout.addWidget(tabScroll)
Exemple #27
0
    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
Exemple #28
0
    def setupContentUi(self, parent):
        layout = QtWidgets.QVBoxLayout(parent)

        # make button for each action
        registeredActions = pulse.getRegisteredActions().values()
        categories = list(
            set([
                ac.config.get('category', 'Default')
                for ac in registeredActions
            ]))
        categoryLayouts = {}

        # create category layouts
        for i, cat in enumerate(sorted(categories)):
            # add category layout
            catLay = QtWidgets.QVBoxLayout(parent)
            catLay.setSpacing(4)
            layout.addLayout(catLay)
            categoryLayouts[cat] = catLay
            # add label
            label = self.createLabel(parent, cat)
            catLay.addWidget(label)

        for actionClass in registeredActions:
            cat = actionClass.config.get('category', 'Default')
            color = self.getActionColor(actionClass)
            btn = QtWidgets.QPushButton(parent)
            btn.setText(actionClass.config['displayName'])
            btn.setStyleSheet(
                'background-color:rgba({0}, {1}, {2}, 30)'.format(*color))
            btn.setMinimumHeight(22)
            cmd = lambda x=actionClass.getTypeName(): self.createBuildAction(x)
            btn.clicked.connect(cmd)
            categoryLayouts[cat].addWidget(btn)

        spacer = QtWidgets.QSpacerItem(0, 0, QtWidgets.QSizePolicy.Minimum,
                                       QtWidgets.QSizePolicy.Expanding)
        layout.addItem(spacer)
Exemple #29
0
    def setupContentUi(self, parent):
        """ Build the action buttons UI """
        layout = QtWidgets.QVBoxLayout(parent)

        allActionConfigs = pulse.getRegisteredActionConfigs()

        # make button for each action
        categories = [c.get('category', 'Default') for c in allActionConfigs]
        categories = list(set(categories))
        categoryLayouts = {}

        # create category layouts
        for cat in sorted(categories):
            # add category layout
            catLay = QtWidgets.QVBoxLayout(parent)
            catLay.setSpacing(4)
            layout.addLayout(catLay)
            categoryLayouts[cat] = catLay
            # add label
            label = createHeaderLabel(parent, cat)
            catLay.addWidget(label)

        for actionConfig in allActionConfigs:
            actionId = actionConfig['id']
            actionCategory = actionConfig.get('category', 'Default')
            color = self.getActionColor(actionConfig)
            btn = QtWidgets.QPushButton(parent)
            btn.setText(actionConfig['displayName'])
            btn.setStyleSheet(
                'background-color:rgba({0}, {1}, {2}, 30)'.format(*color))
            btn.setMinimumHeight(22)
            cmd = lambda x=actionId: self.createBuildAction(x)
            btn.clicked.connect(cmd)
            categoryLayouts[actionCategory].addWidget(btn)

        spacer = QtWidgets.QSpacerItem(0, 0, QtWidgets.QSizePolicy.Minimum,
                                       QtWidgets.QSizePolicy.Expanding)
        layout.addItem(spacer)
Exemple #30
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)

        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)