Exemplo n.º 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)
Exemplo n.º 2
0
    def importSkinWeights_populate(self):
        """
        Populate the interface with an entry for each piece of selected geometry. Each entry will have the geometry
        name and allow the user to point to the geometry's .weight file.
        """

        # get current selection
        selection = cmds.ls(sl=True)
        if len(selection) > 0:

            # Create headers
            font = QtGui.QFont()
            font.setPointSize(12)
            font.setBold(True)

            headerLayout = QtWidgets.QHBoxLayout()
            self.importSkinWeights_VLayout.addLayout(headerLayout)
            headerExport = QtWidgets.QLabel(" ")
            headerExport.setStyleSheet("background: transparent;")
            headerLayout.addWidget(headerExport)

            headerGeo = QtWidgets.QLabel("Mesh")
            headerGeo.setStyleSheet("background: transparent;")
            headerGeo.setMinimumSize(QtCore.QSize(180, 20))
            headerGeo.setMaximumSize(QtCore.QSize(180, 20))
            headerLayout.addWidget(headerGeo)
            headerGeo.setFont(font)

            headerFileName = QtWidgets.QLabel("Weight File")
            headerFileName.setStyleSheet("background: transparent;")
            headerLayout.addWidget(headerFileName)
            headerFileName.setMinimumSize(QtCore.QSize(180, 20))
            headerFileName.setMaximumSize(QtCore.QSize(180, 20))
            headerFileName.setFont(font)

            # get a list of weight files
            weightFiles = []
            for root, subFolders, files in os.walk(self.toolsPath):
                for file in files:
                    if file.rpartition(".")[2] == "weights":
                        fullPath = utils.returnFriendlyPath(os.path.join(root, file))

                        weightFiles.append(fullPath)
            print weightFiles
            # loop through selection, checking selection is valid and has skinCluster
            for each in selection:

                try:
                    # get dagPath and shape and create a nice display name
                    dagPath = cmds.ls(each, long=True)[0]
                    shapeNode = cmds.listRelatives(dagPath, children=True)
                    nicename = each.rpartition("|")[2]
                except Exception, e:
                    traceback.format_exc()

                try:
                    if cmds.nodeType(dagPath + "|" + shapeNode[0]) == "mesh":
                        # create HBoxLayout
                        layout = QtWidgets.QHBoxLayout()
                        layout.setSpacing(10)
                        self.importSkinWeights_VLayout.addLayout(layout)

                        # create checkbox
                        checkBox = QtWidgets.QCheckBox()
                        layout.addWidget(checkBox)
                        checkBox.setChecked(True)

                        # create non editable line edit
                        geoName = QtWidgets.QLabel(nicename + " : ")
                        geoName.setStyleSheet("background: transparent;")
                        geoName.setProperty("dag", dagPath)
                        layout.addWidget(geoName)
                        geoName.setMinimumSize(QtCore.QSize(100, 30))
                        geoName.setMaximumSize(QtCore.QSize(100, 30))

                        # create editable line edit
                        skinFileName = QtWidgets.QLineEdit()
                        layout.addWidget(skinFileName)
                        skinFileName.setMinimumSize(QtCore.QSize(205, 30))
                        skinFileName.setMaximumSize(QtCore.QSize(205, 30))

                        # try to find a matching weight file
                        for file in weightFiles:
                            compareString = file.rpartition("/")[2].partition(".")[0]
                            if nicename.lower() == compareString.lower():
                                skinFileName.setText(file)

                        # check if geometry has weights file associated already
                        if cmds.objExists(dagPath + ".weightFile"):
                            path = cmds.getAttr(dagPath + ".weightFile")
                            path = utils.returnFriendlyPath(path)
                            if os.path.exists(path):
                                skinFileName.setText(path)

                        # browse button
                        browseBtn = QtWidgets.QPushButton()
                        layout.addWidget(browseBtn)
                        browseBtn.setMinimumSize(35, 35)
                        browseBtn.setMaximumSize(35, 35)
                        icon = QtGui.QIcon(os.path.join(self.iconsPath, "System/fileBrowse.png"))
                        browseBtn.setIconSize(QtCore.QSize(30, 30))
                        browseBtn.setIcon(icon)
                        browseBtn.clicked.connect(partial(self.importSkinWeights_fileBrowse, skinFileName))
                except Exception, e:
                    print traceback.format_exc()
