Exemple #1
0
    def getInfo(self):

        #need to eventually swap this with the real file
        request = urllib2.Request(
            "https://raw.githubusercontent.com/epicernst/Test/master/ARTv2_VersionInfo.json"
        )
        base64String = base64.encodestring(
            '%s:%s' % (self.credentials[0], self.credentials[1])).replace(
                '\n', '')
        request.add_header("Authorization", "Basic %s" % base64String)
        try:
            result = urllib2.urlopen(request)
        except Exception, e:
            self.infoText.setTextColor(QtGui.QColor(249, 241, 12))
            self.infoText.append(str(e))
            self.infoText.append(
                "Your Github login credentials may be invalid or you do not have access to this repo.\n\n"
            )
            self.infoText.setTextColor(QtGui.QColor(255, 255, 255))

            settings = QtCore.QSettings("Epic Games", "ARTv2")
            settings.remove("gitUser")
            settings.remove("gitPass")

            return
Exemple #2
0
    def __init__(self, x, y, w, h, scene, view, animUI):

        super(commentBoxItem, self).__init__(x, y, w, h)

        self.brush = QtGui.QBrush(QtGui.QColor(60, 60, 60, 125))
        self.brushColor = self.brush.color()
        self.width = w
        self.height = h
        self.x = x
        self.y = y
        self.scale = 1
        self.menu = QtWidgets.QMenu()
        self.scene = scene
        self.view = view
        self.animUI = animUI

        self.setFlag(QtWidgets.QGraphicsItem.ItemSendsGeometryChanges)

        # add items to context menu
        self.menu.addAction("Change Color", self.changeBoxColor)
        self.menu.addAction("Rename", self.changeLabelText)
        self.menu.addAction("Remove Comment Box", self.deleteCommentBox)

        # add text
        self.textLabel = QtWidgets.QGraphicsTextItem("Comment Box", self, scene)
        self.textLabel.setPos(x, y - 20)
        self.textLabel.setTextInteractionFlags(QtCore.Qt.NoTextInteraction)
        # self.textLabel.setTextInteractionFlags(QtCore.Qt.TextEditable)

        self.classType = "comment"
Exemple #3
0
    def pickerUI(self, center, animUI, networkNode, namespace):

        #create qBrushes
        yellowBrush = QtCore.Qt.yellow
        blueBrush = QtGui.QColor(100, 220, 255)
        purpleBrush = QtGui.QColor(111, 48, 161)
        clearBrush = QtGui.QBrush(QtCore.Qt.black)
        clearBrush.setStyle(QtCore.Qt.NoBrush)

        #create border item
        if networkNode.find(":") != -1:
            moduleNode = networkNode.partition(":")[2]
        else:
            moduleNode = networkNode
        borderItem = interfaceUtils.pickerBorderItem(center.x() - 40,
                                                     center.y() - 70, 50, 98,
                                                     clearBrush, moduleNode)

        #get controls + namespace
        networkNode = self.returnNetworkNode
        controls = json.loads(cmds.getAttr(networkNode + ".rootControls"))

        #master anim button
        masterBtn = interfaceUtils.pickerButton(30, 30, [10, 2],
                                                namespace + controls[0],
                                                yellowBrush, borderItem)
        interfaceUtils.addTextToButton("M", masterBtn)

        #offset anim button
        offsetBtn = interfaceUtils.pickerButton(30, 30, [10, 34],
                                                namespace + controls[1],
                                                blueBrush, borderItem)
        interfaceUtils.addTextToButton("O", offsetBtn)

        #root anim button
        rootBtn = interfaceUtils.pickerButton(30, 30, [10, 66],
                                              namespace + controls[2],
                                              purpleBrush, borderItem)
        interfaceUtils.addTextToButton("R", rootBtn)

        #=======================================================================
        # #Create scriptJob for selection. Set scriptJob number to borderItem.data(5)
        #=======================================================================
        scriptJob = cmds.scriptJob(event=[
            "SelectionChanged",
            partial(self.selectionScriptJob_animUI,
                    [[masterBtn, namespace + controls[0], yellowBrush],
                     [offsetBtn, namespace + controls[1], blueBrush],
                     [rootBtn, namespace + controls[2], purpleBrush]])
        ],
                                   kws=True)
        borderItem.setData(5, scriptJob)
        animUI.selectionScriptJobs.append(scriptJob)

        return [borderItem, False, scriptJob]
Exemple #4
0
    def invalidCreds(self):

        self.infoText.setTextColor(QtGui.QColor(249, 241, 12))
        self.infoText.append(
            "You have either not setup your Github credentials under Settings, or your github account is not linked with your Epic Games account."
        )
        self.infoText.append(
            "For more information on linking your github and Epic Games accounts, see:\n"
        )
        self.infoText.append("https://www.unrealengine.com/ue4-on-github")
        self.infoText.setTextColor(QtGui.QColor(255, 255, 255))
Exemple #5
0
    def buildUI(self):
        #Original Author: Jeremy Ernst

        #create the main window
        self.mainWin = QtWidgets.QMainWindow(self.mainUI)
        self.mainWin.setStyleSheet(
            "background-color: rgb(0, 0, 0);, color: rgb(0,0,0);")

        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_RigHistWin")
        self.mainWin.setWindowTitle("Rig History")

        #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, 240)
        self.mainWin.setSizePolicy(mainSizePolicy)
        self.mainWin.setMinimumSize(QtCore.QSize(400, 240))
        self.mainWin.setMaximumSize(QtCore.QSize(400, 240))

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

        #detailed information
        self.infoText = QtWidgets.QTextEdit()
        self.mainLayout.addWidget(self.infoText)
        self.infoText.setMinimumSize(QtCore.QSize(360, 200))
        self.infoText.setMaximumSize(QtCore.QSize(360, 200))
        self.infoText.setReadOnly(True)
        self.infoText.setWordWrapMode(QtGui.QTextOption.WordWrap)

        #show the window
        self.mainWin.show()

        self.getHistory()
