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()
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()
def buildUI(self): if cmds.window("pyART_AddToCanvasWIN", exists=True): cmds.deleteUI("pyART_AddToCanvasWIN", wnd=True) #create the main window self.mainWin = QtWidgets.QMainWindow(self.pickerUI) #create the main widget self.mainWidget = QtWidgets.QWidget() self.mainWin.setCentralWidget(self.mainWidget) #create the mainLayout self.layout = QtWidgets.QVBoxLayout(self.mainWidget) #load stylesheet styleSheetFile = utils.returnNicePath( self.toolsPath, "Core/Scripts/Interfaces/StyleSheets/animPicker.qss") f = open(styleSheetFile, "r") self.style = f.read() f.close() self.mainWin.setStyleSheet(self.style) self.mainWin.setMinimumSize(QtCore.QSize(250, 400)) self.mainWin.setMaximumSize(QtCore.QSize(250, 400)) self.mainWin.resize(250, 400) #set qt object name self.mainWin.setObjectName("pyART_AddToCanvasWIN") self.mainWin.setWindowTitle("Remove Module From Canvas") #label, listWidget, button label = QtWidgets.QLabel("Available Modules:") label.setProperty("boldFont", True) self.layout.addWidget(label) self.moduleList = QtWidgets.QListWidget() self.moduleList.setMaximumSize(230, 300) self.moduleList.setMinimumSize(230, 300) self.layout.addWidget(self.moduleList) #add modules to listWidget self.addModulesToList() #create remove button button = QtWidgets.QPushButton("Remove From Canvas") self.layout.addWidget(button) button.setObjectName("blueButton") button.clicked.connect(self.removeFromCanvas) #show ui self.mainWin.show()
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()
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()
def buildInterface(self): """ Builds the interface for the tool, finding all joints that compose the asset, comparing them to joints in the skinCluster, then separating the initial list into joints in the cluster, and joints not in the cluster. """ if cmds.window("ART_addRemoveInfsWin", exists=True): cmds.deleteUI("ART_addRemoveInfsWin", wnd=True) # launch a UI to get the name information self.addRemoveInfsWin = QtWidgets.QMainWindow(self.mainUI) # size policies mainSizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) # create the main widget self.addRemoveInfsWin_mainWidget = QtWidgets.QWidget() self.addRemoveInfsWin.setCentralWidget( self.addRemoveInfsWin_mainWidget) # load stylesheet styleSheetFile = utils.returnNicePath( self.toolsPath, "Core/Scripts/Interfaces/StyleSheets/mainScheme.qss") f = open(styleSheetFile, "r") self.style = f.read() f.close() # set qt object name self.addRemoveInfsWin.setObjectName("ART_addRemoveInfsWin") self.addRemoveInfsWin.setWindowTitle("Add/Remove Influences") # create the mainLayout for the ui self.addRemoveInfsWin_mainLayout = QtWidgets.QVBoxLayout( self.addRemoveInfsWin_mainWidget) self.addRemoveInfsWin_mainLayout.setContentsMargins(5, 5, 5, 5) self.addRemoveInfsWin.resize(300, 450) self.addRemoveInfsWin.setSizePolicy(mainSizePolicy) self.addRemoveInfsWin.setMinimumSize(QtCore.QSize(300, 450)) self.addRemoveInfsWin.setMaximumSize(QtCore.QSize(300, 450)) # create the background image self.addRemoveInfsWin_frame = QtWidgets.QFrame() self.addRemoveInfsWin_mainLayout.addWidget(self.addRemoveInfsWin_frame) self.addRemoveInfsWin_frame.setObjectName("dark") # create the main layout for the widgets self.addRemoveInfsWin_widgetLayout = QtWidgets.QHBoxLayout( self.addRemoveInfsWin_frame) # two layouts needed for the widget layout. left side = vertical layout for filters, # search, and list. right layout = vertical layout for buttons self.addRemoveInfsWin_leftSideLayout = QtWidgets.QVBoxLayout() self.addRemoveInfsWin_widgetLayout.addLayout( self.addRemoveInfsWin_leftSideLayout) self.addRemoveInfsWin_rightSideLayout = QtWidgets.QVBoxLayout() self.addRemoveInfsWin_widgetLayout.addLayout( self.addRemoveInfsWin_rightSideLayout) # left side: filters, search, list self.addRemoveInfsWin_filters = QtWidgets.QComboBox() self.addRemoveInfsWin_leftSideLayout.addWidget( self.addRemoveInfsWin_filters) self.addRemoveInfsWin_filters.addItem("Show Influences In Skin") self.addRemoveInfsWin_filters.addItem("Show Influences Not In Skin") self.addRemoveInfsWin_filters.currentIndexChanged.connect( partial(self.addOrRemoveInfs_ShowInfsFilter)) self.addRemoveInfsWin_search = QtWidgets.QLineEdit() self.addRemoveInfsWin_leftSideLayout.addWidget( self.addRemoveInfsWin_search) self.addRemoveInfsWin_search.setPlaceholderText("Search...") self.addRemoveInfsWin_search.textChanged.connect( partial(self.addOrRemoveInfs_Search)) self.addRemoveInfsWin_infList = QtWidgets.QListWidget() self.addRemoveInfsWin_leftSideLayout.addWidget( self.addRemoveInfsWin_infList) self.addRemoveInfsWin_infList.setSelectionMode( QtWidgets.QAbstractItemView.ExtendedSelection) # right side: add button, remove button, prune weights, remove unused button font = QtGui.QFont() font.setPointSize(8) font.setBold(True) self.addRemoveInfsWin_refreshSelBtn = QtWidgets.QPushButton("Refresh") self.addRemoveInfsWin_rightSideLayout.addWidget( self.addRemoveInfsWin_refreshSelBtn) self.addRemoveInfsWin_refreshSelBtn.setMinimumSize(110, 35) self.addRemoveInfsWin_refreshSelBtn.setMaximumSize(110, 35) self.addRemoveInfsWin_refreshSelBtn.setFont(font) self.addRemoveInfsWin_refreshSelBtn.clicked.connect( partial(self.addOrRemoveInfs_RefreshSelection)) self.addRemoveInfsWin_refreshSelBtn.setObjectName("blueButton") self.addRemoveInfsWin_rightSideLayout.addSpacerItem( QtWidgets.QSpacerItem(100, 300, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed)) self.addRemoveInfsWin_addInfBtn = QtWidgets.QPushButton("Add") self.addRemoveInfsWin_rightSideLayout.addWidget( self.addRemoveInfsWin_addInfBtn) self.addRemoveInfsWin_addInfBtn.setMinimumSize(110, 35) self.addRemoveInfsWin_addInfBtn.setMaximumSize(110, 35) self.addRemoveInfsWin_addInfBtn.setFont(font) self.addRemoveInfsWin_addInfBtn.clicked.connect( partial(self.addOrRemoveInfs_addInf, True, False)) self.addRemoveInfsWin_addInfBtn.setObjectName("blueButton") self.addRemoveInfsWin_removeInfBtn = QtWidgets.QPushButton("Remove") self.addRemoveInfsWin_rightSideLayout.addWidget( self.addRemoveInfsWin_removeInfBtn) self.addRemoveInfsWin_removeInfBtn.setMinimumSize(110, 35) self.addRemoveInfsWin_removeInfBtn.setMaximumSize(110, 35) self.addRemoveInfsWin_removeInfBtn.setFont(font) self.addRemoveInfsWin_removeInfBtn.clicked.connect( partial(self.addOrRemoveInfs_addInf, False, False)) self.addRemoveInfsWin_removeInfBtn.setObjectName("blueButton") self.addRemoveInfsWin_removeUnusedInfBtn = QtWidgets.QPushButton( "Remove Unused") self.addRemoveInfsWin_rightSideLayout.addWidget( self.addRemoveInfsWin_removeUnusedInfBtn) self.addRemoveInfsWin_removeUnusedInfBtn.setMinimumSize(110, 35) self.addRemoveInfsWin_removeUnusedInfBtn.setMaximumSize(110, 35) self.addRemoveInfsWin_removeUnusedInfBtn.setFont(font) self.addRemoveInfsWin_removeUnusedInfBtn.clicked.connect( partial(self.addOrRemoveInfs_addInf, False, True)) self.addRemoveInfsWin_removeUnusedInfBtn.setObjectName("blueButton") self.addRemoveInfsWin_pruneBtn = QtWidgets.QPushButton("Prune Weights") self.addRemoveInfsWin_rightSideLayout.addWidget( self.addRemoveInfsWin_pruneBtn) self.addRemoveInfsWin_pruneBtn.setMinimumSize(110, 35) self.addRemoveInfsWin_pruneBtn.setMaximumSize(110, 35) self.addRemoveInfsWin_pruneBtn.setFont(font) self.addRemoveInfsWin_pruneBtn.clicked.connect( partial(self.addOrRemoveInfs_prune)) self.addRemoveInfsWin_pruneBtn.setObjectName("blueButton") # populate infList self.addOrRemoveInfs_RefreshSelection() # show window self.addRemoveInfsWin.show()
def resetMode_resetXformsUI(self): #if nothing in the list is selected, return if self.resetModeWin_moduleList.selectedItems() == []: return #if window exists, delete first if cmds.window("ART_ResetXformsModeWin", exists=True): cmds.deleteUI("ART_ResetXformsModeWin", wnd=True) #launch a UI to get the name information self.resetXformsWin = QtWidgets.QMainWindow(self.mainUI) self.resetXformsWin.setStyleSheet(self.style) #size policies mainSizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) #create the main widget self.resetXformsWin_mainWidget = QtWidgets.QWidget() self.resetXformsWin.setCentralWidget(self.resetXformsWin_mainWidget) #set qt object name self.resetXformsWin.setObjectName("ART_ResetXformsModeWin") self.resetXformsWin.setWindowTitle("Reset Transformations") #create the mainLayout for the rig creator UI self.resetXformsWin_mainLayout = QtWidgets.QVBoxLayout( self.resetXformsWin_mainWidget) self.resetXformsWin_mainLayout.setContentsMargins(0, 0, 0, 0) self.resetXformsWin.resize(300, 100) self.resetXformsWin.setSizePolicy(mainSizePolicy) self.resetXformsWin.setMinimumSize(QtCore.QSize(300, 100)) self.resetXformsWin.setMaximumSize(QtCore.QSize(300, 100)) #create the background self.resetXformsWin_frame = QtWidgets.QFrame() self.resetXformsWin_mainLayout.addWidget(self.resetXformsWin_frame) #create the layout for the widgets self.resetXformsWin_widgetLayout = QtWidgets.QVBoxLayout( self.resetXformsWin_frame) self.resetXformsWin_widgetLayout.setContentsMargins(5, 5, 5, 5) self.resetXformsWin_widgetLayoutRow = QtWidgets.QHBoxLayout( self.resetXformsWin_frame) self.resetXformsWin_widgetLayout.addLayout( self.resetXformsWin_widgetLayoutRow) #add the 3 buttons for translate, rotate, scale self.resetXformsWin_transCB = QtWidgets.QPushButton("Translate") self.resetXformsWin_widgetLayoutRow.addWidget( self.resetXformsWin_transCB) self.resetXformsWin_transCB.setCheckable(True) self.resetXformsWin_transCB.setChecked(True) self.resetXformsWin_rotCB = QtWidgets.QPushButton("Rotate") self.resetXformsWin_widgetLayoutRow.addWidget( self.resetXformsWin_rotCB) self.resetXformsWin_rotCB.setCheckable(True) self.resetXformsWin_rotCB.setChecked(True) self.resetXformsWin_scaleCB = QtWidgets.QPushButton("Scale") self.resetXformsWin_widgetLayoutRow.addWidget( self.resetXformsWin_scaleCB) self.resetXformsWin_scaleCB.setCheckable(True) self.resetXformsWin_scaleCB.setChecked(True) #Create the Reset Transforms button self.resetXformsWin_resetXformButton = QtWidgets.QPushButton( "Reset Transformations") self.resetXformsWin_widgetLayout.addWidget( self.resetXformsWin_resetXformButton) self.resetXformsWin_resetXformButton.setMinimumSize( QtCore.QSize(290, 40)) self.resetXformsWin_resetXformButton.setMaximumSize( QtCore.QSize(290, 40)) self.resetXformsWin_resetXformButton.clicked.connect( self.resetMode_resetXforms) self.resetXformsWin_resetXformButton.setProperty("boldFont", True) #show window self.resetXformsWin.show()
def buildResetModeUI(self, mainUI): if cmds.window("ART_ResetModeWin", exists=True): cmds.deleteUI("ART_ResetModeWin", wnd=True) #launch a UI to get the name information self.resetModeWin = QtWidgets.QMainWindow(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.resetModeWin.setStyleSheet(self.style) #size policies mainSizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) #create the main widget self.resetModeWin_mainWidget = QtWidgets.QWidget() self.resetModeWin.setCentralWidget(self.resetModeWin_mainWidget) #set qt object name self.resetModeWin.setObjectName("ART_ResetModeWin") self.resetModeWin.setWindowTitle("Reset Modules") #create the mainLayout for the rig creator UI self.resetModeWin_mainLayout = QtWidgets.QVBoxLayout( self.resetModeWin_mainWidget) self.resetModeWin_mainLayout.setContentsMargins(0, 0, 0, 0) self.resetModeWin.resize(400, 250) self.resetModeWin.setSizePolicy(mainSizePolicy) self.resetModeWin.setMinimumSize(QtCore.QSize(400, 250)) self.resetModeWin.setMaximumSize(QtCore.QSize(400, 250)) #create the background image self.resetModeWin_frame = QtWidgets.QFrame() self.resetModeWin_mainLayout.addWidget(self.resetModeWin_frame) #create the layout for the widgets self.resetModeWin_widgetLayout = QtWidgets.QHBoxLayout( self.resetModeWin_frame) self.resetModeWin_widgetLayout.setContentsMargins(5, 5, 5, 5) #add the QListWidget Frame self.resetModeWin_moduleListFrame = QtWidgets.QFrame() self.resetModeWin_moduleListFrame.setMinimumSize(QtCore.QSize( 275, 200)) self.resetModeWin_moduleListFrame.setMaximumSize(QtCore.QSize( 275, 200)) self.resetModeWin_moduleListFrame.setContentsMargins(20, 0, 20, 0) #create the list widget self.resetModeWin_moduleList = QtWidgets.QListWidget( self.resetModeWin_moduleListFrame) self.resetModeWin_widgetLayout.addWidget( self.resetModeWin_moduleListFrame) self.resetModeWin_moduleList.setMinimumSize(QtCore.QSize(265, 200)) self.resetModeWin_moduleList.setMaximumSize(QtCore.QSize(265, 200)) self.resetModeWin_moduleList.setSelectionMode( QtWidgets.QAbstractItemView.MultiSelection) self.resetModeWin_moduleList.setSpacing(3) #add the layout for the buttons self.resetModeWin_buttonLayoutAll = QtWidgets.QVBoxLayout() self.resetModeWin_widgetLayout.addLayout( self.resetModeWin_buttonLayoutAll) self.resetModeWin_buttonLayoutAll.setContentsMargins(5, 20, 5, 20) #button background image image = utils.returnNicePath(self.iconsPath, "System/blue_field_background.png") #add the selection buttons self.resetModeWin_selectionButtonLayout = QtWidgets.QVBoxLayout() self.resetModeWin_buttonLayoutAll.addLayout( self.resetModeWin_selectionButtonLayout) self.resetModeWin_selectAllButton = QtWidgets.QPushButton("Select All") self.resetModeWin_selectAllButton.setMinimumSize(QtCore.QSize(115, 25)) self.resetModeWin_selectAllButton.setMaximumSize(QtCore.QSize(115, 25)) self.resetModeWin_selectionButtonLayout.addWidget( self.resetModeWin_selectAllButton) self.resetModeWin_selectAllButton.clicked.connect( self.resetModeWin_moduleList.selectAll) self.resetModeWin_selectAllButton.setObjectName("blueButton") self.resetModeWin_selectNoneButton = QtWidgets.QPushButton( "Clear Selection") self.resetModeWin_selectNoneButton.setMinimumSize(QtCore.QSize( 115, 25)) self.resetModeWin_selectNoneButton.setMaximumSize(QtCore.QSize( 115, 25)) self.resetModeWin_selectionButtonLayout.addWidget( self.resetModeWin_selectNoneButton) self.resetModeWin_selectNoneButton.clicked.connect( self.resetModeWin_moduleList.clearSelection) self.resetModeWin_selectNoneButton.setObjectName("blueButton") #spacer spacerItem = QtWidgets.QSpacerItem(20, 80, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding) self.resetModeWin_selectionButtonLayout.addItem(spacerItem) #add the buttons for reset settings and reset transforms self.resetModeWin_resetSettings = QtWidgets.QPushButton( "Reset Settings") self.resetModeWin_resetSettings.setMinimumSize(QtCore.QSize(115, 25)) self.resetModeWin_resetSettings.setMaximumSize(QtCore.QSize(115, 25)) self.resetModeWin_selectionButtonLayout.addWidget( self.resetModeWin_resetSettings) self.resetModeWin_resetSettings.clicked.connect( partial(self.resetMode_resetSettings)) self.resetModeWin_resetSettings.setObjectName("blueButton") self.resetModeWin_resetXforms = QtWidgets.QPushButton("Reset Xforms") self.resetModeWin_resetXforms.setMinimumSize(QtCore.QSize(115, 25)) self.resetModeWin_resetXforms.setMaximumSize(QtCore.QSize(115, 25)) self.resetModeWin_selectionButtonLayout.addWidget( self.resetModeWin_resetXforms) self.resetModeWin_resetXforms.clicked.connect( partial(self.resetMode_resetXformsUI)) self.resetModeWin_resetXforms.setObjectName("blueButton") #populate the list widget modules = utils.returnRigModules() for module in modules: moduleName = cmds.getAttr(module + ".moduleName") self.resetModeWin_moduleList.addItem(moduleName) #show the window self.resetModeWin.show()
def buildUI(self): if cmds.window("pyART_ResetModulesWIN", exists=True): cmds.deleteUI("pyART_ResetModulesWIN", wnd=True) #create the main window self.mainWin = QtWidgets.QMainWindow(self.pickerUI) #create the main widget self.mainWidget = QtWidgets.QFrame() self.mainWidget.setObjectName("dark") self.mainWin.setCentralWidget(self.mainWidget) #create the mainLayout self.mainLayout = QtWidgets.QVBoxLayout(self.mainWidget) #load stylesheet styleSheetFile = utils.returnNicePath( self.toolsPath, "Core/Scripts/Interfaces/StyleSheets/animPicker.qss") f = open(styleSheetFile, "r") self.style = f.read() f.close() self.mainWin.setStyleSheet(self.style) self.mainWin.setMinimumSize(QtCore.QSize(400, 250)) self.mainWin.setMaximumSize(QtCore.QSize(400, 250)) self.mainWin.resize(400, 250) #set qt object name self.mainWin.setObjectName("pyART_ResetModulesWIN") self.mainWin.setWindowTitle("Reset Rig Controls") self.layout = QtWidgets.QHBoxLayout() self.mainLayout.addLayout(self.layout) #LEFT SIDE #list of modules self.moduleList = QtWidgets.QListWidget() self.moduleList.setMinimumSize(QtCore.QSize(180, 230)) self.moduleList.setMaximumSize(QtCore.QSize(180, 230)) self.layout.addWidget(self.moduleList) self.moduleList.setSelectionMode( QtWidgets.QAbstractItemView.MultiSelection) #RIGHT SIDE self.rightLayout = QtWidgets.QVBoxLayout() self.layout.addLayout(self.rightLayout) #character combo self.characterCombo = QtWidgets.QComboBox() self.rightLayout.addWidget(self.characterCombo) self.characterCombo.setMinimumSize(QtCore.QSize(180, 60)) self.characterCombo.setMaximumSize(QtCore.QSize(180, 60)) self.characterCombo.setIconSize(QtCore.QSize(50, 50)) self.characterCombo.currentIndexChanged.connect( partial(self.findCharacterModules)) #buttons self.selAllBtn = QtWidgets.QPushButton("Select All") self.selAllBtn.setMinimumWidth(180) self.selAllBtn.setMaximumWidth(180) self.rightLayout.addWidget(self.selAllBtn) self.selAllBtn.setObjectName("blueButton") self.selAllBtn.clicked.connect(partial(self.selectAllModules)) self.clearSelBtn = QtWidgets.QPushButton("Clear Selection") self.clearSelBtn.setMinimumWidth(180) self.clearSelBtn.setMaximumWidth(180) self.rightLayout.addWidget(self.clearSelBtn) self.clearSelBtn.setObjectName("blueButton") self.clearSelBtn.clicked.connect(partial(self.clearModuleSelection)) self.rightLayout.addSpacerItem( QtWidgets.QSpacerItem(0, 0, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Expanding)) #reset transforms button self.resetXformsBtn = QtWidgets.QPushButton("Reset Transformations") self.resetXformsBtn.setMinimumWidth(180) self.resetXformsBtn.setMaximumWidth(180) self.rightLayout.addWidget(self.resetXformsBtn) self.resetXformsBtn.setObjectName("blueButton") self.resetXformsBtn.clicked.connect(partial(self.reset)) #show window self.mainWin.show() #populate UI self.findCharacters() self.findCharacterModules()
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()
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()
def buildBakeOffsetsUI(self): """ Builds the interface, finding all modules and listing them for selection. """ if cmds.window("ART_BakeOffsetsWin", exists=True): cmds.deleteUI("ART_BakeOffsetsWin", wnd=True) # launch a UI to get the name information self.bakeOffsetsWin = 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.bakeOffsetsWin.setStyleSheet(self.style) # size policies mainSizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) # create the main widget self.bakeOffsetsWin_mainWidget = QtWidgets.QWidget() self.bakeOffsetsWin.setCentralWidget(self.bakeOffsetsWin_mainWidget) # set qt object name self.bakeOffsetsWin.setObjectName("ART_BakeOffsetsWin") self.bakeOffsetsWin.setWindowTitle("Bake Offsets") # create the mainLayout for the rig creator UI self.bakeOffsetsWin_mainLayout = QtWidgets.QVBoxLayout( self.bakeOffsetsWin_mainWidget) self.bakeOffsetsWin_mainLayout.setContentsMargins(0, 0, 0, 0) self.bakeOffsetsWin.resize(400, 250) self.bakeOffsetsWin.setSizePolicy(mainSizePolicy) self.bakeOffsetsWin.setMinimumSize(QtCore.QSize(400, 250)) self.bakeOffsetsWin.setMaximumSize(QtCore.QSize(400, 250)) # create the background self.bakeOffsetsWin_frame = QtWidgets.QFrame() self.bakeOffsetsWin_mainLayout.addWidget(self.bakeOffsetsWin_frame) # create the layout for the widgets self.bakeOffsetsWin_widgetLayout = QtWidgets.QHBoxLayout( self.bakeOffsetsWin_frame) self.bakeOffsetsWin_widgetLayout.setContentsMargins(5, 5, 5, 5) # add the QListWidget Frame self.bakeOffsetsWin_moduleListFrame = QtWidgets.QFrame() self.bakeOffsetsWin_moduleListFrame.setMinimumSize( QtCore.QSize(265, 200)) self.bakeOffsetsWin_moduleListFrame.setMaximumSize( QtCore.QSize(265, 200)) self.bakeOffsetsWin_moduleListFrame.setContentsMargins(20, 0, 20, 0) # create the list widget self.bakeOffsetsWin_moduleList = QtWidgets.QListWidget( self.bakeOffsetsWin_moduleListFrame) self.bakeOffsetsWin_widgetLayout.addWidget( self.bakeOffsetsWin_moduleListFrame) self.bakeOffsetsWin_moduleList.setMinimumSize(QtCore.QSize(265, 200)) self.bakeOffsetsWin_moduleList.setMaximumSize(QtCore.QSize(265, 200)) self.bakeOffsetsWin_moduleList.setSelectionMode( QtWidgets.QAbstractItemView.MultiSelection) self.bakeOffsetsWin_moduleList.setSpacing(3) # add the layout for the buttons self.bakeOffsetsWin_buttonLayoutAll = QtWidgets.QVBoxLayout() self.bakeOffsetsWin_widgetLayout.addLayout( self.bakeOffsetsWin_buttonLayoutAll) self.bakeOffsetsWin_buttonLayoutAll.setContentsMargins(5, 20, 5, 20) # add the selection buttons self.bakeOffsetsWin_selectionButtonLayout = QtWidgets.QVBoxLayout() self.bakeOffsetsWin_buttonLayoutAll.addLayout( self.bakeOffsetsWin_selectionButtonLayout) self.bakeOffsetsWin_selectAllButton = QtWidgets.QPushButton( "Select All") self.bakeOffsetsWin_selectAllButton.setMinimumSize( QtCore.QSize(115, 25)) self.bakeOffsetsWin_selectAllButton.setMaximumSize( QtCore.QSize(115, 25)) self.bakeOffsetsWin_selectionButtonLayout.addWidget( self.bakeOffsetsWin_selectAllButton) self.bakeOffsetsWin_selectAllButton.clicked.connect( self.bakeOffsetsWin_moduleList.selectAll) self.bakeOffsetsWin_selectAllButton.setObjectName("blueButton") self.bakeOffsetsWin_selectNoneButton = QtWidgets.QPushButton( "Clear Selection") self.bakeOffsetsWin_selectNoneButton.setMinimumSize( QtCore.QSize(115, 25)) self.bakeOffsetsWin_selectNoneButton.setMaximumSize( QtCore.QSize(115, 25)) self.bakeOffsetsWin_selectionButtonLayout.addWidget( self.bakeOffsetsWin_selectNoneButton) self.bakeOffsetsWin_selectNoneButton.clicked.connect( self.bakeOffsetsWin_moduleList.clearSelection) self.bakeOffsetsWin_selectNoneButton.setObjectName("blueButton") # spacer spacerItem = QtWidgets.QSpacerItem(20, 80, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding) self.bakeOffsetsWin_selectionButtonLayout.addItem(spacerItem) # add the buttons for reset settings and reset transforms self.bakeOffsetsWin_bakeOFfsetsBtn = QtWidgets.QPushButton( "Bake Offsets") self.bakeOffsetsWin_bakeOFfsetsBtn.setMinimumSize(QtCore.QSize( 115, 25)) self.bakeOffsetsWin_bakeOFfsetsBtn.setMaximumSize(QtCore.QSize( 115, 25)) self.bakeOffsetsWin_selectionButtonLayout.addWidget( self.bakeOffsetsWin_bakeOFfsetsBtn) self.bakeOffsetsWin_bakeOFfsetsBtn.setToolTip( "Turn on Aim Mode for selected modules.") self.bakeOffsetsWin_bakeOFfsetsBtn.clicked.connect( partial(self.bakeOffsets)) self.bakeOffsetsWin_bakeOFfsetsBtn.setObjectName("blueButton") # populate the list widget modules = utils.returnRigModules() for module in modules: # get module name moduleName = cmds.getAttr(module + ".moduleName") if moduleName != "root": self.bakeOffsetsWin_moduleList.addItem(moduleName) # show the window self.bakeOffsetsWin.show()
def buildHelpMovieUI(self, moviePath): #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);") self.mainWin.setMinimumSize(660, 520) self.mainWin.setMaximumSize(660, 520) #create the main widget self.mainWidget = QtWidgets.QWidget() self.mainWin.setCentralWidget(self.mainWidget) #create the qFrame so we can have a background self.frame = QtWidgets.QFrame(self.mainWidget) self.frame.setStyleSheet("background-color: rgb(0,0,0);") self.frame.setMinimumSize(660, 520) self.frame.setMaximumSize(660, 520) #set qt object name self.mainWin.setObjectName("ART_HelpMovieWin") self.mainWin.setWindowTitle("Help") #font headerFont = QtGui.QFont() headerFont.setPointSize(10) headerFont.setBold(True) #create the mainLayout for the rig creator UI self.layout = QtWidgets.QVBoxLayout(self.frame) #set up the screen self.movie_screen = QtWidgets.QLabel() # expand and center the label self.movie_screen.setAlignment(QtCore.Qt.AlignCenter) self.layout.addWidget(self.movie_screen) #buttons and button layout self.buttonlayout = QtWidgets.QHBoxLayout() self.layout.addLayout(self.buttonlayout) spacer = QtWidgets.QSpacerItem(60, 0) self.buttonlayout.addSpacerItem(spacer) self.playBtn = QtWidgets.QPushButton("Close") self.buttonlayout.addWidget(self.playBtn) self.playBtn.clicked.connect(partial(self.close)) self.playBtn.setStyleSheet("background-image: url(" + self.imageBtnBkrd + ");background-color: rgb(25, 175, 255);") self.playBtn.setMinimumHeight(40) self.playBtn.setMaximumHeight(40) self.playBtn.setFont(headerFont) spacer = QtWidgets.QSpacerItem(60, 0) self.buttonlayout.addSpacerItem(spacer) #set movie from file path self.movie = QtGui.QMovie(moviePath, QtCore.QByteArray()) self.movie.setCacheMode(QtGui.QMovie.CacheAll) self.movie.setSpeed(100) self.movie_screen.setMovie(self.movie) self.movie.start() #show self.mainWin.show()
def buildUI(self): if cmds.window("pyART_MatchOverRangeWIN", exists=True): cmds.deleteUI("pyART_MatchOverRangeWIN", wnd=True) # create the main window self.mainWin = QtWidgets.QMainWindow(self.pickerUI) # create the main widget self.mainWidget = QtWidgets.QFrame() self.mainWidget.setObjectName("dark") self.mainWin.setCentralWidget(self.mainWidget) # 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) # set window size self.mainWin.setMinimumSize(QtCore.QSize(600, 350)) self.mainWin.setMaximumSize(QtCore.QSize(600, 350)) self.mainWin.resize(600, 350) # set qt object name self.mainWin.setObjectName("pyART_MatchOverRangeWIN") self.mainWin.setWindowTitle("Match Over Frame Range") # horizontal layout self.mainLayout = QtWidgets.QHBoxLayout(self.mainWidget) # LEFT SIDE # module list widget self.moduleList = QtWidgets.QListWidget() self.mainLayout.addWidget(self.moduleList) # self.moduleList.setMinimumSize(QtCore.QSize(300, 280)) # self.moduleList.setMaximumSize(QtCore.QSize(300, 280)) self.moduleList.setSelectionMode( QtWidgets.QAbstractItemView.NoSelection) self.moduleList.setSpacing(20) # RIGHT SIDE self.rightLayout = QtWidgets.QVBoxLayout() self.mainLayout.addLayout(self.rightLayout) self.rightLayout.addSpacerItem( QtWidgets.QSpacerItem(0, 25, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)) self.characterCombo = QtWidgets.QComboBox() self.rightLayout.addWidget(self.characterCombo) self.characterCombo.setMinimumHeight(50) self.characterCombo.setMaximumHeight(50) self.characterCombo.setIconSize(QtCore.QSize(50, 50)) self.characterCombo.currentIndexChanged.connect( partial(self.findCharacterModules)) # frame ranges # SPACER! self.rightLayout.addSpacerItem( QtWidgets.QSpacerItem(0, 40, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)) self.rangeLayout = QtWidgets.QHBoxLayout() self.rightLayout.addLayout(self.rangeLayout) label1 = QtWidgets.QLabel("Start:") label1.setStyleSheet("background: transparent;") self.rangeLayout.addWidget(label1) self.startFrame = QtWidgets.QSpinBox() self.startFrame.setButtonSymbols(QtWidgets.QAbstractSpinBox.NoButtons) self.rangeLayout.addWidget(self.startFrame) self.startFrame.setRange(-10000, 10000) label2 = QtWidgets.QLabel("End:") label2.setStyleSheet("background: transparent;") self.rangeLayout.addWidget(label2) self.endFrame = QtWidgets.QSpinBox() self.endFrame.setButtonSymbols(QtWidgets.QAbstractSpinBox.NoButtons) self.rangeLayout.addWidget(self.endFrame) self.endFrame.setRange(-10000, 10000) # SPACER! self.rightLayout.addSpacerItem( QtWidgets.QSpacerItem(0, 0, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Expanding)) # Button self.matchButton = QtWidgets.QPushButton("Match") self.rightLayout.addWidget(self.matchButton) self.matchButton.setObjectName("blueButton") self.matchButton.setMinimumHeight(50) self.matchButton.clicked.connect(self.match) # SPACER! self.rightLayout.addSpacerItem( QtWidgets.QSpacerItem(0, 25, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)) # show the window self.mainWin.show() # populate UI self.findCharacters() self.findCharacterModules() startFrame = cmds.playbackOptions(q=True, min=True) endFrame = cmds.playbackOptions(q=True, max=True) self.startFrame.setValue(startFrame) self.endFrame.setValue(endFrame)
def buildUI(self): """ Builds the interface, which doesn't really have any user-interaction, but is there to display information about the progress of the rig build. There are two QProgressBars that show current module build progress and total build progress, then a QTextEdit which outputs information about what the build process is currently working on. After the interface is built, it sets the rig pose on the joints of each module. """ # create the main window self.mainWin = QtWidgets.QMainWindow(interfaceUtils.getMainWindow()) 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_BuildProgressWin") self.mainWin.setWindowTitle("Build Progress") # 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(500, 300) self.mainWin.setSizePolicy(mainSizePolicy) self.mainWin.setMinimumSize(QtCore.QSize(500, 300)) self.mainWin.setMaximumSize(QtCore.QSize(500, 300)) # 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") # build the progress bars: self.currentTask = QtWidgets.QProgressBar() self.mainLayout.addWidget(self.currentTask) self.currentTask.setRange(0, 100) self.currentTask.setTextVisible(True) self.currentTask.setValue(0) self.totalProgress = QtWidgets.QProgressBar() self.mainLayout.addWidget(self.totalProgress) self.totalProgress.setFormat("Total Progress..") self.totalProgress.setRange(0, 12) self.totalProgress.setTextVisible(True) self.totalProgress.setValue(0) # detailed information self.infoText = QtWidgets.QTextEdit() self.mainLayout.addWidget(self.infoText) self.infoText.setMinimumHeight(200) self.infoText.setMaximumHeight(200) self.infoText.setText("Starting Build Process..") self.infoText.setReadOnly(True) # show the window self.mainWin.show() # start build self.setRigPose()
def buildUI(self): if cmds.window("pyART_ImportMotionWIN", exists=True): cmds.deleteUI("pyART_ImportMotionWIN", wnd=True) #create the main window self.mainWin = QtWidgets.QMainWindow(self.pickerUI) #create the main widget self.mainWidget = QtWidgets.QWidget() self.mainWin.setCentralWidget(self.mainWidget) #create the mainLayout self.layout = QtWidgets.QVBoxLayout(self.mainWidget) #load stylesheet styleSheetFile = utils.returnNicePath( self.toolsPath, "Core/Scripts/Interfaces/StyleSheets/animPicker.qss") f = open(styleSheetFile, "r") self.style = f.read() f.close() self.mainWin.setStyleSheet(self.style) self.mainWin.setMinimumSize(QtCore.QSize(600, 350)) self.mainWin.setMaximumSize(QtCore.QSize(600, 350)) self.mainWin.resize(600, 350) #set qt object name self.mainWin.setObjectName("pyART_ImportMotionWIN") self.mainWin.setWindowTitle("Import Motion") #tabs self.importTabs = QtWidgets.QTabWidget() self.layout.addWidget(self.importTabs) #style sheet stylesheet = """ QTabBar::tab { background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 rgb(19,132,183), stop:1 rgb(30,30,30)); width: 100px; padding-left: -10px; } QTabBar::tab:selected { background-color: rgb(14,100,143); border: 2px solid black; } QTabBar::tab:hover { background: rgb(19,132,183); } QTabBar::tab:!selected { margin-top: 5px; } QTabWidget::pane { border-top: 2px solid rgb(19,132,183); border-left: 2px solid rgb(19,132,183); border-right: 2px solid rgb(19,132,183); border-bottom: 2px solid rgb(19,132,183); } """ self.importTabs.setStyleSheet(stylesheet) #FBX Tab self.fbxImportTab = QtWidgets.QWidget() self.importTabs.addTab(self.fbxImportTab, "FBX") #Anim Curve Tab self.animImportTab = QtWidgets.QWidget() self.importTabs.addTab(self.animImportTab, "Animation") #======================================================================= #======================================================================= #======================================================================= #======================================================================= # #FBX TAB #======================================================================= #======================================================================= #======================================================================= #======================================================================= #horizontal layout self.fbxMainLayout = QtWidgets.QHBoxLayout(self.fbxImportTab) #LEFT SIDE #module list widget self.fbxModuleList = QtWidgets.QListWidget() self.fbxMainLayout.addWidget(self.fbxModuleList) self.fbxModuleList.setMinimumSize(QtCore.QSize(300, 280)) self.fbxModuleList.setMaximumSize(QtCore.QSize(300, 280)) self.fbxModuleList.setSpacing(15) self.fbxModuleList.setSelectionMode( QtWidgets.QAbstractItemView.NoSelection) #RIGHT SIDE self.fbxRightLayout = QtWidgets.QVBoxLayout() self.fbxMainLayout.addLayout(self.fbxRightLayout) self.fbxCharacterCombo = QtWidgets.QComboBox() self.fbxRightLayout.addWidget(self.fbxCharacterCombo) self.fbxCharacterCombo.setMinimumSize(QtCore.QSize(250, 50)) self.fbxCharacterCombo.setMaximumSize(QtCore.QSize(250, 50)) self.fbxCharacterCombo.setIconSize(QtCore.QSize(45, 45)) self.fbxCharacterCombo.currentIndexChanged.connect( partial(self.findCharacterModules)) self.fbxPathLayout = QtWidgets.QHBoxLayout() self.fbxRightLayout.addLayout(self.fbxPathLayout) self.fbxFilePath = QtWidgets.QLineEdit() self.fbxFilePath.setMinimumWidth(210) self.fbxFilePath.setMaximumWidth(210) self.fbxPathLayout.addWidget(self.fbxFilePath) self.fbxFilePath.setPlaceholderText("fbx file..") browseBtn = QtWidgets.QPushButton() browseBtn.setMinimumSize(25, 25) browseBtn.setMaximumSize(25, 25) self.fbxPathLayout.addWidget(browseBtn) icon = QtGui.QIcon( utils.returnNicePath(self.iconsPath, "System/fileBrowse.png")) browseBtn.setIconSize(QtCore.QSize(25, 25)) browseBtn.setIcon(icon) browseBtn.clicked.connect(self.fbxFileBrowse) self.frameOffsetLayout = QtWidgets.QHBoxLayout() self.fbxRightLayout.addLayout(self.frameOffsetLayout) frameOffset = QtWidgets.QLabel("Frame Offset:") frameOffset.setStyleSheet("background: transparent; font: bold;") self.frameOffsetLayout.addWidget(frameOffset) self.frameOffsetField = QtWidgets.QSpinBox() self.frameOffsetField.setButtonSymbols( QtWidgets.QAbstractSpinBox.NoButtons) self.frameOffsetField.setRange(-1000, 10000) self.frameOffsetLayout.addWidget(self.frameOffsetField) #option to strip namespace self.stripNamespace = QtWidgets.QCheckBox("Strip Incoming Namespace") self.stripNamespace.setToolTip( "If the incoming FBX has a namespace, checking this\noption will strip that namespace upon import" ) self.stripNamespace.setChecked(True) self.fbxRightLayout.addWidget(self.stripNamespace) #Save/Load Settings saveLoadLayout = QtWidgets.QHBoxLayout() self.fbxRightLayout.addLayout(saveLoadLayout) saveSettingsBtn = QtWidgets.QPushButton("Save Settings") saveSettingsBtn.setMinimumSize(120, 30) saveSettingsBtn.setMaximumSize(120, 30) icon = QtGui.QIcon( utils.returnNicePath(self.iconsPath, "System/save.png")) saveSettingsBtn.setIconSize(QtCore.QSize(25, 25)) saveSettingsBtn.setIcon(icon) saveLoadLayout.addWidget(saveSettingsBtn) saveSettingsBtn.setObjectName("blueButton") saveSettingsBtn.setToolTip("Save out module import settings") saveSettingsBtn.clicked.connect(self.saveSettings) loadSettingsBtn = QtWidgets.QPushButton("Load Settings") loadSettingsBtn.setMinimumSize(120, 30) loadSettingsBtn.setMaximumSize(120, 30) icon = QtGui.QIcon( utils.returnNicePath(self.iconsPath, "System/load.png")) loadSettingsBtn.setIconSize(QtCore.QSize(25, 25)) loadSettingsBtn.setIcon(icon) saveLoadLayout.addWidget(loadSettingsBtn) loadSettingsBtn.setObjectName("blueButton") loadSettingsBtn.setToolTip("Load and set module import settings") loadSettingsBtn.clicked.connect(self.loadSettings) #SPACER! self.fbxRightLayout.addSpacerItem( QtWidgets.QSpacerItem(0, 0, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Expanding)) #Button self.importFBXbutton = QtWidgets.QPushButton("Import") self.fbxRightLayout.addWidget(self.importFBXbutton) self.importFBXbutton.setObjectName("blueButton") self.importFBXbutton.setMinimumHeight(50) self.importFBXbutton.clicked.connect(self.fbxImport) #show window self.mainWin.show() #populate UI self.findCharacters() self.findCharacterModules()
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()
def buildMoveInfsUI(self): if cmds.window("ART_MoveInfluencesWin", exists = True): cmds.deleteUI("ART_MoveInfluencesWin", wnd = True) #launch a UI to get the name information self.moveInfsWin = 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.moveInfsWin.setStyleSheet(self.style) #size policies mainSizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) #create the main widget self.moveInfsWin_mainWidget = QtWidgets.QWidget() self.moveInfsWin.setCentralWidget(self.moveInfsWin_mainWidget) #set qt object name self.moveInfsWin.setObjectName("ART_MoveInfluencesWin") self.moveInfsWin.setWindowTitle("Move Influences") #create the mainLayout for the rig creator UI self.moveInfsWin_mainLayout = QtWidgets.QVBoxLayout(self.moveInfsWin_mainWidget) self.moveInfsWin_mainLayout.setContentsMargins(0, 0, 0, 0) self.moveInfsWin.resize(300, 100) self.moveInfsWin.setSizePolicy(mainSizePolicy) self.moveInfsWin.setMinimumSize(QtCore.QSize( 300, 100 )) self.moveInfsWin.setMaximumSize(QtCore.QSize( 300, 100 )) #create the background image self.moveInfsWin_frame = QtWidgets.QFrame() self.moveInfsWin_mainLayout.addWidget(self.moveInfsWin_frame) #layout for the widgets self.moveInfsWin_widgetLayout = QtWidgets.QVBoxLayout(self.moveInfsWin_frame) #layout for the combo boxes self.moveInfsWin_comboBoxLayout = QtWidgets.QHBoxLayout() self.moveInfsWin_widgetLayout.addLayout(self.moveInfsWin_comboBoxLayout) #combo boxes self.moveFromComboBox = QtWidgets.QComboBox() self.moveInfsWin_comboBoxLayout.addWidget(self.moveFromComboBox) label = QtWidgets.QLabel(" --------> ") label.setMaximumWidth(40) label.setAlignment(QtCore.Qt.AlignCenter) self.moveInfsWin_comboBoxLayout.addWidget(label) self.moveToComboBox = QtWidgets.QComboBox() self.moveInfsWin_comboBoxLayout.addWidget(self.moveToComboBox) #process button self.moveInfsGoBtn = QtWidgets.QPushButton("Move Influences") self.moveInfsGoBtn.setObjectName("blueButton") self.moveInfsWin_widgetLayout.addWidget(self.moveInfsGoBtn) self.moveInfsGoBtn.setMinimumHeight(40) self.moveInfsGoBtn.clicked.connect(partial(self.moveInfluences)) #populate the lists status = self.findInfluencesOnSelection() if not status: return #show the window self.moveInfsWin.show()
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()
def buildBoneCounterUI(self): """ Builds the interface for the bone counter tool, which is comprised off a QLineEdit that shows the current bone count, a QPushButton to launch another simple UI that allows the user to set a bone count target, and QProgressBar that shows a percentage to target bone count. .. seealso:: ART_BoneCounter.setBoneCountTarget """ if cmds.window("ART_BoneCounterWin", exists=True): cmds.deleteUI("ART_BoneCounterWin", wnd=True) # launch a UI to get the name information self.boneCounterWin = QtWidgets.QMainWindow(self.mainUI) # size policies mainSizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) # create the main widget self.boneCounterWin_mainWidget = QtWidgets.QWidget() self.boneCounterWin.setCentralWidget(self.boneCounterWin_mainWidget) # set qt object name self.boneCounterWin.setObjectName("ART_BoneCounterWin") self.boneCounterWin.setWindowTitle("Bone Counter") # create the mainLayout for the rig creator UI self.boneCounterWin_mainLayout = QtWidgets.QVBoxLayout(self.boneCounterWin_mainWidget) self.boneCounterWin_mainLayout.setContentsMargins(0, 0, 0, 0) self.boneCounterWin.resize(300, 100) self.boneCounterWin.setSizePolicy(mainSizePolicy) self.boneCounterWin.setMinimumSize(QtCore.QSize(300, 100)) self.boneCounterWin.setMaximumSize(QtCore.QSize(300, 100)) headerFont = QtGui.QFont() headerFont.setPointSize(8) headerFont.setBold(True) # load toolbar stylesheet styleSheetFile = utils.returnNicePath(self.toolsPath, "Core/Scripts/Interfaces/StyleSheets/mainScheme.qss") f = open(styleSheetFile, "r") self.style = f.read() f.close() # create the bone counter stylesheet self.progBarStyle = """ QProgressBar{ border: 2px solid black; border-radius: 5px; text-align: center; font: 87 10pt "Arial"; color: rgb(255,255,255); } QProgressBar::chunk { background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 rgb(25,175,255), stop:1 rgb(9,62,98)); width: 10px; margin: 0.5px; } """ self.progBarStyleMax = """ QProgressBar{ border: 2px solid black; border-radius: 5px; text-align: center; font: 87 10pt "Arial Black"; color: rgb(255,255,255); } QProgressBar::chunk { background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 rgb(255,174,0), stop:1 rgb(30,30,30)); width: 10px; margin: 0.5px; } """ # create the background image self.boneCounterWin_frame = QtWidgets.QFrame() self.boneCounterWin_mainLayout.addWidget(self.boneCounterWin_frame) self.boneCounterWin_frame.setObjectName("mid") self.boneCounterWin.setStyleSheet(self.style) # create the layout for the widgets self.boneCounterWin_widgetLayoutMain = QtWidgets.QVBoxLayout(self.boneCounterWin_frame) self.boneCounterWin_widgetLayoutMain.setContentsMargins(5, 5, 5, 5) self.boneCounterWin_widgetLayout = QtWidgets.QHBoxLayout() self.boneCounterWin_widgetLayoutMain.addLayout(self.boneCounterWin_widgetLayout) # label creation self.boneCount = QtWidgets.QLabel("Bone Count: ") self.boneCount.setFont(headerFont) self.boneCounterWin_widgetLayout.addWidget(self.boneCount) self.boneCounter = QtWidgets.QSpinBox() self.boneCounter.setReadOnly(True) self.boneCounter.setButtonSymbols(QtWidgets.QAbstractSpinBox.NoButtons) self.boneCounter.setRange(1, 9999) self.boneCounter.setMinimumWidth(60) self.boneCounter.setMaximumWidth(60) self.boneCounterWin_widgetLayout.addWidget(self.boneCounter) # create the button self.boneMaxButton = QtWidgets.QPushButton("Set Target") self.boneCounterWin_widgetLayout.addWidget(self.boneMaxButton) self.boneMaxButton.clicked.connect(partial(self.setBoneCountTarget)) self.boneMaxButton.setMinimumHeight(30) self.boneMaxButton.setStyleSheet(self.style) self.boneMaxButton.setObjectName("blueButton") # add the progress bar self.boneCountBar = QtWidgets.QProgressBar() self.boneCounterWin_widgetLayoutMain.addWidget(self.boneCountBar) self.boneCountBar.setValue(1) self.boneCountBar.setStyleSheet(self.progBarStyle) self.boneCountBar.setRange(0, 100) self.boneCountBar.setFormat("target = %m") # add the max range of the progress bar to the main network node if cmds.objExists("ART_Root_Module.target"): value = cmds.getAttr("ART_Root_Module.target") currentValue = self.boneCountBar.value() self.boneCountBar.setMaximum(value) if value < currentValue: self.boneCountBar.setValue(value) if currentValue <= value: self.boneCountBar.setStyleSheet(self.progBarStyle) if currentValue > value: self.boneCountBar.setStyleSheet(self.progBarStyleMax) else: cmds.addAttr("ART_Root_Module", sn="target", keyable=False) cmds.setAttr("ART_Root_Module.target", 100, lock=True) # get the current bone count modules = utils.returnRigModules() allBones = [] for module in modules: joints = cmds.getAttr(module + ".Created_Bones") splitJoints = joints.split("::") for bone in splitJoints: if bone != "": allBones.append(bone) # update the spinBox and progress bar self.boneCounter.setValue(len(allBones)) max = self.boneCountBar.maximum() if len(allBones) <= max: self.boneCountBar.setValue(len(allBones)) self.boneCountBar.setStyleSheet(self.progBarStyle) if len(allBones) > max: self.boneCountBar.setValue(max) self.boneCountBar.setStyleSheet(self.progBarStyleMax) # show window self.boneCounterWin.show()
def buildUI(self): if cmds.window("pyART_SelectControlsWIN", exists=True): cmds.deleteUI("pyART_SelectControlsWIN", wnd=True) # create the main window self.mainWin = QtWidgets.QMainWindow(self.pickerUI) # create the main widget self.mainWidget = QtWidgets.QFrame() self.mainWidget.setObjectName("dark") self.mainWin.setCentralWidget(self.mainWidget) # create the mainLayout self.mainLayout = QtWidgets.QVBoxLayout(self.mainWidget) # load stylesheet styleSheetFile = utils.returnNicePath( self.toolsPath, "Core/Scripts/Interfaces/StyleSheets/animPicker.qss") f = open(styleSheetFile, "r") self.style = f.read() f.close() self.mainWin.setStyleSheet(self.style) self.mainWin.setMinimumSize(QtCore.QSize(400, 250)) self.mainWin.setMaximumSize(QtCore.QSize(400, 250)) self.mainWin.resize(400, 250) # set qt object name self.mainWin.setObjectName("pyART_SelectControlsWIN") self.mainWin.setWindowTitle("Select Rig Controls") self.layout = QtWidgets.QHBoxLayout() self.mainLayout.addLayout(self.layout) # LEFT SIDE # list of modules self.moduleList = QtWidgets.QListWidget() self.moduleList.setMinimumSize(QtCore.QSize(180, 230)) self.moduleList.setMaximumSize(QtCore.QSize(180, 230)) self.layout.addWidget(self.moduleList) self.moduleList.setSelectionMode( QtWidgets.QAbstractItemView.MultiSelection) self.moduleList.setContextMenuPolicy(QtCore.Qt.CustomContextMenu) self.moduleList.customContextMenuRequested.connect( self.createContextMenu) # RIGHT SIDE self.rightLayout = QtWidgets.QVBoxLayout() self.layout.addLayout(self.rightLayout) # character combo self.characterCombo = QtWidgets.QComboBox() self.rightLayout.addWidget(self.characterCombo) self.characterCombo.setMinimumSize(QtCore.QSize(180, 60)) self.characterCombo.setMaximumSize(QtCore.QSize(180, 60)) self.characterCombo.setIconSize(QtCore.QSize(50, 50)) self.characterCombo.currentIndexChanged.connect( partial(self.findCharacterModules)) # select options self.fkControlsCB = QtWidgets.QCheckBox("FK Controls") self.fkControlsCB.setChecked(True) self.fkControlsCB.setToolTip( "If this is checked, for the selected modules,\nall FK controls will be selected or added to the selection." ) self.rightLayout.addWidget(self.fkControlsCB) self.ikControlsCB = QtWidgets.QCheckBox("IK Controls") self.ikControlsCB.setChecked(True) self.ikControlsCB.setToolTip( "If this is checked, for the selected modules,\nall IK controls will be selected or added to the selection." ) self.rightLayout.addWidget(self.ikControlsCB) self.specialControlsCB = QtWidgets.QCheckBox("Special Controls") self.specialControlsCB.setChecked(True) self.specialControlsCB.setToolTip( "If this is checked, for the selected modules,\nany control that is not FK or IK (like dynamics for example),\nwill be selected or added to the selection." ) self.rightLayout.addWidget(self.specialControlsCB) self.selectSettingsCB = QtWidgets.QCheckBox("Include Settings") self.selectSettingsCB.setChecked(True) self.selectSettingsCB.setToolTip( "If this is checked, for the selected modules,\nall settings nodes will be included in the selection." ) self.rightLayout.addWidget(self.selectSettingsCB) self.selectSpacesCB = QtWidgets.QCheckBox("Include Spaces") self.selectSpacesCB.setChecked(True) self.selectSpacesCB.setToolTip( "If this is checked, for the selected modules,\nall space switching nodes will be included in the selection." ) self.rightLayout.addWidget(self.selectSpacesCB) self.rightLayout.addSpacerItem( QtWidgets.QSpacerItem(0, 0, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Expanding)) self.selectCtrlsBtn = QtWidgets.QPushButton("Select Controls") self.selectCtrlsBtn.setMinimumWidth(180) self.selectCtrlsBtn.setMaximumWidth(180) self.rightLayout.addWidget(self.selectCtrlsBtn) self.selectCtrlsBtn.setObjectName("blueButton") self.selectCtrlsBtn.clicked.connect(self.selectControls) # show window if self.showUI: self.mainWin.show() # populate UI self.findCharacters() self.findCharacterModules()
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()
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()