Exemplo n.º 3
0
    def exportSkinWeights_populate(self):
        """
        Populate the interface with an entry for each mesh the user has selected.

        This entry includes the mesh name, an QLineEdit to specify a file name for the .weight file, and a checkbox
        as to whether or not the user wants to export weights for that mesh.

        """

        # get current selection
        selection = cmds.ls(sl=True)
        if len(selection) > 0:

            # Create headers
            font = QtGui.QFont()
            font.setPointSize(12)
            font.setBold(True)

            headerLayout = QtWidgets.QHBoxLayout()
            self.exportSkinWeights_VLayout.addLayout(headerLayout)
            headerExport = QtWidgets.QLabel(" ")
            headerLayout.addWidget(headerExport)
            headerExport.setStyleSheet("background: transparent;")

            headerGeo = QtWidgets.QLabel("Mesh")
            headerGeo.setMinimumSize(QtCore.QSize(180, 20))
            headerGeo.setMaximumSize(QtCore.QSize(180, 20))
            headerLayout.addWidget(headerGeo)
            headerGeo.setFont(font)
            headerGeo.setStyleSheet("background: transparent;")

            headerFileName = QtWidgets.QLabel("FileName")
            headerLayout.addWidget(headerFileName)
            headerFileName.setMinimumSize(QtCore.QSize(180, 20))
            headerFileName.setMaximumSize(QtCore.QSize(180, 20))
            headerFileName.setFont(font)
            headerFileName.setStyleSheet("background: transparent;")

            # loop through selection, checking selection is valid and has skinCluster
            for each in selection:

                # get dagPath of each
                dagPath = cmds.ls(each, long=True)[0]
                skinCluster = riggingUtils.findRelatedSkinCluster(dagPath)

                if skinCluster is not None:
                    # create HBoxLayout
                    layout = QtWidgets.QHBoxLayout()
                    layout.setSpacing(10)
                    self.exportSkinWeights_VLayout.addLayout(layout)

                    # create checkbox
                    checkBox = QtWidgets.QCheckBox()
                    layout.addWidget(checkBox)
                    checkBox.setChecked(True)

                    # create non editable line edit
                    niceName = each.rpartition("|")[2]
                    geoName = QtWidgets.QLabel(niceName + " : ")
                    geoName.setProperty("dag", dagPath)
                    layout.addWidget(geoName)
                    geoName.setMinimumSize(QtCore.QSize(180, 30))
                    geoName.setMaximumSize(QtCore.QSize(180, 30))

                    # create editable line edit
                    if cmds.objExists(dagPath + ".weightFile"):
                        path = cmds.getAttr(dagPath + ".weightFile")
                        niceName = path.rpartition("/")[2].partition(".")[0]
                        dirPath = path.rpartition("/")[0]
                        dirPath = utils.returnFriendlyPath(dirPath)
                        self.exportSkinWeights_lineEdit.setText(dirPath)

                    skinFileName = QtWidgets.QLineEdit(niceName)
                    layout.addWidget(skinFileName)
                    skinFileName.setMinimumSize(QtCore.QSize(170, 30))
                    skinFileName.setMaximumSize(QtCore.QSize(170, 30))

            # add spacer
            self.exportSkinWeights_scrollContents.setLayout(
                self.exportSkinWeights_VLayout)

        else:
            label = QtWidgets.QLabel(
                "No Geometry Selected For Export. Select Geometry and Relaunch."
            )
            label.setAlignment(QtCore.Qt.AlignCenter)
            self.exportSkinWeights_VLayout.addWidget(label)