Exemple #6
0
    def populateIcon(self, *args):
        """
        Given the selected character, display the correct icon for that character in the UI.

        """

        # default
        self.characterIcon.setPixmap(self.defaultPixMap)

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

        selectedCharacter = self.characterList.currentItem().text()
        fullPath = utils.returnNicePath(fullPath, selectedCharacter + ".png")

        if os.path.exists(fullPath):
            pixmap = QtGui.QPixmap(fullPath)
            self.characterIcon.setPixmap(pixmap)

        else:
            self.characterIcon.setPixmap(self.defaultPixMap)
Exemple #7
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)
Exemple #8
0
    def getHistory(self):

        characterNode = "ART_RIG_ROOT"
        data = json.loads(cmds.getAttr(characterNode + ".versionNote"))

        for each in data:

            version = each[0]
            info = each[1]
            user = each[2]

            self.infoText.setTextColor(QtGui.QColor(236, 217, 0))
            self.infoText.append("Version #: " + str(version))
            self.infoText.setTextColor(QtGui.QColor(255, 255, 255))
            self.infoText.append("Description: " + info)
            self.infoText.setTextColor(QtGui.QColor(0, 255, 0))
            self.infoText.append("User: "******"\n\n")
Exemple #9
0
    def paint(self, painter, option, widget):
        rec = self.boundingRect()

        self.blackPen = QtGui.QPen(QtCore.Qt.black)
        self.blackPen.setWidth(0)
        painter.setPen(self.blackPen)
        painter.fillRect(rec, self.brush)
        painter.drawRect(rec)
    def moveToTab(self):

        selectedItem = self.pickerItemsList.currentItem()
        selectedTab = self.tabList.currentItem()

        try:
            newTab = selectedTab.data(QtCore.Qt.UserRole)
        except:
            cmds.warning("Please Select a Tab from the list.")
            return

        #get selected tab's scene
        scene = self.findTabs(True, newTab)

        #get data from selectedItem
        pickerItem = selectedItem.data(QtCore.Qt.UserRole)
        try:
            parentXform = pickerItem.parentItem().transform()
        except:
            parentXform = pickerItem.transform()

        #add to scene
        scene.addItem(pickerItem)

        #=======================================================================
        # #mirror if needed
        #=======================================================================
        if parentXform.m11() == -1:
            pickerItem.setTransformOriginPoint(
                pickerItem.boundingRect().center())
            pickerItem.setTransform(
                QtGui.QTransform(-1.0, 0.0, 0.0, 1.0,
                                 scene.sceneRect().width(), 0.0))
            pickerItem.setTransformOriginPoint(
                pickerItem.boundingRect().center())

            children = pickerItem.childItems()
            for child in children:
                if type(child) == QtWidgets.QGraphicsSimpleTextItem:
                    child.setTransformOriginPoint(
                        child.boundingRect().center())
                    child.setTransform(
                        QtGui.QTransform(-1.0, 0.0, 0.0, 1.0,
                                         child.boundingRect().width(), 0.0))
Exemple #11
0
    def addJointMoverToOutliner(self):

        index = self.rigUiInst.treeWidget.topLevelItemCount()

        #Add the module to the tree widget in the outliner tab of the rig creator UI
        self.outlinerWidgets[self.name +
                             "_treeModule"] = QtWidgets.QTreeWidgetItem(
                                 self.rigUiInst.treeWidget)
        self.rigUiInst.treeWidget.topLevelItem(index).setText(0, self.name)
        foreground = QtGui.QBrush(QtGui.QColor(255, 255, 255))
        self.outlinerWidgets[self.name + "_treeModule"].setForeground(
            0, foreground)
        #add the buttons
        self.createGlobalMoverButton(
            self.name, self.outlinerWidgets[self.name + "_treeModule"],
            self.rigUiInst)

        #create selection script job for module
        self.updateBoneCount()
        self.createScriptJob()
Exemple #12
0
    def createContextMenu(self, point):

        self.contextMenu = QtWidgets.QMenu()

        selectIcon = QtGui.QIcon((utils.returnFriendlyPath(
            os.path.join(self.iconsPath, "System/select.png"))))

        self.contextMenu.addAction(selectIcon, "Select All",
                                   self.selectAllInList)
        self.contextMenu.addAction("Clear Selection", self.clearListSelection)

        self.contextMenu.exec_(self.moduleList.mapToGlobal(point))
Exemple #13
0
    def paint(self, painter, option, widget):
        rec = self.boundingRect()

        blackPen = QtGui.QPen(QtCore.Qt.transparent)
        blackPen.setWidth(0)
        blackPen.setStyle(QtCore.Qt.DotLine)
        painter.setPen(blackPen)

        flags = self.flags()
        if flags & QtWidgets.QGraphicsItem.ItemIsMovable:
            blackPen = QtGui.QPen(QtCore.Qt.black)
            blackPen.setWidth(0)
            blackPen.setStyle(QtCore.Qt.DotLine)
            painter.setPen(blackPen)

        if self.isSelected():
            blackPen = QtGui.QPen(QtCore.Qt.white)
            blackPen.setWidth(0)
            blackPen.setStyle(QtCore.Qt.DotLine)
            painter.setPen(blackPen)

        painter.fillRect(rec, self.brush)
        painter.drawRect(rec)
Exemple #14
0
    def __init__(self, width, height, relativePos, controlObjects, brush, parent=None):

        super(pickerButtonAll, self).__init__(parent)

        self.parentItem().setZValue(1)
        self.setZValue(2)

        self.brush = QtGui.QBrush(brush)
        self.brushColor = brush

        self.width = width
        self.height = height
        self.relativePos = relativePos
        self.objects = controlObjects

        self.setPos(self.parentItem().boundingRect().topLeft())
        self.setPos(self.pos().x() + self.relativePos[0], self.pos().y() + self.relativePos[1])
