Ejemplo n.º 1
0
    def populateCharacters(self):
        """
        Given the selected project and group, populate the QListWidget with any assets found using that information.
        The project path comes from the QSettings, the group is a subfolder of the project.

        """

        # add project button
        font = QtGui.QFont()
        font.setPointSize(12)
        font.setBold(True)

        # get a list of the existing folders in projects
        selectedProject = self.projectMenu.currentText()
        fullPath = os.path.join(self.projectPath, selectedProject)
        selectedGroup = self.groupMenu.currentText()
        if len(selectedGroup) > 1:
            fullPath = os.path.join(fullPath, selectedGroup)

        existingCharacters = os.listdir(fullPath)
        files = []

        # find out which returned items are directories
        for each in existingCharacters:
            if os.path.isfile(os.path.join(fullPath, each)):
                if each.rpartition(".")[2] == "ma":
                    files.append(each)

        # otherwise, add each project to the combo box
        self.characterList.clear()

        for each in files:
            item = QtWidgets.QListWidgetItem(each.partition(".ma")[0])
            item.setFont(font)
            self.characterList.addItem(item)
Ejemplo n.º 2
0
    def findCharacterModules(self, *args):

        if self.showUI:
            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:
                    modName = cmds.getAttr(module + ".moduleName")
                    item = QtWidgets.QListWidgetItem(modName)
                    item.setData(QtCore.Qt.UserRole, module)
                    self.moduleList.addItem(item)

        else:
            index = self.pickerUI.characterTabs.currentIndex()
            selectedChar = self.pickerUI.characterTabs.tabToolTip(index)

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

            return modules
Ejemplo n.º 3
0
    def addModulesToList(self):

        #get the current tab index and the widget
        index = self.pickerUI.characterTabs.currentIndex()
        character = self.pickerUI.characterTabs.tabToolTip(index)

        #find character nodes in the scene, and compare namespace to selected tab
        characterMods = utils.returnCharacterModules()
        nodeNamespace = ""

        for each in characterMods:
            if cmds.objExists(each + ".namespace"):
                namespace = cmds.getAttr(each + ".namespace")
                if namespace == character:
                    nodeNamespace = namespace + ":"

        for module in self.modulesToAdd:
            info = self.getCurrentCanvasTab(module)
            if info[1] != None:
                modName = cmds.getAttr(nodeNamespace + module + ".moduleName")

                #add to listWIdget
                item = QtWidgets.QListWidgetItem(modName)
                item.setData(QtCore.Qt.UserRole, module)
                self.moduleList.addItem(item)
Ejemplo n.º 4
0
    def checkForCustomMeshes(self):

        #check for custom geometry
        skinnableGeo = self.findCustomGeo()
        meshes = list(skinnableGeo)

        if len(skinnableGeo) > 0:

            matches = []

            #check to see if weight files exist for this geo on disk
            for i in range(len(meshes)):
                filePath = utils.returnFriendlyPath(
                    os.path.join(cmds.internalVar(utd=True),
                                 meshes[i] + ".WEIGHTS"))
                if os.path.exists(filePath):
                    matches.append(meshes[i])

            if len(matches) > 0:
                for match in matches:
                    listWidgetItem = QtWidgets.QListWidgetItem(match)
                    self.page5MeshList.addItem(listWidgetItem)
                    listWidgetItem.setSelected(True)

                #go to page 5
                self.stackWidget.setCurrentIndex(4)

            else:
                #go to page 3
                self.stackWidget.setCurrentIndex(2)

        else:
            #go to page 2
            self.stackWidget.setCurrentIndex(1)
Ejemplo n.º 5
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)
Ejemplo n.º 6
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:
                modName = cmds.getAttr(module + ".moduleName")
                item = QtWidgets.QListWidgetItem(modName)
                item.setData(QtCore.Qt.UserRole, module)
                self.moduleList.addItem(item)
