Пример #1
0
    def setBoneCountTarget(self):
        """
        Builds a UI that allows the user to set the target bone count.

            .. image:: /images/boneCountTarget.png

        """

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

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

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

        # set qt object name
        self.targetWindow.setObjectName("ART_setBoneCountTarget_UI")
        self.targetWindow.setWindowTitle("Bone Count")

        # create the mainLayout for the rig creator UI
        self.targetWindow_topLayout = QtWidgets.QVBoxLayout(self.targetWindow_mainWidget)
        self.targetWindow_mainLayout = QtWidgets.QFormLayout()
        self.targetWindow_topLayout.addLayout(self.targetWindow_mainLayout)

        self.targetWindow_topLayout.setContentsMargins(10, 10, 10, 10)
        self.targetWindow.resize(250, 70)
        self.targetWindow.setSizePolicy(mainSizePolicy)
        self.targetWindow.setMinimumSize(QtCore.QSize(250, 70))
        self.targetWindow.setMaximumSize(QtCore.QSize(250, 70))

        # add label
        label = QtWidgets.QLabel("Enter a target bone count:        ")
        self.targetWindow_mainLayout.setWidget(0, QtWidgets.QFormLayout.LabelRole, label)

        # add spinBox
        self.targetWindow_SpinBox = QtWidgets.QSpinBox()
        self.targetWindow_SpinBox.setButtonSymbols(QtWidgets.QAbstractSpinBox.NoButtons)
        self.targetWindow_SpinBox.setRange(1, 9999)
        self.targetWindow_SpinBox.setMinimumWidth(70)
        self.targetWindow_SpinBox.setStyleSheet("background-color: rgb(255,255,255); color: rgb(0,0,0);")
        self.targetWindow_mainLayout.setWidget(0, QtWidgets.QFormLayout.FieldRole, self.targetWindow_SpinBox)
        self.targetWindow_SpinBox.setValue(100)
        self.targetWindow_SpinBox.setObjectName("ART_targetWindowSpinBox")

        # add a confirm button
        self.targetWindow_confirmButton = QtWidgets.QPushButton("Confirm")
        self.targetWindow_topLayout.addWidget(self.targetWindow_confirmButton)

        buttonImage = utils.returnNicePath(self.iconsPath, "System/blue_field_background.png")
        self.targetWindow_confirmButton.setStyleSheet(
            "background-image: url(" + buttonImage + "); background-color: rgb(0,0,0);")
        self.targetWindow_confirmButton.clicked.connect(self.setBoneCountTarget_Confirm)

        # show the window
        self.targetWindow.show()
Пример #2
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)
Пример #3
0
    def __init__(self, baseName, className, rigUiInst, parent=None):
        """
        Initialize the class, taking in the base name of the module to be added, the name of the class of the module
        to be added, and the instance of the rig creator UI. Then build the interface for the tool.

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

        """

        super(ART_AddModule_UI, self).__init__(parent)

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

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

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

        self.setStyleSheet(style)

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        self.hierarchyTree.setFocus()