Exemple #15
0
def addTextToButton(text, parent, centered=True, top=False, bottom=False):
    text = QtWidgets.QGraphicsSimpleTextItem(text, parent)
    font = QtGui.QFont()
    font.setBold(True)
    font.setPointSize(12)

    text.setFont(font)
    textPos = parent.boundingRect().center()
    textRect = text.boundingRect()
    parentRect = parent.boundingRect()

    if centered:
        text.setPos(textPos.x() - textRect.width() / 2, textPos.y() - textRect.height() / 2)

    if top:
        text.setPos(textPos.x() - textRect.width() / 2, textPos.y() - (parentRect.height() / 2 + textRect.height()))

    if bottom:
        text.setPos(textPos.x() - textRect.width() / 2, textPos.y() + (parentRect.height() / 2))

    return text
Exemple #16
0
    def postScript(self):
        """
        If there is a post-script to run, this will call on ART_BuildProgressUI.executeScript() to run the post-script.
        Then it will call on ART_BuildProgressUI.completeBuild() which wraps up the build process and alerts the user
        the build is done.

        .. note:: Post-Scipts are used if you ever want to do something to your character after the rig gets built.
                  An example usage would be adding custom rigging to joints or controls in the scene, setting up custom
                  relationships or set-driven keys, etc.

        .. seealso:: ART_BuildProgressUI.executeScript(), ART_BuildProgressUI.completeBuild()

        """

        self.infoText.append(" \n")

        # get pre-script path from character node, if it exists
        characterNode = utils.returnCharacterModule()
        if cmds.objExists(characterNode + ".postScriptPath"):
            scriptPath = cmds.getAttr(characterNode + ".postScriptPath")
            self.infoText.append("Executing Post-Script..")
            self.infoText.append("    " + scriptPath)

            # try to execute the pre-script
            status = self.executeScript(scriptPath)
            if status:
                self.infoText.setTextColor(QtGui.QColor(0, 255, 18))
                self.infoText.append("    SUCCESS: Post-Script Was Successfully Executed..")
                self.infoText.setTextColor(QtGui.QColor(255, 255, 255))

            if not status:
                self.infoText.setTextColor(QtGui.QColor(255, 0, 0))
                self.infoText.append("    FAILED: Post-Script Was Not Successfully Executed..")
                self.infoText.setTextColor(QtGui.QColor(255, 255, 255))
                self.errors += 1

        else:
            self.infoText.setTextColor(QtGui.QColor(255, 255, 0))
            self.infoText.append("No Post-Script To Run..")
            self.infoText.setTextColor(QtGui.QColor(255, 255, 255))

        # update main progress bar
        self.totalProgress.setValue(10)

        # capture model pose for rig controls
        cmds.file(save=True, type="mayaAscii")
        self.completeBuild()
Exemple #17
0
    def __init__(self, width, height, pointArray, relativePos, controlObj, brush, parent=None):

        super(pickerButtonCustom, self).__init__(parent)

        self.parentItem().setZValue(1)
        self.setZValue(2)

        self.brush = QtGui.QBrush(brush)
        self.brushColor = brush
        self.pointArray = pointArray
        self.poly = self.createPolygon()
        self.setPolygon(self.poly)

        # position item
        self.relativePos = relativePos
        self.object = controlObj
        self.setPos(self.parentItem().boundingRect().topLeft())
        self.setPos(self.pos().x() + self.relativePos[0], self.pos().y() + self.relativePos[1])

        # create menu
        self.menu = QtWidgets.QMenu()
        self.classType = "pickerButton"
Exemple #18
0
    def findCharacters(self):

        allNodes = cmds.ls(type="network")
        characterNodes = []
        for node in allNodes:
            attrs = cmds.listAttr(node)
            if "rigModules" in attrs:
                characterNodes.append(node)

        # go through each node, find the character name, the namespace on the node, and the picker attribute
        for node in characterNodes:
            try:
                namespace = cmds.getAttr(node + ".namespace")
            except:
                namespace = cmds.getAttr(node + ".name")

            # add the icon found on the node's icon path attribute to the tab
            iconPath = cmds.getAttr(node + ".iconPath")
            iconPath = utils.returnNicePath(self.projectPath, iconPath)
            icon = QtGui.QIcon(iconPath)

            self.characterCombo.addItem(icon, namespace)
Exemple #19
0
    def preScript(self):
        """
        If there is a pre-script to run, this will call on ART_BuildProgressUI.executeScript() to run the pre-script.
        Then it will call on ART_BuildProgressUI.buildRigs() to build each module's rigs.

        .. note:: Pre-Scipts are used if you ever want to do something to your character before the rig gets built.
                  An example usage would be adding IK joints for UE4 in a pre-script, as you don't want or need
                  controls for those IK joints, and setting up those constraints.

        .. seealso:: ART_BuildProgressUI.executeScript(), ART_BuildProgressUI.buildRigs()

        """

        self.infoText.append(" \n")

        # get pre-script path from character node, if it exists
        characterNode = utils.returnCharacterModule()
        if cmds.objExists(characterNode + ".preScriptPath"):
            scriptPath = cmds.getAttr(characterNode + ".preScriptPath")
            self.infoText.append("Executing Pre-Script..")
            self.infoText.append("    " + scriptPath)

            # try to execute the pre-script
            status = self.executeScript(scriptPath)
            if status:
                self.infoText.setTextColor(QtGui.QColor(0, 255, 18))
                self.infoText.append("    SUCCESS: Pre-Script Was Successfully Executed..")
                self.infoText.setTextColor(QtGui.QColor(255, 255, 255))

            if not status:
                self.infoText.setTextColor(QtGui.QColor(255, 0, 0))
                self.infoText.append("    FAILED: Pre-Script Was Not Successfully Executed..")
                self.infoText.setTextColor(QtGui.QColor(255, 255, 255))
                self.errors += 1
        else:
            self.infoText.setTextColor(QtGui.QColor(255, 255, 0))
            self.infoText.append("No Pre-Script To Run..")
            self.infoText.setTextColor(QtGui.QColor(255, 255, 255))

        # update main progress bar
        self.totalProgress.setValue(8)

        # build rigs
        self.buildRigs()