Ejemplo n.º 7
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)
Ejemplo n.º 8
0
    def buildUI(self):
        """
        Build the UI, listing all modules in the scene that make up the asset for the user to select and build rigs
        for the selected.

        """

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

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

        self.mainWin.setStyleSheet(self.style)

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

        # set qt object name
        self.mainWin.setObjectName("ART_DebugRigsWin")
        self.mainWin.setWindowTitle("Build Rigs")

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

        # set size policy
        mainSizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed,
                                               QtWidgets.QSizePolicy.Fixed)

        # create the mainLayout for the rig creator UI
        self.layout = QtWidgets.QVBoxLayout(self.mainWidget)

        self.mainWin.resize(400, 300)
        self.mainWin.setSizePolicy(mainSizePolicy)
        self.mainWin.setMinimumSize(QtCore.QSize(400, 300))
        self.mainWin.setMaximumSize(QtCore.QSize(400, 300))

        # create the QFrame for this page
        self.background = QtWidgets.QFrame()
        self.background.setObjectName("mid")
        self.layout.addWidget(self.background)
        self.mainLayout = QtWidgets.QHBoxLayout(self.background)

        # create the list on the left and add the modules to the list
        self.moduleList = QtWidgets.QListWidget()
        self.mainLayout.addWidget(self.moduleList)

        for mod in self.mainUI.moduleInstances:
            item = QtWidgets.QListWidgetItem(mod.name)
            item.setData(QtCore.Qt.UserRole, mod)
            self.moduleList.addItem(item)

        # create our buttons on the right
        self.rightLayout = QtWidgets.QVBoxLayout()
        self.mainLayout.addLayout(self.rightLayout)

        infoText = "This tool is only for testing rigs in development. "
        infoText += "It will leave behind nodes in your scene that you do NOT want to publish with. "
        infoText += "When using this tool, it is advised to open a clean scene to publish your final asset."

        self.info = QtWidgets.QLabel()
        self.rightLayout.addWidget(self.info)
        self.info.setWordWrap(True)
        self.info.setMinimumSize(150, 125)
        self.info.setMaximumSize(150, 125)
        self.info.setText(infoText)

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

        self.buildButton = QtWidgets.QPushButton("Build Rigs For Selected")
        self.buildButton.setObjectName("blueButton")
        self.rightLayout.addWidget(self.buildButton)
        self.buildButton.setMinimumSize(150, 40)
        self.buildButton.setMaximumSize(150, 40)
        self.buildButton.clicked.connect(partial(self.buildRigs))

        self.deleteButton = QtWidgets.QPushButton("Remove Selected Rigs")
        self.deleteButton.setObjectName("blueButton")
        self.rightLayout.addWidget(self.deleteButton)
        self.deleteButton.setMinimumSize(150, 40)
        self.deleteButton.setMaximumSize(150, 40)
        self.deleteButton.clicked.connect(partial(self.deleteRig))

        self.closeButton = QtWidgets.QPushButton("Close")
        self.closeButton.setObjectName("blueButton")
        self.rightLayout.addWidget(self.closeButton)
        self.closeButton.setMinimumSize(150, 40)
        self.closeButton.setMaximumSize(150, 40)
        self.closeButton.clicked.connect(partial(self.close))

        self.mainWin.show()
