Example #1
0
    def findCharacterModules(self, *args):

        self.moduleList.clear()

        # current character
        selectedChar = self.characterCombo.currentText()

        # get rig modules
        if cmds.objExists(selectedChar + ":" + "ART_RIG_ROOT"):
            modules = cmds.listConnections(selectedChar + ":" +
                                           "ART_RIG_ROOT.rigModules")

            for module in modules:
                niceName = cmds.getAttr(module + ".moduleName")
                moduleType = cmds.getAttr(module + ".moduleType")

                # create widget
                item = QtWidgets.QListWidgetItem()

                widgetItem = QtWidgets.QGroupBox()
                widgetItem.setMinimumHeight(50)
                widgetItem.setProperty("module", module)
                widgetItem.setObjectName("light")

                layout = QtWidgets.QHBoxLayout(widgetItem)

                checkBox = QtWidgets.QCheckBox(niceName)
                checkBox.setChecked(False)
                layout.addWidget(checkBox)

                comboBox = QtWidgets.QComboBox()
                layout.addWidget(comboBox)

                # add items to combo box bases on module class var
                mod = __import__("RigModules." + moduleType, {}, {},
                                 [moduleType])
                matchData = mod.matchData

                if matchData[0] is True:
                    for each in matchData[1]:
                        comboBox.addItem(each)

                    comboBox.setCurrentIndex(1)

                    self.moduleList.addItem(item)
                    self.moduleList.setItemWidget(item, widgetItem)
Example #2
0
    def findCharacterModules(self, *args):

        self.fbxModuleList.clear()

        #current character
        selectedChar = self.fbxCharacterCombo.currentText()

        #get rig modules
        if cmds.objExists(selectedChar + ":" + "ART_RIG_ROOT"):
            modules = cmds.listConnections(selectedChar + ":" +
                                           "ART_RIG_ROOT.rigModules")

            for module in modules:
                niceName = cmds.getAttr(module + ".moduleName")
                moduleType = cmds.getAttr(module + ".moduleType")

                #create widget
                item = QtWidgets.QListWidgetItem()

                widgetItem = QtWidgets.QGroupBox()
                widgetItem.setMinimumHeight(40)
                widgetItem.setProperty("module", module)
                widgetItem.setObjectName("light")

                layout = QtWidgets.QHBoxLayout(widgetItem)
                label = QtWidgets.QLabel(niceName)
                label.setStyleSheet("background: transparent; font: bold;")
                layout.addWidget(label)

                comboBox = QtWidgets.QComboBox()
                layout.addWidget(comboBox)

                #add items to combo box bases on module class var
                mod = __import__("RigModules." + moduleType, {}, {},
                                 [moduleType])
                fbxOptions = mod.fbxImport

                for each in fbxOptions:
                    comboBox.addItem(each)

                comboBox.setCurrentIndex(1)

                self.fbxModuleList.addItem(item)
                self.fbxModuleList.setItemWidget(item, widgetItem)