Exemple #20
0
    def populateTable(self):

        pixmap = QtGui.QPixmap(20, 20)
        pixmap.fill(QtGui.QColor(0, 255, 0))
        iconOn = QtGui.QIcon(pixmap)

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

        modules = utils.returnRigModules()
        self.modTable.setRowCount(100 + len(modules))
        counter = 0
        for module in modules:

            aimState = False
            pinState = False

            #get module name
            moduleName = cmds.getAttr(module + ".moduleName")

            if cmds.objExists(module + ".aimMode"):
                aimState = cmds.getAttr(module + ".aimMode")
            if cmds.objExists(module + ".pinned"):
                pinState = cmds.getAttr(module + ".pinned")

            moduleItem = QtWidgets.QTableWidgetItem(moduleName)
            self.modTable.setItem(counter, 0, moduleItem)

            if aimState:
                lockItem = QtWidgets.QTableWidgetItem(iconOn, "")
            else:
                lockItem = QtWidgets.QTableWidgetItem(iconOff, "")

            self.modTable.setItem(counter, 2, lockItem)

            if pinState:
                pinItem = QtWidgets.QTableWidgetItem(iconOn, "")
            else:
                pinItem = QtWidgets.QTableWidgetItem(iconOff, "")

            self.modTable.setItem(counter, 1, pinItem)

            counter += 1
Exemple #21
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)
Exemple #22
0
    def finalizeSetup_UI(self):

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

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

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

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

        self.finalizeSetupWin.setStyleSheet(self.style)

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

        #set qt object name
        self.finalizeSetupWin.setObjectName("ART_finalizeSetupWin")
        self.finalizeSetupWin.setWindowTitle("Finalize Setup")

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

        self.finalizeSetupWin.resize(450, 300)
        self.finalizeSetupWin.setSizePolicy(mainSizePolicy)
        self.finalizeSetupWin.setMinimumSize(QtCore.QSize(450, 300))
        self.finalizeSetupWin.setMaximumSize(QtCore.QSize(450, 300))

        #create the background image
        self.finalizeSetupWin_frame = QtWidgets.QFrame()
        self.finalizeSetupWin_mainLayout.addWidget(self.finalizeSetupWin_frame)

        #create the main vertical layout inside the frame
        self.finalizeSetupWin_mainVLayout = QtWidgets.QVBoxLayout(
            self.finalizeSetupWin_frame)

        # # # # TEXT EDIT # # # #
        self.finalizeSetupWin_Text = QtWidgets.QTextEdit()
        self.finalizeSetupWin_Text.setMinimumSize(QtCore.QSize(440, 230))
        self.finalizeSetupWin_Text.setMaximumSize(QtCore.QSize(440, 230))
        self.finalizeSetupWin_mainVLayout.addWidget(self.finalizeSetupWin_Text)
        self.finalizeSetupWin_Text.setReadOnly(True)
        self.finalizeSetupWin_Text.setAcceptRichText(True)

        #text
        text = "Finalizing the setup will create the skeleton that will be used for skin binding."
        cursor = self.finalizeSetupWin_Text.textCursor()
        cursor.insertText(text)

        text = "\nIt is recommended that offsets are baked before continuing.  "
        self.finalizeSetupWin_Text.setTextColor(QtGui.QColor(236, 217, 0))
        self.finalizeSetupWin_Text.setFontPointSize(10)
        self.finalizeSetupWin_Text.append(text)

        #image
        image2 = utils.returnNicePath(self.iconsPath, "System/bakeOffsets.png")
        icon = QtGui.QPixmap(image2)
        image = icon.toImage()
        cursor.insertImage(image)

        text = "\n(You will still be able to edit your setup by coming back to this step using the 'Edit Setup' button seen in the deformation tools interface):\n\n"
        self.finalizeSetupWin_Text.setTextColor(QtGui.QColor(255, 255, 255))
        self.finalizeSetupWin_Text.setFontPointSize(8)
        self.finalizeSetupWin_Text.append(text)

        #image
        image2 = utils.returnNicePath(self.iconsPath,
                                      "System/finalizeSetup.png")
        icon = QtGui.QPixmap(image2)
        image = icon.toImage()
        cursor.insertImage(image)

        self.finalizeSetupWin_Text.setTextCursor(cursor)
        end = "<br>"
        fragment = QtGui.QTextDocumentFragment.fromHtml(end)
        cursor.insertFragment(fragment)
        # # # # END TEXT EDIT # # # #

        # # # # BUTTON LAYOUT # # # #
        self.finalizeSetupWin_buttonLayout = QtWidgets.QHBoxLayout()
        self.finalizeSetupWin_mainVLayout.addLayout(
            self.finalizeSetupWin_buttonLayout)

        self.finalizeSetupWin_ContinueBtn = QtWidgets.QPushButton("Continue")
        self.finalizeSetupWin_CancelBtn = QtWidgets.QPushButton("Cancel")
        self.finalizeSetupWin_HelpBtn = QtWidgets.QPushButton("?")
        self.finalizeSetupWin_HelpBtn.setMinimumSize(QtCore.QSize(25, 25))
        self.finalizeSetupWin_HelpBtn.setMaximumSize(QtCore.QSize(25, 25))
        self.finalizeSetupWin_buttonLayout.addWidget(
            self.finalizeSetupWin_ContinueBtn)
        self.finalizeSetupWin_buttonLayout.addWidget(
            self.finalizeSetupWin_CancelBtn)
        self.finalizeSetupWin_buttonLayout.addWidget(
            self.finalizeSetupWin_HelpBtn)

        self.finalizeSetupWin_ContinueBtn.clicked.connect(
            partial(self.finalizeSetup_Continue))
        self.finalizeSetupWin_CancelBtn.clicked.connect(
            partial(self.finalizeSetup_Cancel))
        self.finalizeSetupWin_HelpBtn.clicked.connect(
            partial(self.finalizeSetup_Help))

        self.finalizeSetupWin_ContinueBtn.setObjectName("blueButton")
        self.finalizeSetupWin_CancelBtn.setObjectName("blueButton")
        self.finalizeSetupWin_HelpBtn.setObjectName("blueButton")
        # # # # END BUTTON LAYOUT # # # #

        #show window
        self.finalizeSetupWin_Text.moveCursor(QtGui.QTextCursor.Start)
        self.finalizeSetupWin.show()