Ejemplo n.º 9
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()
Ejemplo n.º 10
0
    def buildAimModeUI(self):
        """
        Builds the Aim Mode interface, finding all modules that have the ability to aim, and listing those modules
        as well as their current aim status.

        """

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

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

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

        self.aimModeWin.setStyleSheet(self.style)

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

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

        # set qt object name
        self.aimModeWin.setObjectName("ART_AimModeWin")
        self.aimModeWin.setWindowTitle("Aim Mode")

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

        self.aimModeWin.resize(400, 250)
        self.aimModeWin.setSizePolicy(mainSizePolicy)
        self.aimModeWin.setMinimumSize(QtCore.QSize(400, 250))
        self.aimModeWin.setMaximumSize(QtCore.QSize(400, 250))

        # create the background image
        self.aimModeWin_frame = QtWidgets.QFrame()
        self.aimModeWin_mainLayout.addWidget(self.aimModeWin_frame)

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

        # add the QListWidget Frame
        self.aimModeWin_moduleListFrame = QtWidgets.QFrame()
        self.aimModeWin_moduleListFrame.setMinimumSize(QtCore.QSize(275, 200))
        self.aimModeWin_moduleListFrame.setMaximumSize(QtCore.QSize(275, 200))
        self.aimModeWin_moduleListFrame.setContentsMargins(20, 0, 20, 0)

        # create the list widget
        self.aimModeWin_moduleList = QtWidgets.QListWidget(
            self.aimModeWin_moduleListFrame)
        self.aimModeWin_widgetLayout.addWidget(self.aimModeWin_moduleListFrame)
        self.aimModeWin_moduleList.setMinimumSize(QtCore.QSize(265, 200))
        self.aimModeWin_moduleList.setMaximumSize(QtCore.QSize(265, 200))
        self.aimModeWin_moduleList.setSelectionMode(
            QtWidgets.QAbstractItemView.MultiSelection)
        self.aimModeWin_moduleList.setSpacing(3)

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

        # add the selection buttons
        self.aimModeWin_selectionButtonLayout = QtWidgets.QVBoxLayout()
        self.aimModeWin_buttonLayoutAll.addLayout(
            self.aimModeWin_selectionButtonLayout)
        self.aimModeWin_selectAllButton = QtWidgets.QPushButton("Select All")
        self.aimModeWin_selectAllButton.setMinimumSize(QtCore.QSize(115, 25))
        self.aimModeWin_selectAllButton.setMaximumSize(QtCore.QSize(115, 25))
        self.aimModeWin_selectionButtonLayout.addWidget(
            self.aimModeWin_selectAllButton)
        self.aimModeWin_selectAllButton.clicked.connect(
            self.aimModeWin_moduleList.selectAll)
        self.aimModeWin_selectAllButton.setObjectName("blueButton")

        self.aimModeWin_selectNoneButton = QtWidgets.QPushButton(
            "Clear Selection")
        self.aimModeWin_selectNoneButton.setMinimumSize(QtCore.QSize(115, 25))
        self.aimModeWin_selectNoneButton.setMaximumSize(QtCore.QSize(115, 25))
        self.aimModeWin_selectionButtonLayout.addWidget(
            self.aimModeWin_selectNoneButton)
        self.aimModeWin_selectNoneButton.clicked.connect(
            self.aimModeWin_moduleList.clearSelection)
        self.aimModeWin_selectNoneButton.setObjectName("blueButton")

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

        # add the buttons for reset settings and reset transforms
        self.aimModeWin_turnOnAim = QtWidgets.QPushButton("On")
        self.aimModeWin_turnOnAim.setMinimumSize(QtCore.QSize(115, 25))
        self.aimModeWin_turnOnAim.setMaximumSize(QtCore.QSize(115, 25))
        self.aimModeWin_selectionButtonLayout.addWidget(
            self.aimModeWin_turnOnAim)
        self.aimModeWin_turnOnAim.setToolTip(
            "Turn on Aim Mode for selected modules.")
        self.aimModeWin_turnOnAim.clicked.connect(
            partial(self.aimModeUI_Toggle, True))
        self.aimModeWin_turnOnAim.setObjectName("blueButton")

        self.aimModeWin_turnOffAim = QtWidgets.QPushButton("Off")
        self.aimModeWin_turnOffAim.setMinimumSize(QtCore.QSize(115, 25))
        self.aimModeWin_turnOffAim.setMaximumSize(QtCore.QSize(115, 25))
        self.aimModeWin_selectionButtonLayout.addWidget(
            self.aimModeWin_turnOffAim)
        self.aimModeWin_turnOffAim.setToolTip(
            "Turn off Aim Mode for selected modules.")
        self.aimModeWin_turnOffAim.clicked.connect(
            partial(self.aimModeUI_Toggle, False))
        self.aimModeWin_turnOffAim.setObjectName("blueButton")

        # populate the list widget
        modules = utils.returnRigModules()
        for module in modules:
            # get module name
            moduleName = cmds.getAttr(module + ".moduleName")

            # figure out if the module supports aimMode
            canAim = False
            if cmds.objExists(module + ".canAim"):
                canAim = cmds.getAttr(module + ".canAim")

                # see if it is currently in aimMode
                aimMode = cmds.getAttr(module + ".aimMode")

            # if it does, add it to the listwidget
            if canAim:

                # font
                headerFont = QtGui.QFont()
                headerFont.setPointSize(10)
                headerFont.setBold(True)

                # create the listWidgetItem
                pixmap = QtGui.QPixmap(10, 10)
                pixmap.fill(QtGui.QColor(0, 255, 0))
                icon = QtGui.QIcon(pixmap)

                pixmapOff = QtGui.QPixmap(10, 10)
                pixmapOff.fill(QtGui.QColor(255, 0, 0))
                iconOff = QtGui.QIcon(pixmapOff)

                item = QtWidgets.QListWidgetItem(iconOff, moduleName)
                item.setFont(headerFont)
                item.setTextAlignment(QtCore.Qt.AlignCenter)
                item.setData(QtCore.Qt.UserRole, [icon, iconOff])

                if aimMode:
                    item.setIcon(icon)

                self.aimModeWin_moduleList.addItem(item)

        # show the window
        self.aimModeWin.show()