Exemplo n.º 4
0
    def skeletonSettings_UI(self, name):
        """
        This is the UI for the module that has all of the configuration settings.

        :param name:  user given name of module (prefix + base_name + suffix)
        :param width: width of the skeleton settings groupBox. 335 usually
        :param height: height of the skeleton settings groupBox.
        :param checkable: Whether or not the groupBox can be collapsed.


        Build the groupBox that contains all of the settings for this module. Parent the groupBox
        into the main skeletonSettingsUI layout.
        Lastly, call on updateSettingsUI to populate the UI based off of the network node values.

        .. image:: /images/skeletonSettings.png

        """
        # width, height, checkable

        networkNode = self.returnNetworkNode
        font = QtGui.QFont()
        font.setPointSize(8)

        headerFont = QtGui.QFont()
        headerFont.setPointSize(8)
        headerFont.setBold(True)

        # groupbox all modules get
        ART_RigModule.skeletonSettings_UI(self, name, 335, 288, True)

        # STANDARD BUTTONS

        # create a VBoxLayout to add to our Groupbox and then add a QFrame for our signal/slot
        self.mainLayout = QtWidgets.QVBoxLayout(self.groupBox)
        self.frame = QtWidgets.QFrame(self.groupBox)
        self.mainLayout.addWidget(self.frame)
        self.frame.setSizePolicy(QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed))
        self.frame.setMinimumSize(QtCore.QSize(320, 270))
        self.frame.setMaximumSize(QtCore.QSize(320, 270))

        # create layout that is a child of the frame
        self.layout = QtWidgets.QVBoxLayout(self.frame)

        # mirror module
        self.mirrorModLayout = QtWidgets.QHBoxLayout()
        self.layout.addLayout(self.mirrorModLayout)
        self.mirrorModuleLabel = QtWidgets.QLabel("Mirror Module: ")
        self.mirrorModuleLabel.setFont(font)
        self.mirrorModLayout.addWidget(self.mirrorModuleLabel)

        mirror = cmds.getAttr(networkNode + ".mirrorModule")
        if mirror == "":
            mirror = "None"
        self.mirrorMod = QtWidgets.QLabel(mirror)
        self.mirrorMod.setFont(font)
        self.mirrorMod.setAlignment(QtCore.Qt.AlignHCenter)
        self.mirrorModLayout.addWidget(self.mirrorMod)

        # current parent
        self.currentParentMod = QtWidgets.QHBoxLayout()
        self.layout.addLayout(self.currentParentMod)
        self.currentParentLabel = QtWidgets.QLabel("Current Parent: ")
        self.currentParentLabel.setFont(font)
        self.currentParentMod.addWidget(self.currentParentLabel)

        parent = cmds.getAttr(networkNode + ".parentModuleBone")
        self.currentParent = QtWidgets.QLabel(parent)
        self.currentParent.setFont(font)
        self.currentParent.setAlignment(QtCore.Qt.AlignHCenter)
        self.currentParentMod.addWidget(self.currentParent)

        # button layout for name/parent
        self.buttonLayout = QtWidgets.QHBoxLayout()
        self.layout.addLayout(self.buttonLayout)
        self.changeNameBtn = QtWidgets.QPushButton("Change Name")
        self.changeParentBtn = QtWidgets.QPushButton("Change Parent")
        self.mirrorModuleBtn = QtWidgets.QPushButton("Mirror Module")
        self.buttonLayout.addWidget(self.changeNameBtn)
        self.buttonLayout.addWidget(self.changeParentBtn)
        self.buttonLayout.addWidget(self.mirrorModuleBtn)
        self.changeNameBtn.setObjectName("blueButton")
        self.changeParentBtn.setObjectName("blueButton")
        self.mirrorModuleBtn.setObjectName("blueButton")

        # button signal/slots
        self.changeNameBtn.clicked.connect(partial(self.changeModuleName, baseName, self, self.rigUiInst))
        self.changeParentBtn.clicked.connect(partial(self.changeModuleParent, self, self.rigUiInst))
        self.mirrorModuleBtn.clicked.connect(partial(self.setMirrorModule, self, self.rigUiInst))

        # bake offsets button
        self.bakeToolsLayout = QtWidgets.QHBoxLayout()
        self.layout.addLayout(self.bakeToolsLayout)

        # Bake OFfsets
        self.bakeOffsetsBtn = QtWidgets.QPushButton("Bake Offsets")
        self.bakeOffsetsBtn.setFont(headerFont)
        self.bakeToolsLayout.addWidget(self.bakeOffsetsBtn)
        self.bakeOffsetsBtn.clicked.connect(self.bakeOffsets)
        self.bakeOffsetsBtn.setToolTip("Bake the offset mover values up to the global movers to get them in sync")
        self.bakeOffsetsBtn.setObjectName("blueButton")

        # Rig Settings
        spacerItem = QtWidgets.QSpacerItem(20, 10, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
        self.layout.addItem(spacerItem)

        self.hasDynamics = QtWidgets.QCheckBox("Has Dynamics")
        self.layout.addWidget(self.hasDynamics)
        self.hasDynamics.setChecked(False)
        # self.hasDynamics.clicked.connect(partial(self.applyModuleChanges, self))

        spacerItem = QtWidgets.QSpacerItem(20, 30, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
        self.layout.addItem(spacerItem)

        # Number of joints in chain
        self.numJointsLayout = QtWidgets.QHBoxLayout()
        self.layout.addLayout(self.numJointsLayout)

        self.numJointsLabel = QtWidgets.QLabel("Number of Joints in Chain: ")
        self.numJointsLabel.setSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Preferred)
        self.numJointsLabel.setMinimumSize(QtCore.QSize(200, 20))
        self.numJointsLabel.setMaximumSize(QtCore.QSize(200, 20))
        self.numJointsLayout.addWidget((self.numJointsLabel))

        self.numJoints = QtWidgets.QSpinBox()
        self.numJoints.setMaximum(99)
        self.numJoints.setMinimum(2)
        self.numJoints.setMinimumSize(QtCore.QSize(100, 20))
        self.numJoints.setMaximumSize(QtCore.QSize(100, 20))
        self.numJoints.setValue(3)
        self.numJoints.setSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
        self.numJointsLayout.addWidget(self.numJoints)

        # rebuild button
        spacerItem = QtWidgets.QSpacerItem(20, 10, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed)
        self.layout.addItem(spacerItem)

        self.applyButton = QtWidgets.QPushButton("Apply Changes")
        self.layout.addWidget(self.applyButton)
        self.applyButton.setFont(headerFont)
        self.applyButton.setMinimumSize(QtCore.QSize(300, 40))
        self.applyButton.setMaximumSize(QtCore.QSize(300, 40))
        self.applyButton.setSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
        self.applyButton.setEnabled(False)
        self.applyButton.clicked.connect(partial(self.applyModuleChanges, self))

        # signal slot for groupbox checkbox
        QtCore.QObject.connect(self.groupBox, QtCore.SIGNAL("toggled(bool)"), self.frame.setVisible)
        self.groupBox.setChecked(False)

        # add custom skeletonUI settings  name, parent, rig types to install, mirror module, etc.
        # add to the rig cretor UI's module settings layout VBoxLayout
        self.rigUiInst.moduleSettingsLayout.addWidget(self.groupBox)
Exemplo n.º 5
0
    def buildSymmetryModeUI(self, mainUI):

        if cmds.window("ART_SymmetryModeWin", exists=True):
            cmds.deleteUI("ART_SymmetryModeWin", wnd=True)

        #launch a UI to get the name information
        self.symmetryModeWin = QtWidgets.QMainWindow(mainUI)

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

        self.symmetryModeWin.setStyleSheet(style)

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

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

        #set qt object name
        self.symmetryModeWin.setObjectName("ART_SymmetryModeWin")
        self.symmetryModeWin.setWindowTitle("Mass Mirror Mode")

        #create the mainLayout for the rig creator UI
        self.symModeWin_mainLayout = QtWidgets.QVBoxLayout(
            self.symModeWin_mainWidget)
        self.symModeWin_mainLayout.setContentsMargins(0, 0, 0, 0)

        self.symmetryModeWin.setSizePolicy(mainSizePolicy)
        self.symmetryModeWin.setMinimumSize(QtCore.QSize(600, 250))
        self.symmetryModeWin.setMaximumSize(QtCore.QSize(600, 250))

        #create the background
        self.symModeWin_frame = QtWidgets.QFrame()
        self.symModeWin_frame.setObjectName("mid")
        self.symModeWin_mainLayout.addWidget(self.symModeWin_frame)

        #create the layout for the widgets
        self.symModeWin_widgetLayout = QtWidgets.QHBoxLayout(
            self.symModeWin_frame)
        self.symModeWin_widgetLayout.setContentsMargins(5, 5, 5, 5)

        #add the QListWidget Frame
        self.symModeWin_moduleListFrame = QtWidgets.QFrame()
        self.symModeWin_moduleListFrame.setObjectName("mid")
        self.symModeWin_moduleListFrame.setMinimumSize(QtCore.QSize(450, 200))
        self.symModeWin_moduleListFrame.setMaximumSize(QtCore.QSize(450, 200))
        self.symModeWin_moduleListFrame.setContentsMargins(20, 0, 20, 0)

        #create the list widget
        self.symModeWin_moduleList = QtWidgets.QListWidget(
            self.symModeWin_moduleListFrame)
        self.symModeWin_widgetLayout.addWidget(self.symModeWin_moduleListFrame)
        self.symModeWin_moduleList.setMinimumSize(QtCore.QSize(450, 200))
        self.symModeWin_moduleList.setMaximumSize(QtCore.QSize(450, 200))
        self.symModeWin_moduleList.setSelectionMode(
            QtWidgets.QAbstractItemView.NoSelection)
        self.symModeWin_moduleList.setSpacing(3)

        #add the layout for the buttons
        self.symModeWin_buttonLayoutAll = QtWidgets.QVBoxLayout()
        self.symModeWin_widgetLayout.addLayout(self.symModeWin_buttonLayoutAll)
        self.symModeWin_buttonLayoutAll.setContentsMargins(5, 20, 5, 20)

        #add the selection buttons
        self.symModeWin_selectionButtonLayout = QtWidgets.QVBoxLayout()
        self.symModeWin_buttonLayoutAll.addLayout(
            self.symModeWin_selectionButtonLayout)
        self.symModeWin_selectAllButton = QtWidgets.QPushButton("Select All")
        self.symModeWin_selectAllButton.setMinimumSize(QtCore.QSize(115, 25))
        self.symModeWin_selectAllButton.setMaximumSize(QtCore.QSize(115, 25))
        self.symModeWin_selectionButtonLayout.addWidget(
            self.symModeWin_selectAllButton)
        self.symModeWin_selectAllButton.clicked.connect(
            partial(self.symmetryMode_selectDeselect, True))
        self.symModeWin_selectAllButton.setObjectName("blueButton")

        self.symModeWin_selectNoneButton = QtWidgets.QPushButton(
            "Clear Selection")
        self.symModeWin_selectNoneButton.setMinimumSize(QtCore.QSize(115, 25))
        self.symModeWin_selectNoneButton.setMaximumSize(QtCore.QSize(115, 25))
        self.symModeWin_selectionButtonLayout.addWidget(
            self.symModeWin_selectNoneButton)
        self.symModeWin_selectNoneButton.clicked.connect(
            partial(self.symmetryMode_selectDeselect, False))
        self.symModeWin_selectNoneButton.setObjectName("blueButton")

        #spacer
        spacerItem = QtWidgets.QSpacerItem(20, 40,
                                           QtWidgets.QSizePolicy.Minimum,
                                           QtWidgets.QSizePolicy.Expanding)
        self.symModeWin_buttonLayoutAll.addItem(spacerItem)

        #add the mirror buttons
        self.symModeWin_mirrorButtonLayout = QtWidgets.QVBoxLayout()
        self.symModeWin_buttonLayoutAll.addLayout(
            self.symModeWin_mirrorButtonLayout)
        self.symModeWin_mirrorL2RButton = QtWidgets.QPushButton(
            "Mirror Checked")
        self.symModeWin_mirrorL2RButton.setToolTip(
            "Mirror selected modules to unselected modules")

        self.symModeWin_mirrorL2RButton.setMinimumSize(QtCore.QSize(115, 25))
        self.symModeWin_mirrorL2RButton.setMaximumSize(QtCore.QSize(115, 25))
        self.symModeWin_mirrorButtonLayout.addWidget(
            self.symModeWin_mirrorL2RButton)
        self.symModeWin_mirrorL2RButton.setObjectName("blueButton")

        self.symModeWin_mirrorL2RButton.clicked.connect(
            partial(self.symmetryMode_mirror))

        #populate the list widget
        modules = utils.returnRigModules()
        entries = []
        listMods = []

        for mod in modules:
            modName = cmds.getAttr(mod + ".moduleName")
            mirrorModule = cmds.getAttr(mod + ".mirrorModule")
            invalidTypes = [None, "None"]
            if mirrorModule not in invalidTypes:
                if modName not in listMods:
                    entries.append([modName, mirrorModule])
                    listMods.append(modName)
                    listMods.append(mirrorModule)

        self.symModeWinModues = {}

        if len(entries) == 0:
            item = QtWidgets.QListWidgetItem(self.symModeWin_moduleList)
            label = QtWidgets.QLabel("No modules with mirroring setup")
            item.setSizeHint(label.sizeHint())
            self.symModeWin_moduleList.addItem(item)
            self.symModeWin_moduleList.setItemWidget(item, label)

        for each in entries:

            #create a custom widget to add to each entry in the listWidget
            mainWidget = QtWidgets.QWidget()
            buttonLayout = QtWidgets.QHBoxLayout(mainWidget)

            #create the checkbox
            checkbox = QtWidgets.QCheckBox()
            checkbox.setMinimumSize(QtCore.QSize(12, 12))
            checkbox.setMaximumSize(QtCore.QSize(12, 12))
            checkbox.setChecked(True)
            buttonLayout.addWidget(checkbox)

            label = QtWidgets.QLabel("Mirror ")
            buttonLayout.addWidget(label)

            mirrorFrom = QtWidgets.QComboBox()
            mirrorFrom.addItem(each[0])
            mirrorFrom.addItem(each[1])
            buttonLayout.addWidget(mirrorFrom)
            mirrorFrom.setMinimumWidth(150)

            label = QtWidgets.QLabel(" To ")
            buttonLayout.addWidget(label)
            label.setAlignment(QtCore.Qt.AlignCenter)

            mirrorTo = QtWidgets.QComboBox()
            mirrorTo.addItem(each[1])
            mirrorTo.addItem(each[0])
            buttonLayout.addWidget(mirrorTo)
            mirrorTo.setMinimumWidth(150)

            #signal/slots
            mirrorFrom.currentIndexChanged.connect(
                partial(self.toggleComboBoxFrom, mirrorFrom, mirrorTo))
            mirrorTo.currentIndexChanged.connect(
                partial(self.toggleComboBoxTo, mirrorFrom, mirrorTo))

            #add this item widget to the list
            item = QtWidgets.QListWidgetItem(self.symModeWin_moduleList)
            index = entries.index(each)
            if (index % 2) == 0:
                item.setBackground(QtGui.QColor(106, 106, 108))
            else:
                item.setBackground(QtGui.QColor(46, 46, 48))

            item.setSizeHint(mainWidget.sizeHint())
            self.symModeWin_moduleList.addItem(item)
            self.symModeWin_moduleList.setItemWidget(item, mainWidget)

        #show the window
        self.symmetryModeWin.show()
Exemplo n.º 6
0
    def buildUI(self):

        if cmds.window("pyART_ImportMotionWIN", exists=True):
            cmds.deleteUI("pyART_ImportMotionWIN", wnd=True)

        #create the main window
        self.mainWin = QtWidgets.QMainWindow(self.pickerUI)

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

        #create the mainLayout
        self.layout = QtWidgets.QVBoxLayout(self.mainWidget)

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

        self.mainWin.setStyleSheet(self.style)

        self.mainWin.setMinimumSize(QtCore.QSize(600, 350))
        self.mainWin.setMaximumSize(QtCore.QSize(600, 350))
        self.mainWin.resize(600, 350)

        #set qt object name
        self.mainWin.setObjectName("pyART_ImportMotionWIN")
        self.mainWin.setWindowTitle("Import Motion")

        #tabs
        self.importTabs = QtWidgets.QTabWidget()
        self.layout.addWidget(self.importTabs)

        #style sheet
        stylesheet = """
        QTabBar::tab
        {
            background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 rgb(19,132,183), stop:1 rgb(30,30,30));
            width: 100px;
            padding-left: -10px;
        }
        QTabBar::tab:selected
        {
            background-color: rgb(14,100,143);
            border: 2px solid black;
        }
        QTabBar::tab:hover
        {
            background: rgb(19,132,183);
        }
        QTabBar::tab:!selected
        {
            margin-top: 5px;
        }
        QTabWidget::pane
        {
            border-top: 2px solid rgb(19,132,183);
            border-left: 2px solid rgb(19,132,183);
            border-right: 2px solid rgb(19,132,183);
            border-bottom: 2px solid rgb(19,132,183);
        }
        """

        self.importTabs.setStyleSheet(stylesheet)

        #FBX Tab
        self.fbxImportTab = QtWidgets.QWidget()
        self.importTabs.addTab(self.fbxImportTab, "FBX")

        #Anim Curve Tab
        self.animImportTab = QtWidgets.QWidget()
        self.importTabs.addTab(self.animImportTab, "Animation")

        #=======================================================================
        #=======================================================================
        #=======================================================================
        #=======================================================================
        # #FBX TAB
        #=======================================================================
        #=======================================================================
        #=======================================================================
        #=======================================================================

        #horizontal layout
        self.fbxMainLayout = QtWidgets.QHBoxLayout(self.fbxImportTab)

        #LEFT SIDE

        #module list widget
        self.fbxModuleList = QtWidgets.QListWidget()
        self.fbxMainLayout.addWidget(self.fbxModuleList)
        self.fbxModuleList.setMinimumSize(QtCore.QSize(300, 280))
        self.fbxModuleList.setMaximumSize(QtCore.QSize(300, 280))
        self.fbxModuleList.setSpacing(15)
        self.fbxModuleList.setSelectionMode(
            QtWidgets.QAbstractItemView.NoSelection)

        #RIGHT SIDE

        self.fbxRightLayout = QtWidgets.QVBoxLayout()
        self.fbxMainLayout.addLayout(self.fbxRightLayout)

        self.fbxCharacterCombo = QtWidgets.QComboBox()
        self.fbxRightLayout.addWidget(self.fbxCharacterCombo)
        self.fbxCharacterCombo.setMinimumSize(QtCore.QSize(250, 50))
        self.fbxCharacterCombo.setMaximumSize(QtCore.QSize(250, 50))
        self.fbxCharacterCombo.setIconSize(QtCore.QSize(45, 45))
        self.fbxCharacterCombo.currentIndexChanged.connect(
            partial(self.findCharacterModules))

        self.fbxPathLayout = QtWidgets.QHBoxLayout()
        self.fbxRightLayout.addLayout(self.fbxPathLayout)

        self.fbxFilePath = QtWidgets.QLineEdit()
        self.fbxFilePath.setMinimumWidth(210)
        self.fbxFilePath.setMaximumWidth(210)
        self.fbxPathLayout.addWidget(self.fbxFilePath)
        self.fbxFilePath.setPlaceholderText("fbx file..")

        browseBtn = QtWidgets.QPushButton()
        browseBtn.setMinimumSize(25, 25)
        browseBtn.setMaximumSize(25, 25)
        self.fbxPathLayout.addWidget(browseBtn)
        icon = QtGui.QIcon(
            utils.returnNicePath(self.iconsPath, "System/fileBrowse.png"))
        browseBtn.setIconSize(QtCore.QSize(25, 25))
        browseBtn.setIcon(icon)
        browseBtn.clicked.connect(self.fbxFileBrowse)

        self.frameOffsetLayout = QtWidgets.QHBoxLayout()
        self.fbxRightLayout.addLayout(self.frameOffsetLayout)

        frameOffset = QtWidgets.QLabel("Frame Offset:")
        frameOffset.setStyleSheet("background: transparent; font: bold;")
        self.frameOffsetLayout.addWidget(frameOffset)

        self.frameOffsetField = QtWidgets.QSpinBox()
        self.frameOffsetField.setButtonSymbols(
            QtWidgets.QAbstractSpinBox.NoButtons)
        self.frameOffsetField.setRange(-1000, 10000)
        self.frameOffsetLayout.addWidget(self.frameOffsetField)

        #option to strip namespace
        self.stripNamespace = QtWidgets.QCheckBox("Strip Incoming Namespace")
        self.stripNamespace.setToolTip(
            "If the incoming FBX has a namespace, checking this\noption will strip that namespace upon import"
        )
        self.stripNamespace.setChecked(True)
        self.fbxRightLayout.addWidget(self.stripNamespace)

        #Save/Load Settings
        saveLoadLayout = QtWidgets.QHBoxLayout()
        self.fbxRightLayout.addLayout(saveLoadLayout)

        saveSettingsBtn = QtWidgets.QPushButton("Save Settings")
        saveSettingsBtn.setMinimumSize(120, 30)
        saveSettingsBtn.setMaximumSize(120, 30)
        icon = QtGui.QIcon(
            utils.returnNicePath(self.iconsPath, "System/save.png"))
        saveSettingsBtn.setIconSize(QtCore.QSize(25, 25))
        saveSettingsBtn.setIcon(icon)
        saveLoadLayout.addWidget(saveSettingsBtn)
        saveSettingsBtn.setObjectName("blueButton")
        saveSettingsBtn.setToolTip("Save out module import settings")
        saveSettingsBtn.clicked.connect(self.saveSettings)

        loadSettingsBtn = QtWidgets.QPushButton("Load Settings")
        loadSettingsBtn.setMinimumSize(120, 30)
        loadSettingsBtn.setMaximumSize(120, 30)
        icon = QtGui.QIcon(
            utils.returnNicePath(self.iconsPath, "System/load.png"))
        loadSettingsBtn.setIconSize(QtCore.QSize(25, 25))
        loadSettingsBtn.setIcon(icon)
        saveLoadLayout.addWidget(loadSettingsBtn)
        loadSettingsBtn.setObjectName("blueButton")
        loadSettingsBtn.setToolTip("Load and set module import settings")
        loadSettingsBtn.clicked.connect(self.loadSettings)

        #SPACER!
        self.fbxRightLayout.addSpacerItem(
            QtWidgets.QSpacerItem(0, 0, QtWidgets.QSizePolicy.Fixed,
                                  QtWidgets.QSizePolicy.Expanding))

        #Button
        self.importFBXbutton = QtWidgets.QPushButton("Import")
        self.fbxRightLayout.addWidget(self.importFBXbutton)
        self.importFBXbutton.setObjectName("blueButton")
        self.importFBXbutton.setMinimumHeight(50)
        self.importFBXbutton.clicked.connect(self.fbxImport)

        #show window
        self.mainWin.show()

        #populate UI
        self.findCharacters()
        self.findCharacterModules()
Exemplo n.º 7
0
    def buildUI(self):

        if cmds.window("pyART_SelectControlsWIN", exists=True):
            cmds.deleteUI("pyART_SelectControlsWIN", wnd=True)

        # create the main window
        self.mainWin = QtWidgets.QMainWindow(self.pickerUI)

        # create the main widget
        self.mainWidget = QtWidgets.QFrame()
        self.mainWidget.setObjectName("dark")
        self.mainWin.setCentralWidget(self.mainWidget)

        # create the mainLayout
        self.mainLayout = QtWidgets.QVBoxLayout(self.mainWidget)

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

        self.mainWin.setStyleSheet(self.style)

        self.mainWin.setMinimumSize(QtCore.QSize(400, 250))
        self.mainWin.setMaximumSize(QtCore.QSize(400, 250))
        self.mainWin.resize(400, 250)

        # set qt object name
        self.mainWin.setObjectName("pyART_SelectControlsWIN")
        self.mainWin.setWindowTitle("Select Rig Controls")

        self.layout = QtWidgets.QHBoxLayout()
        self.mainLayout.addLayout(self.layout)

        # LEFT SIDE
        # list of modules
        self.moduleList = QtWidgets.QListWidget()
        self.moduleList.setMinimumSize(QtCore.QSize(180, 230))
        self.moduleList.setMaximumSize(QtCore.QSize(180, 230))
        self.layout.addWidget(self.moduleList)
        self.moduleList.setSelectionMode(
            QtWidgets.QAbstractItemView.MultiSelection)

        self.moduleList.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
        self.moduleList.customContextMenuRequested.connect(
            self.createContextMenu)

        # RIGHT SIDE
        self.rightLayout = QtWidgets.QVBoxLayout()
        self.layout.addLayout(self.rightLayout)

        # character combo
        self.characterCombo = QtWidgets.QComboBox()
        self.rightLayout.addWidget(self.characterCombo)
        self.characterCombo.setMinimumSize(QtCore.QSize(180, 60))
        self.characterCombo.setMaximumSize(QtCore.QSize(180, 60))
        self.characterCombo.setIconSize(QtCore.QSize(50, 50))
        self.characterCombo.currentIndexChanged.connect(
            partial(self.findCharacterModules))

        # select options
        self.fkControlsCB = QtWidgets.QCheckBox("FK Controls")
        self.fkControlsCB.setChecked(True)
        self.fkControlsCB.setToolTip(
            "If this is checked, for the selected modules,\nall FK controls will be selected or added to the selection."
        )
        self.rightLayout.addWidget(self.fkControlsCB)

        self.ikControlsCB = QtWidgets.QCheckBox("IK Controls")
        self.ikControlsCB.setChecked(True)
        self.ikControlsCB.setToolTip(
            "If this is checked, for the selected modules,\nall IK controls will be selected or added to the selection."
        )
        self.rightLayout.addWidget(self.ikControlsCB)

        self.specialControlsCB = QtWidgets.QCheckBox("Special Controls")
        self.specialControlsCB.setChecked(True)
        self.specialControlsCB.setToolTip(
            "If this is checked, for the selected modules,\nany control that is not FK or IK (like dynamics for example),\nwill be selected or added to the selection."
        )
        self.rightLayout.addWidget(self.specialControlsCB)

        self.selectSettingsCB = QtWidgets.QCheckBox("Include Settings")
        self.selectSettingsCB.setChecked(True)
        self.selectSettingsCB.setToolTip(
            "If this is checked, for the selected modules,\nall settings nodes will be included in the selection."
        )
        self.rightLayout.addWidget(self.selectSettingsCB)

        self.selectSpacesCB = QtWidgets.QCheckBox("Include Spaces")
        self.selectSpacesCB.setChecked(True)
        self.selectSpacesCB.setToolTip(
            "If this is checked, for the selected modules,\nall space switching nodes will be included in the selection."
        )
        self.rightLayout.addWidget(self.selectSpacesCB)

        self.rightLayout.addSpacerItem(
            QtWidgets.QSpacerItem(0, 0, QtWidgets.QSizePolicy.Fixed,
                                  QtWidgets.QSizePolicy.Expanding))

        self.selectCtrlsBtn = QtWidgets.QPushButton("Select Controls")
        self.selectCtrlsBtn.setMinimumWidth(180)
        self.selectCtrlsBtn.setMaximumWidth(180)
        self.rightLayout.addWidget(self.selectCtrlsBtn)
        self.selectCtrlsBtn.setObjectName("blueButton")
        self.selectCtrlsBtn.clicked.connect(self.selectControls)

        # show window
        if self.showUI:
            self.mainWin.show()

        # populate UI
        self.findCharacters()
        self.findCharacterModules()