Exemple #23
0
    def __init__(self, currentParent, moduleInst, rigUiInst, parent=None):
        """
        Instantiates the class, taking in current module information, and builds the interface.

        :param currentParent: The current module parent bone of this module.
        :param moduleInst: The instance in memory of the module whose name is to change.
        :param rigUiInst: The instance in memory of the Rig Creator UI from which this class was called.

        """
        super(ART_ChangeModuleParent_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.currentParent = currentParent
        self.modInst = moduleInst
        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.QVBoxLayout(self.mainWidget)
        self.mainLayout.setContentsMargins(0, 0, 0, 0)

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

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

        # create the layout for the widgets
        self.widgetLayout = QtWidgets.QVBoxLayout(self.frame)

        label = QtWidgets.QLabel("Choose New Parent:")
        font = QtGui.QFont()
        font.setBold(True)
        label.setFont(font)
        self.widgetLayout.addWidget(label)

        self.boneSearch = QtWidgets.QLineEdit()
        self.boneSearch.setPlaceholderText("Search..")
        self.boneSearch.textChanged.connect(self.searchList)
        self.widgetLayout.addWidget(self.boneSearch)
        self.boneList = QtWidgets.QListWidget()
        self.widgetLayout.addWidget(self.boneList)
        self.boneList.setMinimumHeight(200)

        # add items to comboBox
        bones = utils.getViableParents()

        # get our own bones
        modBones = self.modInst.returnCreatedJoints

        for bone in bones:
            if bone not in modBones:
                self.boneList.addItem(bone)
            if bone == "root":
                index = bones.index(bone)
                self.boneList.setCurrentRow(index)

        # update button
        self.updateBtn = QtWidgets.QPushButton("UPDATE")
        self.widgetLayout.addWidget(self.updateBtn)
        self.updateBtn.setMinimumSize(QtCore.QSize(230, 40))
        self.updateBtn.setMaximumSize(QtCore.QSize(230, 40))
        self.updateBtn.setSizePolicy(mainSizePolicy)
        font = QtGui.QFont()
        font.setPointSize(12)
        self.updateBtn.setFont(font)
        self.updateBtn.setObjectName("blueButton")

        # hookup signal/slot on create button
        self.updateBtn.clicked.connect(self.applyModuleParentChange)

        self.updateBtn.setFocus()
Exemple #24
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)
Exemple #25
0
    def createUI(self):
        """
        Builds the UI, listing options for choosing a project and showing all assets belonging to that project for
        edit or add.

        """

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

        fontSmall = QtGui.QFont()
        fontSmall.setPointSize(9)
        fontSmall.setBold(True)

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

        self.setStyleSheet(self.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)
        if self.edit:
            self.setWindowTitle(windowTitle)
        if self.add:
            self.setWindowTitle("Add Rig For Animation")

        self.setAttribute(QtCore.Qt.WA_DeleteOnClose)

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

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

        # create the QFrame
        self.frame = QtWidgets.QFrame()
        self.layout.addWidget(self.frame)
        self.widgetLayout = QtWidgets.QHBoxLayout(self.frame)
        self.frame.setObjectName("mid")

        # =======================================================================
        # #create two VBox Layouts to create 2 columns
        # =======================================================================
        self.leftColumn = QtWidgets.QVBoxLayout()
        self.widgetLayout.addLayout(self.leftColumn)

        self.rightColumn = QtWidgets.QVBoxLayout()
        self.widgetLayout.addLayout(self.rightColumn)

        # =======================================================================
        # #left column : project comboBox, group comboBox, listWidget of characters
        # =======================================================================

        self.projectMenu = QtWidgets.QComboBox()
        self.leftColumn.addWidget(self.projectMenu)
        self.projectMenu.setMinimumSize(150, 30)
        self.projectMenu.setMaximumSize(150, 30)
        self.projectMenu.currentIndexChanged.connect(self.populateGroups)

        self.groupMenu = QtWidgets.QComboBox()
        self.leftColumn.addWidget(self.groupMenu)
        self.groupMenu.setMinimumSize(150, 30)
        self.groupMenu.setMaximumSize(150, 30)
        self.groupMenu.currentIndexChanged.connect(self.populateCharacters)

        self.characterList = QtWidgets.QListWidget()
        self.leftColumn.addWidget(self.characterList)
        self.characterList.setMinimumSize(150, 200)
        self.characterList.setMaximumSize(150, 200)
        self.characterList.itemClicked.connect(partial(self.populateIcon))
        self.populateProjects()
        # =======================================================================
        # #right column: icon frame, edit button/add button, close button
        # =======================================================================

        self.characterIcon = QtWidgets.QLabel()
        self.characterIcon.setMinimumSize(200, 200)
        self.characterIcon.setMaximumSize(200, 200)
        self.rightColumn.addWidget(self.characterIcon)

        # default image
        self.defaultPixMap = QtGui.QPixmap(utils.returnNicePath(self.iconsPath, "System/noCharacter.png"))
        self.characterIcon.setPixmap(self.defaultPixMap)

        # if edit:
        if self.edit:
            self.editButton = QtWidgets.QPushButton("Edit Selected")
            self.editButton.setFont(font)
            self.rightColumn.addWidget(self.editButton)
            self.editButton.setMinimumSize(200, 40)
            self.editButton.setMaximumSize(200, 40)
            self.editButton.clicked.connect(partial(self.editSelected))
            self.editButton.setObjectName("blueButton")

        # if add:
        if self.add:
            self.addButton = QtWidgets.QPushButton("Add Selected")
            self.addButton.setFont(font)
            self.rightColumn.addWidget(self.addButton)
            self.addButton.setMinimumSize(200, 40)
            self.addButton.setMaximumSize(200, 40)
            self.addButton.clicked.connect(partial(self.addSelected))
            self.addButton.setObjectName("blueButton")

        self.closeButton = QtWidgets.QPushButton("Close")
        self.closeButton.setFont(font)
        self.rightColumn.addWidget(self.closeButton)
        self.closeButton.setMinimumSize(200, 40)
        self.closeButton.setMaximumSize(200, 40)
        self.closeButton.clicked.connect(partial(self.closeUI))
        self.closeButton.setObjectName("blueButton")