Ejemplo n.º 11
0
    def buildUI(self):

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

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

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

        self.window.setStyleSheet(self.style)

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

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

        #set qt object name
        self.window.setObjectName("ART_PinModulesWin")
        self.window.setWindowTitle("Pin Modules")

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

        self.window.resize(400, 250)
        self.window.setSizePolicy(mainSizePolicy)
        self.window.setMinimumSize(QtCore.QSize( 400, 250 ))
        self.window.setMaximumSize(QtCore.QSize( 400, 250 ))

        #create the background image
        self.frame = QtWidgets.QFrame()
        self.mainLayout.addWidget(self.frame)

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


        #left side == list of modules in scene. for each item in list, will do something similar to aim mode, where we will toggle an icon for pin state
        self.moduleList = QtWidgets.QListWidget()
        self.widgetLayout.addWidget(self.moduleList)
        self.moduleList.setMinimumSize(QtCore.QSize( 265, 200 ))
        self.moduleList.setMaximumSize(QtCore.QSize( 265, 200 ))
        self.moduleList.setSelectionMode(QtWidgets.QAbstractItemView.MultiSelection)
        self.moduleList.setSpacing(3)

        #right side layout == select all, clear selection, Pin Selected buttons
        self.buttonLayout = QtWidgets.QVBoxLayout()
        self.widgetLayout.addLayout(self.buttonLayout)
        self.buttonLayout.setContentsMargins(5, 20, 5, 20)

        #add the selection buttons
        self.selectAllButton = QtWidgets.QPushButton("Select All")
        self.selectAllButton.setMinimumSize(QtCore.QSize( 115, 25 ))
        self.selectAllButton.setMaximumSize(QtCore.QSize( 115, 25 ))
        self.buttonLayout.addWidget(self.selectAllButton)
        self.selectAllButton.clicked.connect(self.moduleList.selectAll)
        self.selectAllButton.setObjectName("blueButton")

        self.selectNoneButton = QtWidgets.QPushButton("Clear Selection")
        self.selectNoneButton.setMinimumSize(QtCore.QSize( 115, 25 ))
        self.selectNoneButton.setMaximumSize(QtCore.QSize( 115, 25 ))
        self.buttonLayout.addWidget(self.selectNoneButton)
        self.selectNoneButton.clicked.connect(self.moduleList.clearSelection)
        self.selectNoneButton.setObjectName("blueButton")

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

        #add the buttons for reset settings and reset transforms
        self.pinBtn = QtWidgets.QPushButton("Pin Selected")
        self.pinBtn.setMinimumSize(QtCore.QSize( 115, 25 ))
        self.pinBtn.setMaximumSize(QtCore.QSize( 115, 25 ))
        self.buttonLayout.addWidget(self.pinBtn)
        self.pinBtn.setToolTip("Pin the selected modules so that parent module movements do not effect the pinned module")
        self.pinBtn.clicked.connect(partial(self.toggleLock, True))
        self.pinBtn.setObjectName("blueButton")

        self.unpinBtn = QtWidgets.QPushButton("Unpin Selected")
        self.unpinBtn.setMinimumSize(QtCore.QSize( 115, 25 ))
        self.unpinBtn.setMaximumSize(QtCore.QSize( 115, 25 ))
        self.buttonLayout.addWidget(self.unpinBtn)
        self.unpinBtn.setToolTip("Unpin modules to resume normal module behavior")
        self.unpinBtn.clicked.connect(partial(self.toggleLock, False))
        self.unpinBtn.setObjectName("blueButton")



        #populate the list widget
        modules = utils.returnRigModules()
        for module in modules:
            #get module name
            moduleName = cmds.getAttr(module + ".moduleName")

            #font
            headerFont = QtGui.QFont()
            headerFont.setPointSize(10)
            headerFont.setBold(True)

            #create the listWidgetItem
            icon = QtGui.QIcon(os.path.join(self.iconsPath, "System/locked.png"))
            iconOff = QtGui.QIcon(os.path.join(self.iconsPath, "System/unlocked.png"))

            item = QtWidgets.QListWidgetItem(iconOff, "    " + moduleName)
            item.setFont(headerFont)
            item.setData(QtCore.Qt.UserRole, [icon, iconOff])

            pinState = cmds.getAttr(module + ".pinned")
            if pinState:
                item.setIcon(icon)


            self.moduleList.addItem(item)


        #show the window
        self.window.show()