Example #3
0
    def __init__(self, baseName, className, rigUiInst, parent=None):
        """
        Initialize the class, taking in the base name of the module to be added, the name of the class of the module
        to be added, and the instance of the rig creator UI. Then build the interface for the tool.

        :param baseName: The base name of the module to be added, defined in the module class file at the top.
        :param className: The class name of the module to be added, so we can then initialize that module.
        :param rigUiInst: The instance of the rig creator UI, from which this function was called.

        """

        super(ART_AddModule_UI, self).__init__(parent)

        # get the directory path of the tools
        settings = QtCore.QSettings("Epic Games", "ARTv2")
        self.toolsPath = settings.value("toolsPath")
        self.iconsPath = settings.value("iconPath")

        # create class variables
        self.baseName = baseName
        self.className = className
        self.rigUiInst = rigUiInst

        # load stylesheet
        styleSheetFile = utils.returnNicePath(
            self.toolsPath,
            "Core/Scripts/Interfaces/StyleSheets/mainScheme.qss")
        f = open(styleSheetFile, "r")
        style = f.read()
        f.close()

        self.setStyleSheet(style)

        # size policies
        mainSizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed,
                                               QtWidgets.QSizePolicy.Fixed)

        # create the main widget
        self.mainWidget = QtWidgets.QWidget()
        self.setCentralWidget(self.mainWidget)

        # set qt object name
        self.setObjectName(windowObject)
        self.setWindowTitle(windowTitle)

        # create the mainLayout for the rig creator UI
        self.mainLayout = QtWidgets.QHBoxLayout(self.mainWidget)
        self.mainLayout.setContentsMargins(0, 0, 0, 0)

        self.setSizePolicy(mainSizePolicy)
        self.setMinimumSize(QtCore.QSize(500, 220))
        self.setMaximumSize(QtCore.QSize(500, 520))

        # create the background
        self.frame = QtWidgets.QFrame()
        self.frame.setObjectName("mid")
        self.mainLayout.addWidget(self.frame)

        # create the layout for the widgets
        self.column1layout = QtWidgets.QVBoxLayout(self.frame)
        self.mainLayout.addLayout(self.column1layout)

        self.column2Layout = QtWidgets.QVBoxLayout()
        self.mainLayout.addLayout(self.column2Layout)

        font = QtGui.QFont()
        font.setBold(True)

        label = QtWidgets.QLabel("Choose Parent Bone")
        label.setFont(font)
        label.setAlignment(QtCore.Qt.AlignCenter)
        self.column2Layout.addWidget(label)

        self.boneSearch = QtWidgets.QLineEdit()
        self.column2Layout.addWidget(self.boneSearch)
        self.boneSearch.setPlaceholderText("Search...")
        self.boneSearch.textChanged.connect(self.searchList)

        self.hierarchyTree = QtWidgets.QListWidget()
        self.column2Layout.addWidget(self.hierarchyTree)

        # add items to listWidget
        parents = utils.getViableParents()
        for bone in parents:
            self.hierarchyTree.addItem(bone)

            if bone == "root":
                index = parents.index(bone)
                self.hierarchyTree.setCurrentRow(index)

        # create the prefix pair of fields
        self.prefixForm = QtWidgets.QFormLayout()
        self.column1layout.addLayout(self.prefixForm)

        self.prefixLabel = QtWidgets.QLabel("Prefix: ")
        self.prefixForm.setWidget(0, QtWidgets.QFormLayout.LabelRole,
                                  self.prefixLabel)

        self.prefix = QtWidgets.QLineEdit()
        self.prefixForm.setWidget(0, QtWidgets.QFormLayout.FieldRole,
                                  self.prefix)

        # hookup signal/slot connection
        self.prefix.textChanged.connect(self.updatePreview)

        # create the suffix pair of fields
        self.suffixForm = QtWidgets.QFormLayout()
        self.column1layout.addLayout(self.suffixForm)

        self.suffixLabel = QtWidgets.QLabel("Suffix: ")
        self.suffixForm.setWidget(0, QtWidgets.QFormLayout.LabelRole,
                                  self.suffixLabel)

        self.suffix = QtWidgets.QLineEdit()
        self.suffixForm.setWidget(0, QtWidgets.QFormLayout.FieldRole,
                                  self.suffix)

        # hookup signal/slot connection
        self.suffix.textChanged.connect(self.updatePreview)

        self.previewLabel = QtWidgets.QLabel("Module Name: ")
        self.column1layout.addWidget(self.previewLabel)

        self.previewName = QtWidgets.QLabel(self.baseName)
        self.previewName.setMinimumSize(QtCore.QSize(255, 25))
        self.previewName.setMaximumSize(QtCore.QSize(255, 25))
        self.previewName.setAlignment(QtCore.Qt.AlignHCenter)
        self.column1layout.addWidget(self.previewName)

        # set preview font
        font = QtGui.QFont()
        font.setPointSize(12)
        self.previewName.setFont(font)

        spacerItem1 = QtWidgets.QSpacerItem(20, 40,
                                            QtWidgets.QSizePolicy.Minimum,
                                            QtWidgets.QSizePolicy.Expanding)
        self.column1layout.addItem(spacerItem1)

        # special cases (arms and legs)
        specialCaseModules = ["ART_Leg_Standard", "ART_Arm_Standard"]
        if className in specialCaseModules:
            # spacer
            groupBox = QtWidgets.QGroupBox("")
            self.column1layout.addWidget(groupBox)
            layout = QtWidgets.QVBoxLayout(groupBox)

            self.radioButtonLayout = QtWidgets.QHBoxLayout()
            layout.addLayout(self.radioButtonLayout)
            self.rightRadioBtn = QtWidgets.QRadioButton("Right Side")
            self.leftRadioBtn = QtWidgets.QRadioButton("Left Side")
            self.radioButtonLayout.addWidget(self.rightRadioBtn)
            self.radioButtonLayout.addWidget(self.leftRadioBtn)
            self.leftRadioBtn.setChecked(True)

        # spacer
        spacerItem2 = QtWidgets.QSpacerItem(20, 80,
                                            QtWidgets.QSizePolicy.Minimum,
                                            QtWidgets.QSizePolicy.Expanding)
        self.column1layout.addItem(spacerItem2)

        # create button
        self.createButton = QtWidgets.QPushButton("CREATE")
        self.column1layout.addWidget(self.createButton)
        self.createButton.setMinimumSize(QtCore.QSize(255, 40))
        self.createButton.setMaximumSize(QtCore.QSize(255, 40))
        self.createButton.setSizePolicy(mainSizePolicy)
        self.createButton.setObjectName("blueButton")
        font = QtGui.QFont()
        font.setPointSize(12)
        self.createButton.setFont(font)

        # hookup signal/slot on create button
        self.createButton.clicked.connect(self.createModule)

        self.hierarchyTree.setFocus()