Exemple #26
0
    def buildExportWeightsUI(self):
        """
        Build the interface for exporting the skin weights. An entry is added for each piece of selected geometry.
        The user then has the ability to specify a .weight file name for the associated geometry.
        The user also specifies where they would like the weight files saved to.

        .. image:: /images/exportWeights.png

        """

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

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

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

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

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

        # set qt object name
        self.exportSkinWeights_Win.setObjectName("ART_exportSkinWeightsUI")
        self.exportSkinWeights_Win.setWindowTitle("Export Skin Weights")

        # create the mainLayout for the ui
        self.exportSkinWeights_mainLayout = QtWidgets.QVBoxLayout(
            self.exportSkinWeights_mainWidget)
        self.exportSkinWeights_mainLayout.setContentsMargins(5, 5, 5, 5)

        self.exportSkinWeights_Win.resize(450, 600)
        self.exportSkinWeights_Win.setSizePolicy(mainSizePolicy)
        self.exportSkinWeights_Win.setMinimumSize(QtCore.QSize(450, 600))
        self.exportSkinWeights_Win.setMaximumSize(QtCore.QSize(450, 600))

        # create the background image
        self.exportSkinWeights_frame = QtWidgets.QFrame()
        self.exportSkinWeights_mainLayout.addWidget(
            self.exportSkinWeights_frame)
        self.exportSkinWeights_frame.setObjectName("dark")

        # create widgetLayout
        self.exportSkinWeights_widgetLayout = QtWidgets.QVBoxLayout(
            self.exportSkinWeights_frame)

        # create the hboxLayout for lineEdit and browser button
        self.exportSkinWeights_browseLayout = QtWidgets.QHBoxLayout()
        self.exportSkinWeights_widgetLayout.addLayout(
            self.exportSkinWeights_browseLayout)

        # create the line edit for the export path
        self.exportSkinWeights_lineEdit = QtWidgets.QLineEdit(
            utils.returnFriendlyPath(self.toolsPath))
        self.exportSkinWeights_browseLayout.addWidget(
            self.exportSkinWeights_lineEdit)

        self.exportSkinWeights_browseBtn = QtWidgets.QPushButton()
        self.exportSkinWeights_browseLayout.addWidget(
            self.exportSkinWeights_browseBtn)
        self.exportSkinWeights_browseBtn.setMinimumSize(35, 35)
        self.exportSkinWeights_browseBtn.setMaximumSize(35, 35)
        icon = QtGui.QIcon(
            os.path.join(self.iconsPath, "System/fileBrowse.png"))
        self.exportSkinWeights_browseBtn.setIconSize(QtCore.QSize(30, 30))
        self.exportSkinWeights_browseBtn.setIcon(icon)
        self.exportSkinWeights_browseBtn.clicked.connect(
            partial(self.exportSkinWeights_fileBrowse))

        # scroll area contents
        self.exportSkinWeights_scrollContents = QtWidgets.QFrame()
        self.exportSkinWeights_scrollContents.setObjectName("light")

        # Layout of Container Widget
        self.exportSkinWeights_VLayout = QtWidgets.QVBoxLayout()

        # find selected geometry and populate scroll area
        self.exportSkinWeights_populate()

        # add scrollArea for selected geo, skinFileName, and checkbox for exporting
        self.exportSkinWeights_scrollLayout = QtWidgets.QScrollArea()
        self.exportSkinWeights_widgetLayout.addWidget(
            self.exportSkinWeights_scrollLayout)
        self.exportSkinWeights_scrollLayout.setHorizontalScrollBarPolicy(
            QtCore.Qt.ScrollBarAlwaysOff)
        self.exportSkinWeights_scrollLayout.setVerticalScrollBarPolicy(
            QtCore.Qt.ScrollBarAlwaysOn)
        self.exportSkinWeights_scrollLayout.setWidgetResizable(False)
        self.exportSkinWeights_scrollLayout.setWidget(
            self.exportSkinWeights_scrollContents)

        # lastly, export button
        font = QtGui.QFont()
        font.setPointSize(8)
        font.setBold(True)

        self.exportSkinWeights_exportBtnLayout = QtWidgets.QHBoxLayout()
        self.exportSkinWeights_widgetLayout.addLayout(
            self.exportSkinWeights_exportBtnLayout)

        self.exportSkinWeights_RefreshBtn = QtWidgets.QPushButton("Refresh")
        self.exportSkinWeights_exportBtnLayout.addWidget(
            self.exportSkinWeights_RefreshBtn)
        self.exportSkinWeights_RefreshBtn.setMinimumSize(QtCore.QSize(70, 50))
        self.exportSkinWeights_RefreshBtn.setMaximumSize(QtCore.QSize(70, 50))
        self.exportSkinWeights_RefreshBtn.setFont(font)
        self.exportSkinWeights_RefreshBtn.clicked.connect(
            partial(self.buildExportWeightsUI))
        self.exportSkinWeights_RefreshBtn.setObjectName("blueButton")

        self.exportSkinWeights_ExportBtn = QtWidgets.QPushButton(
            "EXPORT WEIGHTS")
        self.exportSkinWeights_exportBtnLayout.addWidget(
            self.exportSkinWeights_ExportBtn)
        self.exportSkinWeights_ExportBtn.setMinimumSize(QtCore.QSize(350, 50))
        self.exportSkinWeights_ExportBtn.setMaximumSize(QtCore.QSize(350, 50))
        self.exportSkinWeights_ExportBtn.setFont(font)
        self.exportSkinWeights_ExportBtn.clicked.connect(
            partial(self.exportSkinWeights_doExport))
        self.exportSkinWeights_ExportBtn.setObjectName("blueButton")

        # show window
        self.exportSkinWeights_Win.show()