Ejemplo n.º 12
0
    def buildUI(self):

        if cmds.window("pyART_movePickerToTabWIN", exists=True):
            cmds.deleteUI("pyART_movePickerToTabWIN", 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.mainLayout = QtWidgets.QVBoxLayout(self.mainWidget)
        self.layout = QtWidgets.QHBoxLayout()
        self.mainLayout.addLayout(self.layout)

        #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, 400))
        self.mainWin.setMaximumSize(QtCore.QSize(400, 400))
        self.mainWin.resize(400, 400)

        #set qt object name
        self.mainWin.setObjectName("pyART_movePickerToTabWIN")
        self.mainWin.setWindowTitle("Move Picker")

        #create 2 columns
        self.column1 = QtWidgets.QVBoxLayout()
        self.layout.addLayout(self.column1)

        self.column2 = QtWidgets.QVBoxLayout()
        self.layout.addLayout(self.column2)

        #create left side list widget, which will house the picker items
        self.pickerItemsList = QtWidgets.QListWidget()
        self.column1.addWidget(self.pickerItemsList)
        self.pickerItemsList.setMinimumSize(180, 300)
        self.pickerItemsList.setMaximumSize(180, 300)

        #get the current tab index and the widget
        index = self.pickerUI.characterTabs.currentIndex()
        widget = self.pickerUI.characterTabs.widget(index)

        #get the tab text
        character = self.pickerUI.characterTabs.tabToolTip(index)

        #find character nodes in the scene, and compare namespace to selected tab
        characterMods = utils.returnCharacterModules()
        nodeNamespace = ""

        for each in characterMods:
            if cmds.objExists(each + ".namespace"):
                namespace = cmds.getAttr(each + ".namespace")
                if namespace == character:
                    nodeNamespace = namespace + ":"

        for module in self.modulesToAdd:
            if module[2] == None:
                modName = cmds.getAttr(nodeNamespace + module[0] +
                                       ".moduleName")
            else:
                modName = module[2]

            qlistItem = QtWidgets.QListWidgetItem(modName)
            qlistItem.setData(QtCore.Qt.UserRole, module[1])
            self.pickerItemsList.addItem(qlistItem)

        #create right side list widget, which will house the available tabs
        self.tabList = QtWidgets.QListWidget()
        self.column2.addWidget(self.tabList)
        self.tabList.setMinimumSize(180, 300)
        self.tabList.setMaximumSize(180, 300)

        tabs = self.findTabs(False)
        for tab in tabs:
            qlistItem = QtWidgets.QListWidgetItem(tab[0])
            qlistItem.setData(QtCore.Qt.UserRole, tab[1])
            self.tabList.addItem(qlistItem)

        #create button for move selected picker to selected tab
        self.movePickerBtn = QtWidgets.QPushButton(
            "Move Selected Picker To Selected Tab")
        self.mainLayout.addWidget(self.movePickerBtn)
        self.movePickerBtn.setObjectName("blueButton")
        self.movePickerBtn.setMinimumHeight(50)
        self.movePickerBtn.setMaximumHeight(50)
        self.movePickerBtn.clicked.connect(self.moveToTab)

        #show ui
        self.mainWin.show()