Exemple #27
0
    def buildImportWeightsUI(self):
        """
        Build the interface for importing skin weights. The interface will create an entry for every piece of selected
        geometry.

        The interface will look like this:

        .. image:: /images/importWeights.png

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

        # launch a UI to get the name information
        self.importSkinWeights_Win = 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.importSkinWeights_Win.setStyleSheet(self.style)

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

        # set qt object name
        self.importSkinWeights_Win.setObjectName("ART_importSkinWeightsUI")
        self.importSkinWeights_Win.setWindowTitle("Import Skin Weights")

        # create the mainLayout for the ui
        self.importSkinWeights_mainLayout = QtWidgets.QVBoxLayout(self.importSkinWeights_mainWidget)
        self.importSkinWeights_mainLayout.setContentsMargins(5, 5, 5, 5)

        self.importSkinWeights_Win.resize(450, 400)
        # self.importSkinWeights_Win.setSizePolicy(mainSizePolicy)
        self.importSkinWeights_Win.setMinimumSize(QtCore.QSize(450, 400))
        self.importSkinWeights_Win.setMaximumSize(QtCore.QSize(450, 400))

        # create the background image
        self.importSkinWeights_frame = QtWidgets.QFrame()
        self.importSkinWeights_mainLayout.addWidget(self.importSkinWeights_frame)
        self.importSkinWeights_frame.setObjectName("dark")

        # create widgetLayout
        self.importSkinWeights_widgetLayout = QtWidgets.QVBoxLayout(self.importSkinWeights_frame)

        # import skin weights method
        # self.importSkinWeights_methodForm = QtWidgets.QHBoxLayout()
        # self.importSkinWeights_widgetLayout.addLayout(self.importSkinWeights_methodForm)
        #
        # label = QtWidgets.QLabel("Import Method:  ")
        # label.setStyleSheet("background: transparent;")
        # self.importSkinWeights_methodForm.addWidget(label)

        # self.importSkinWeights_importMethod = QtWidgets.QComboBox()
        # self.importSkinWeights_methodForm.addWidget(self.importSkinWeights_importMethod)
        # self.importSkinWeights_importMethod.addItem("Vertex Order")
        # self.importSkinWeights_importMethod.addItem("World Position")
        # self.importSkinWeights_importMethod.addItem("Local Position")
        # self.importSkinWeights_importMethod.addItem("UV Position")

        # scroll area contents
        self.importSkinWeights_scrollContents = QtWidgets.QFrame()
        self.importSkinWeights_scrollContents.setObjectName("light")

        # Layout of Container Widget
        self.importSkinWeights_VLayout = QtWidgets.QVBoxLayout()
        self.importSkinWeights_VLayout.setSpacing(5)

        # find selected geometry and populate scroll area
        self.importSkinWeights_populate()

        # add scrollArea for selected geo, skinFileName, and checkbox for importing
        self.importSkinWeights_scrollLayout = QtWidgets.QScrollArea()
        self.importSkinWeights_widgetLayout.addWidget(self.importSkinWeights_scrollLayout)
        self.importSkinWeights_scrollLayout.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
        self.importSkinWeights_scrollLayout.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOn)
        self.importSkinWeights_scrollLayout.setWidgetResizable(False)
        self.importSkinWeights_scrollLayout.setWidget(self.importSkinWeights_scrollContents)

        # refresh and import button
        font = QtGui.QFont()
        font.setPointSize(8)
        font.setBold(True)

        self.importSkinWeights_BtnLayout = QtWidgets.QHBoxLayout()
        self.importSkinWeights_widgetLayout.addLayout(self.importSkinWeights_BtnLayout)

        self.importSkinWeights_RefreshBtn = QtWidgets.QPushButton("Refresh")
        self.importSkinWeights_BtnLayout.addWidget(self.importSkinWeights_RefreshBtn)
        self.importSkinWeights_RefreshBtn.setMinimumSize(QtCore.QSize(70, 50))
        self.importSkinWeights_RefreshBtn.setMaximumSize(QtCore.QSize(70, 50))
        self.importSkinWeights_RefreshBtn.setFont(font)
        self.importSkinWeights_RefreshBtn.clicked.connect(partial(self.buildImportWeightsUI))
        self.importSkinWeights_RefreshBtn.setObjectName("blueButton")

        self.importSkinWeights_ImportBtn = QtWidgets.QPushButton("IMPORT WEIGHTS")
        self.importSkinWeights_BtnLayout.addWidget(self.importSkinWeights_ImportBtn)
        self.importSkinWeights_ImportBtn.setMinimumSize(QtCore.QSize(350, 50))
        self.importSkinWeights_ImportBtn.setMaximumSize(QtCore.QSize(350, 50))
        self.importSkinWeights_ImportBtn.setFont(font)
        self.importSkinWeights_ImportBtn.clicked.connect(partial(self.importSkinWeights_DoImport))
        self.importSkinWeights_ImportBtn.setObjectName("blueButton")

        # lastly, progress bar
        self.importSkinWeights_progBarTotal = QtWidgets.QProgressBar()
        self.importSkinWeights_widgetLayout.addWidget(self.importSkinWeights_progBarTotal)
        self.importSkinWeights_progBarTotal.setRange(0, self.importSkinWeights_VLayout.count() - 1)
        self.importSkinWeights_progBarTotal.setValue(0)

        self.importSkinWeights_progBarCurrent = QtWidgets.QProgressBar()
        self.importSkinWeights_widgetLayout.addWidget(self.importSkinWeights_progBarCurrent)
        self.importSkinWeights_progBarCurrent.setRange(0, 100)
        self.importSkinWeights_progBarCurrent.setValue(0)

        # show window
        self.importSkinWeights_Win.show()
Exemple #28
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()
Exemple #29
0
    def __init__(self,
                 baseName,
                 moduleInst,
                 rigUiInst,
                 prefix,
                 suffix,
                 parent=None):
        """
        Instantiates the class, taking in current module information, and builds the interface.

        :param baseName: The base name of the module, found on the network node attribute.
        :param moduleInst: The instance in memory of the module whose name is to change.
        :param rigUiInst: The instance in memory of the Rig Creator UI from which this class was called.
        :param prefix: The existing prefix of the module name.
        :param suffix: The existing suffix of the module name.

        """

        super(ART_ChangeModuleName_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.modInst = moduleInst
        self.rigUiInst = rigUiInst
        self.prefixInc = prefix
        self.suffixInc = suffix

        # 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.QVBoxLayout(self.mainWidget)
        self.mainLayout.setContentsMargins(0, 0, 0, 0)

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

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

        # create the layout for the widgets
        self.widgetLayout = QtWidgets.QVBoxLayout(self.frame)

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

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

        self.prefix = QtWidgets.QLineEdit(self.prefixInc)
        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.widgetLayout.addLayout(self.suffixForm)

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

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

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

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

        # realtime preview of final module name
        self.previewForm = QtWidgets.QFormLayout()
        self.widgetLayout.addLayout(self.previewForm)
        self.previewLabel = QtWidgets.QLabel("Preview: ")
        self.previewName = QtWidgets.QLabel(self.prefixInc + self.baseName +
                                            self.suffixInc)
        self.previewName.setMinimumSize(QtCore.QSize(200, 20))
        self.previewName.setMaximumSize(QtCore.QSize(200, 20))
        self.previewName.setAlignment(QtCore.Qt.AlignHCenter)
        self.previewForm.setWidget(0, QtWidgets.QFormLayout.LabelRole,
                                   self.previewLabel)
        self.previewForm.setWidget(0, QtWidgets.QFormLayout.FieldRole,
                                   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.widgetLayout.addItem(spacerItem1)

        # update button
        self.updateBtn = QtWidgets.QPushButton("UPDATE")
        self.widgetLayout.addWidget(self.updateBtn)
        self.updateBtn.setMinimumSize(QtCore.QSize(285, 40))
        self.updateBtn.setMaximumSize(QtCore.QSize(285, 40))
        self.updateBtn.setSizePolicy(mainSizePolicy)
        font = QtGui.QFont()
        font.setPointSize(12)
        self.updateBtn.setFont(font)
        self.updateBtn.setObjectName("blueButton")

        # hookup signal/slot on create button
        self.updateBtn.clicked.connect(self.applyModuleNameChange)
Exemple #30
0
    def buildSettingsUi(self):

        #fonts
        self.font = QtGui.QFont()
        self.font.setPointSize(10)
        self.font.setBold(False)

        self.fontSmall = QtGui.QFont()
        self.fontSmall.setPointSize(9)
        self.fontSmall.setBold(False)

        self.titleFont = QtGui.QFont()
        self.titleFont.setPointSize(40)
        self.titleFont.setBold(True)

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

        self.setStyleSheet(self.style)

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

        #create the main widget
        self.mainWidget = QtWidgets.QWidget()
        self.mainWidget.setStyleSheet(self.style)
        self.mainWidget.setStyleSheet(
            "background-color: rgb(0, 0, 0);, color: rgb(0,0,0);")
        self.setCentralWidget(self.mainWidget)

        #set qt object name
        self.setObjectName(windowObject)
        self.setWindowTitle(windowTitle)
        self.setAttribute(QtCore.Qt.WA_DeleteOnClose)

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

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

        #create the QFrame
        self.frame = QtWidgets.QFrame()
        self.frame.setObjectName("epic")
        self.layout.addWidget(self.frame)
        self.widgetLayout = QtWidgets.QVBoxLayout(self.frame)

        #Title of Issue
        self.titleLayout = QtWidgets.QHBoxLayout()
        self.widgetLayout.addLayout(self.titleLayout)

        titleLabel = QtWidgets.QLabel("Title: ")
        self.titleLayout.addWidget(titleLabel)

        self.issueTitle = QtWidgets.QLineEdit()
        self.issueTitle.setPlaceholderText("Title of Issue")
        self.titleLayout.addWidget(self.issueTitle)
        self.issueTitle.setMinimumWidth(200)
        self.issueTitle.setMaximumWidth(200)

        #Type of Issue (from labels)
        self.labelLayout = QtWidgets.QHBoxLayout()
        self.widgetLayout.addLayout(self.labelLayout)

        typeLabel = QtWidgets.QLabel("Issue Type: ")
        self.labelLayout.addWidget(typeLabel)

        self.issueType = QtWidgets.QComboBox()
        self.labelLayout.addWidget(self.issueType)
        self.issueType.setMinimumWidth(200)
        self.issueType.setMaximumWidth(200)

        #Information
        summaryLabel = QtWidgets.QLabel("Summary: ")
        self.widgetLayout.addWidget(summaryLabel)

        infoText = QtWidgets.QTextEdit()
        infoText.setReadOnly(True)
        infoText.setEnabled(False)
        self.widgetLayout.addWidget(infoText)
        infoText.setMinimumHeight(60)
        infoText.setMaximumHeight(60)
        infoText.setTextColor(QtGui.QColor(120, 120, 120))
        infoText.append(
            "(Please include any errors and stacktrace if applicable. Also include any reproduction steps if possible.)"
        )

        self.issueInfo = QtWidgets.QTextEdit()
        self.widgetLayout.addWidget(self.issueInfo)
        self.issueInfo.setObjectName("light")
        #Create Issue
        self.createIssueBtn = QtWidgets.QPushButton("Create Issue")
        self.createIssueBtn.setObjectName("blueButton")
        self.widgetLayout.addWidget(self.createIssueBtn)
        self.createIssueBtn.clicked.connect(self.createIssue)

        self.credentials = git.getGitCreds()
        if self.credentials == None:
            git.gitCredsUI(self)
            self.credentials = git.getGitCreds()

        self.getLabels()