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 populateCharacters(self): """ Given the selected project and group, populate the QListWidget with any assets found using that information. The project path comes from the QSettings, the group is a subfolder of the project. """ # add project button font = QtGui.QFont() font.setPointSize(12) font.setBold(True) # get a list of the existing folders in projects selectedProject = self.projectMenu.currentText() fullPath = os.path.join(self.projectPath, selectedProject) selectedGroup = self.groupMenu.currentText() if len(selectedGroup) > 1: fullPath = os.path.join(fullPath, selectedGroup) existingCharacters = os.listdir(fullPath) files = [] # find out which returned items are directories for each in existingCharacters: if os.path.isfile(os.path.join(fullPath, each)): if each.rpartition(".")[2] == "ma": files.append(each) # otherwise, add each project to the combo box self.characterList.clear() for each in files: item = QtWidgets.QListWidgetItem(each.partition(".ma")[0]) item.setFont(font) self.characterList.addItem(item)
def addTextToButton(text, parent, centered=True, top=False, bottom=False): text = QtWidgets.QGraphicsSimpleTextItem(text, parent) font = QtGui.QFont() font.setBold(True) font.setPointSize(12) text.setFont(font) textPos = parent.boundingRect().center() textRect = text.boundingRect() parentRect = parent.boundingRect() if centered: text.setPos(textPos.x() - textRect.width() / 2, textPos.y() - textRect.height() / 2) if top: text.setPos(textPos.x() - textRect.width() / 2, textPos.y() - (parentRect.height() / 2 + textRect.height())) if bottom: text.setPos(textPos.x() - textRect.width() / 2, textPos.y() + (parentRect.height() / 2)) return text
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 __init__(self, rigUiInst, parent=None): #call base class constructor super(WeightWizard, 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") #store rigUiInst in class self.rigUiInst = rigUiInst #set size policy mainSizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) #create the main widget self.mainWidget = QtWidgets.QWidget() self.setCentralWidget(self.mainWidget) #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.setStyleSheet(self.style) #set qt object name self.setObjectName(windowObject) self.setWindowTitle(windowTitle) #create the mainLayout for the rig creator UI self.layout = QtWidgets.QVBoxLayout(self.mainWidget) self.resize(600, 400) self.setSizePolicy(mainSizePolicy) self.setMinimumSize(QtCore.QSize(600, 400)) self.setMaximumSize(QtCore.QSize(600, 400)) #Create a stackedWidget self.stackWidget = QtWidgets.QStackedWidget() self.layout.addWidget(self.stackWidget) # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #PAGE ONE: SKIN PROXY GEO # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # self.page1 = QtWidgets.QFrame() self.page1.setObjectName("dark") self.stackWidget.addWidget(self.page1) self.page1MainLayout = QtWidgets.QVBoxLayout(self.page1) #label pageOneLabel = QtWidgets.QLabel("Skin Weight Proxy Geometry?") pageOneLabel.setStyleSheet("background: transparent;") self.page1MainLayout.addWidget(pageOneLabel) font = QtGui.QFont() font.setPointSize(12) font.setBold(True) pageOneLabel.setFont(font) #image self.pageOneInfo = QtWidgets.QFrame() self.pageOneInfo.setMinimumSize(QtCore.QSize(560, 250)) self.pageOneInfo.setMaximumSize(QtCore.QSize(560, 250)) self.page1MainLayout.addWidget(self.pageOneInfo) image = utils.returnNicePath(self.iconsPath, "System/weightProxy.png") self.pageOneInfo.setStyleSheet("background-image: url(" + image + ");") #buttons self.pageOneButtonLayout = QtWidgets.QHBoxLayout() self.page1MainLayout.addLayout(self.pageOneButtonLayout) self.skinProxyFalseBtn = QtWidgets.QPushButton("No") self.skinProxyFalseBtn.setMinimumHeight(50) self.skinProxyFalseBtn.setFont(font) self.skinProxyTrueBtn = QtWidgets.QPushButton("Yes") self.skinProxyTrueBtn.setMinimumHeight(50) self.skinProxyTrueBtn.setFont(font) self.pageOneButtonLayout.addWidget(self.skinProxyFalseBtn) self.pageOneButtonLayout.addWidget(self.skinProxyTrueBtn) self.skinProxyFalseBtn.setObjectName("blueButton") self.skinProxyTrueBtn.setObjectName("blueButton") #button hookups self.skinProxyFalseBtn.clicked.connect(self.checkForCustomMeshes) self.skinProxyTrueBtn.clicked.connect(self.skinProxyGeo) # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #PAGE TWO: NO CUSTOM GEO FOUND # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # self.page2 = QtWidgets.QFrame() self.stackWidget.addWidget(self.page2) self.page2MainLayout = QtWidgets.QVBoxLayout(self.page2) self.page2.setObjectName("dark") #label pageTwoLabel = QtWidgets.QLabel("Skin Weight Custom Geometry?") self.page2MainLayout.addWidget(pageTwoLabel) font = QtGui.QFont() font.setPointSize(12) font.setBold(True) pageTwoLabel.setFont(font) #image self.pageTwoInfo = QtWidgets.QFrame() self.pageTwoInfo.setMinimumSize(QtCore.QSize(560, 250)) self.pageTwoInfo.setMaximumSize(QtCore.QSize(560, 250)) self.page2MainLayout.addWidget(self.pageTwoInfo) image = utils.returnNicePath(self.iconsPath, "System/geoNotFound.png") self.pageTwoInfo.setStyleSheet("background-image: url(" + image + ");") #buttons self.pageTwoButtonLayout = QtWidgets.QHBoxLayout() self.page2MainLayout.addLayout(self.pageTwoButtonLayout) self.skipStepButton = QtWidgets.QPushButton("Skip This Step") self.skipStepButton.setMinimumHeight(50) self.skipStepButton.setFont(font) self.addMeshesButton = QtWidgets.QPushButton("Add Meshes") self.addMeshesButton.setMinimumHeight(50) self.addMeshesButton.setFont(font) self.pageTwoButtonLayout.addWidget(self.skipStepButton) self.pageTwoButtonLayout.addWidget(self.addMeshesButton) self.addMeshesButton.setObjectName("blueButton") self.skipStepButton.setObjectName("blueButton") #connect button self.skipStepButton.clicked.connect(self.closeWizard) self.addMeshesButton.clicked.connect(self.addCustomMeshes) # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #PAGE THREE: SKIN CUSTOM GEO # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # self.page3 = QtWidgets.QFrame() self.stackWidget.addWidget(self.page3) self.page3MainLayout = QtWidgets.QVBoxLayout(self.page3) self.page3.setObjectName("dark") #label pageThreeLabel = QtWidgets.QLabel("Skin Weight Custom Geometry?") self.page3MainLayout.addWidget(pageThreeLabel) font = QtGui.QFont() font.setPointSize(12) font.setBold(True) pageThreeLabel.setFont(font) #image self.pageThreeInfo = QtWidgets.QFrame() self.pageThreeInfo.setMinimumSize(QtCore.QSize(560, 250)) self.pageThreeInfo.setMaximumSize(QtCore.QSize(560, 250)) self.page3MainLayout.addWidget(self.pageThreeInfo) image = utils.returnNicePath(self.iconsPath, "System/skinCustom.png") self.pageThreeInfo.setStyleSheet("background-image: url(" + image + ");") #buttons self.pageThreeButtonLayout = QtWidgets.QHBoxLayout() self.page3MainLayout.addLayout(self.pageThreeButtonLayout) self.skinGeoFalseBtn = QtWidgets.QPushButton("No") self.skinGeoFalseBtn.setMinimumHeight(50) self.skinGeoFalseBtn.setFont(font) self.skinGeoTrueBtn = QtWidgets.QPushButton("Yes") self.skinGeoTrueBtn.setMinimumHeight(50) self.skinGeoTrueBtn.setFont(font) self.pageThreeButtonLayout.addWidget(self.skinGeoFalseBtn) self.pageThreeButtonLayout.addWidget(self.skinGeoTrueBtn) self.skinGeoTrueBtn.setObjectName("blueButton") self.skinGeoFalseBtn.setObjectName("blueButton") #connect buttons self.skinGeoTrueBtn.clicked.connect(self.skinTools) self.skinGeoFalseBtn.clicked.connect(self.closeWizard) # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #PAGE FOUR: SKIN TOOLS # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # self.page4 = QtWidgets.QFrame() self.stackWidget.addWidget(self.page4) self.page4TopLayout = QtWidgets.QVBoxLayout(self.page4) self.page4.setObjectName("dark") self.page4MainLayout = QtWidgets.QHBoxLayout() self.page4TopLayout.addLayout(self.page4MainLayout) #vertical layout for lists self.page4VerticalLayout = QtWidgets.QVBoxLayout() self.page4MainLayout.addLayout(self.page4VerticalLayout) #list widgets for meshes/joints self.splitter = QtWidgets.QSplitter() self.page4VerticalLayout.addWidget(self.splitter) #add geo list widget self.geoLayoutWidget = QtWidgets.QWidget() self.geoLayout = QtWidgets.QVBoxLayout(self.geoLayoutWidget) label = QtWidgets.QLabel("Skinnable Geo:") label.setFont(font) self.geoLayout.addWidget(label) self.geoList = QtWidgets.QListWidget() self.geoLayout.addWidget(self.geoList) self.splitter.addWidget(self.geoLayoutWidget) #populate geo list skinnableGeo = self.findCustomGeo() for geo in skinnableGeo: self.geoList.addItem(geo) #geo list signals self.geoList.itemDoubleClicked.connect(self.selectGeo) #add joint list/layout self.splitterWidget = QtWidgets.QWidget() self.splitter.addWidget(self.splitterWidget) self.splitterLayout = QtWidgets.QVBoxLayout(self.splitterWidget) self.search = QtWidgets.QLineEdit() self.search.setPlaceholderText("Search...") self.splitterLayout.addWidget(self.search) self.jointList = QtWidgets.QListWidget() self.jointList.setSelectionMode( QtWidgets.QAbstractItemView.ExtendedSelection) self.splitterLayout.addWidget(self.jointList) #populate joint list joints = self.findJoints() for joint in joints: self.jointList.addItem(joint) #search bar self.search.textChanged.connect(self.searchJoints) #add bottom layout for options/filters self.bottomLayout = QtWidgets.QHBoxLayout() self.bottomLayoutFrame = QtWidgets.QFrame() self.bottomLayoutFrame.setObjectName("dark") self.bottomLayoutFrame.setMaximumHeight(70) self.bottomLayout.addWidget(self.bottomLayoutFrame) self.optionsLayout = QtWidgets.QHBoxLayout(self.bottomLayoutFrame) self.page4VerticalLayout.addLayout(self.bottomLayout) #add bottom options/smooth bind (max influences, maintain max, dropoff rate #MAX INFLUENCES self.maxInfluenceLayout = QtWidgets.QVBoxLayout() self.optionsLayout.addLayout(self.maxInfluenceLayout) label = QtWidgets.QLabel("Max Influences: ") label.setMaximumHeight(20) label.setStyleSheet("color: rgb(25,175,255); background:transparent;") self.maxInfluenceLayout.addWidget(label) self.maxInfOptionsLayout = QtWidgets.QHBoxLayout() self.maxInfluenceLayout.addLayout(self.maxInfOptionsLayout) self.maxInfluences = QtWidgets.QSlider() self.maxInfluences.setRange(1, 8) self.maxInfluences.setSingleStep(1) self.maxInfluences.setPageStep(1) self.maxInfluences.setOrientation(QtCore.Qt.Horizontal) self.maxInfOptionsLayout.addWidget(self.maxInfluences) self.maxInfluencesReadout = QtWidgets.QSpinBox() self.maxInfOptionsLayout.addWidget(self.maxInfluencesReadout) self.maxInfluencesReadout.setReadOnly(True) self.maxInfluencesReadout.setButtonSymbols( QtWidgets.QAbstractSpinBox.NoButtons) self.maxInfluences.valueChanged.connect( self.maxInfluencesReadout.setValue) #DROPOFF RATE self.dropoffRateLayout = QtWidgets.QVBoxLayout() self.optionsLayout.addLayout(self.dropoffRateLayout) label2 = QtWidgets.QLabel("Dropoff Rate:") label2.setMaximumHeight(20) label2.setStyleSheet("color: rgb(25,175,255); background:transparent;") self.dropoffRateLayout.addWidget(label2) self.dropRateOptionsLayout = QtWidgets.QHBoxLayout() self.dropoffRateLayout.addLayout(self.dropRateOptionsLayout) self.dropoffRate = QtWidgets.QSlider() self.dropoffRate.setRange(.1, 100) self.dropoffRate.setSingleStep(.1) self.dropoffRate.setPageStep(1) self.dropoffRate.setOrientation(QtCore.Qt.Horizontal) self.dropRateOptionsLayout.addWidget(self.dropoffRate) self.dropoffReadout = QtWidgets.QSpinBox() self.dropRateOptionsLayout.addWidget(self.dropoffReadout) self.dropoffReadout.setReadOnly(True) self.dropoffReadout.setButtonSymbols( QtWidgets.QAbstractSpinBox.NoButtons) self.dropoffRate.valueChanged.connect(self.dropoffReadout.setValue) #MAINTAIN MAX self.maintainMaxInf = QtWidgets.QPushButton("Maintain Max Influences") self.optionsLayout.addWidget(self.maintainMaxInf) self.maintainMaxInf.setMinimumWidth(160) self.maintainMaxInf.setCheckable(True) self.maintainMaxInf.setChecked(True) self.maintainMaxInf.clicked.connect( partial(self.toggleButtonState, self.maintainMaxInf)) self.maintainMaxInf.setObjectName("blueButton") #button layout self.buttonLayout = QtWidgets.QVBoxLayout() self.optionsLayout.addLayout(self.buttonLayout) #SMOOTH BIND self.smoothBind = QtWidgets.QPushButton("Smooth Bind") self.smoothBind.setMinimumWidth(150) self.smoothBind.setMinimumHeight(30) self.buttonLayout.addWidget(self.smoothBind) self.smoothBind.clicked.connect(self.smoothBindSelected) self.smoothBind.setObjectName("blueButton") #CLOSE self.closeBtn = QtWidgets.QPushButton("Close") self.closeBtn.setMinimumWidth(150) self.closeBtn.setMinimumHeight(30) self.buttonLayout.addWidget(self.closeBtn) self.closeBtn.clicked.connect(self.closeWizard) self.closeBtn.setObjectName("blueButton") #set values self.dropoffRate.setValue(4) self.maxInfluences.setValue(4) # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #PAGE FIVE: SKIN WEIGHTS FOUND # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # self.page5 = QtWidgets.QFrame() self.page5.setObjectName("dark") self.stackWidget.addWidget(self.page5) self.page5MainLayout = QtWidgets.QVBoxLayout(self.page5) #label pageFiveLabel = QtWidgets.QLabel( "Skin Weights Found For These Meshes:") self.page5MainLayout.addWidget(pageFiveLabel) font = QtGui.QFont() font.setPointSize(12) font.setBold(True) pageFiveLabel.setFont(font) #columnLayout self.page5ColumnLayout = QtWidgets.QHBoxLayout() self.page5MainLayout.addLayout(self.page5ColumnLayout) #left column has list widget of meshes self.page5MeshList = QtWidgets.QListWidget() self.page5ColumnLayout.addWidget(self.page5MeshList) self.page5MeshList.setSelectionMode( QtWidgets.QAbstractItemView.ExtendedSelection) self.page5MeshList.setMinimumWidth(250) self.page5MeshList.setMaximumWidth(250) #right column has import method, and import/do not import buttons self.page5VerticalLayout = QtWidgets.QVBoxLayout() self.page5ColumnLayout.addLayout(self.page5VerticalLayout) layout = QtWidgets.QHBoxLayout() self.page5VerticalLayout.addLayout(layout) label = QtWidgets.QLabel("Import Method: ") label.setStyleSheet("background: transparent;") layout.addWidget(label) layout.setSpacing(10) label.setMinimumWidth(130) label.setMaximumWidth(130) self.page5ImportOptions = QtWidgets.QComboBox() self.page5ImportOptions.addItem("Vertex Order") self.page5ImportOptions.addItem("World Position") self.page5ImportOptions.addItem("Local Position") self.page5ImportOptions.addItem("UV Position") layout.addWidget(self.page5ImportOptions) self.page5ImportOptions.setMinimumWidth(155) self.page5ImportOptions.setMaximumWidth(155) self.page5VerticalLayout.addSpacerItem( QtWidgets.QSpacerItem(0, 200, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed)) self.page5ImportWeights = QtWidgets.QPushButton("Import Weights") self.page5ImportWeights.setMinimumHeight(50) self.page5ImportWeights.setFont(font) self.page5VerticalLayout.addWidget(self.page5ImportWeights) self.page5ImportWeights.clicked.connect(partial(self.importWeights)) self.page5ImportWeights.setObjectName("blueButton") self.page5IgnoreWeights = QtWidgets.QPushButton("Skip") self.page5IgnoreWeights.setMinimumHeight(50) self.page5IgnoreWeights.setFont(font) self.page5VerticalLayout.addWidget(self.page5IgnoreWeights) self.page5IgnoreWeights.clicked.connect(partial(self.skipWeightImport)) self.page5IgnoreWeights.setObjectName("blueButton")
def createUI(self): """ Builds the UI, listing options for choosing a project and showing all assets belonging to that project for edit or add. """ # fonts font = QtGui.QFont() font.setPointSize(12) font.setBold(True) fontSmall = QtGui.QFont() fontSmall.setPointSize(9) fontSmall.setBold(True) # load stylesheet styleSheetFile = utils.returnNicePath(self.toolsPath, "Core/Scripts/Interfaces/StyleSheets/mainScheme.qss") f = open(styleSheetFile, "r") self.style = f.read() f.close() self.setStyleSheet(self.style) # size policies mainSizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) # ======================================================================= # #create the main widget # ======================================================================= self.mainWidget = QtWidgets.QWidget() self.setCentralWidget(self.mainWidget) # set qt object name self.setObjectName(windowObject) if self.edit: self.setWindowTitle(windowTitle) if self.add: self.setWindowTitle("Add Rig For Animation") self.setAttribute(QtCore.Qt.WA_DeleteOnClose) # create the mainLayout self.layout = QtWidgets.QVBoxLayout(self.mainWidget) self.resize(400, 400) self.setSizePolicy(mainSizePolicy) self.setMinimumSize(QtCore.QSize(400, 400)) self.setMaximumSize(QtCore.QSize(400, 400)) # create the QFrame self.frame = QtWidgets.QFrame() self.layout.addWidget(self.frame) self.widgetLayout = QtWidgets.QHBoxLayout(self.frame) self.frame.setObjectName("mid") # ======================================================================= # #create two VBox Layouts to create 2 columns # ======================================================================= self.leftColumn = QtWidgets.QVBoxLayout() self.widgetLayout.addLayout(self.leftColumn) self.rightColumn = QtWidgets.QVBoxLayout() self.widgetLayout.addLayout(self.rightColumn) # ======================================================================= # #left column : project comboBox, group comboBox, listWidget of characters # ======================================================================= self.projectMenu = QtWidgets.QComboBox() self.leftColumn.addWidget(self.projectMenu) self.projectMenu.setMinimumSize(150, 30) self.projectMenu.setMaximumSize(150, 30) self.projectMenu.currentIndexChanged.connect(self.populateGroups) self.groupMenu = QtWidgets.QComboBox() self.leftColumn.addWidget(self.groupMenu) self.groupMenu.setMinimumSize(150, 30) self.groupMenu.setMaximumSize(150, 30) self.groupMenu.currentIndexChanged.connect(self.populateCharacters) self.characterList = QtWidgets.QListWidget() self.leftColumn.addWidget(self.characterList) self.characterList.setMinimumSize(150, 200) self.characterList.setMaximumSize(150, 200) self.characterList.itemClicked.connect(partial(self.populateIcon)) self.populateProjects() # ======================================================================= # #right column: icon frame, edit button/add button, close button # ======================================================================= self.characterIcon = QtWidgets.QLabel() self.characterIcon.setMinimumSize(200, 200) self.characterIcon.setMaximumSize(200, 200) self.rightColumn.addWidget(self.characterIcon) # default image self.defaultPixMap = QtGui.QPixmap(utils.returnNicePath(self.iconsPath, "System/noCharacter.png")) self.characterIcon.setPixmap(self.defaultPixMap) # if edit: if self.edit: self.editButton = QtWidgets.QPushButton("Edit Selected") self.editButton.setFont(font) self.rightColumn.addWidget(self.editButton) self.editButton.setMinimumSize(200, 40) self.editButton.setMaximumSize(200, 40) self.editButton.clicked.connect(partial(self.editSelected)) self.editButton.setObjectName("blueButton") # if add: if self.add: self.addButton = QtWidgets.QPushButton("Add Selected") self.addButton.setFont(font) self.rightColumn.addWidget(self.addButton) self.addButton.setMinimumSize(200, 40) self.addButton.setMaximumSize(200, 40) self.addButton.clicked.connect(partial(self.addSelected)) self.addButton.setObjectName("blueButton") self.closeButton = QtWidgets.QPushButton("Close") self.closeButton.setFont(font) self.rightColumn.addWidget(self.closeButton) self.closeButton.setMinimumSize(200, 40) self.closeButton.setMaximumSize(200, 40) self.closeButton.clicked.connect(partial(self.closeUI)) self.closeButton.setObjectName("blueButton")
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 __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)
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 __init__(self, moduleInst, rigUiInst, parent = None): super(ART_SetMirrorModule_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.modInst = moduleInst self.rigUiInst = rigUiInst #load stylesheet styleSheetFile = utils.returnNicePath(self.toolsPath, "Core/Scripts/Interfaces/StyleSheets/mainScheme.qss") f = open(styleSheetFile, "r") style = f.read() f.close() self.setStyleSheet(style) #size policies mainSizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) #create the main widget self.mainWidget = QtWidgets.QWidget() self.setCentralWidget(self.mainWidget) #set qt object name self.setObjectName(windowObject) self.setWindowTitle(windowTitle) #create the mainLayout for the rig creator UI self.mainLayout = QtWidgets.QVBoxLayout(self.mainWidget) self.mainLayout.setContentsMargins(0, 0, 0, 0) self.setSizePolicy(mainSizePolicy) self.setMinimumSize(QtCore.QSize( 250, 200 )) self.setMaximumSize(QtCore.QSize( 250, 200 )) #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) label = QtWidgets.QLabel("Choose Mirror Module:") self.widgetLayout.addWidget(label) font = QtGui.QFont() font.setBold(True) self.moduleList = QtWidgets.QListWidget() self.moduleList.addItem("None") self.widgetLayout.addWidget(self.moduleList) #add items to comboBox networkNode = self.modInst.returnNetworkNode modules = utils.returnRigModules() for mod in modules: modName = cmds.getAttr(mod + ".moduleName") modType = cmds.getAttr(mod + ".moduleType") if modType == cmds.getAttr(networkNode + ".moduleType"): if mod != networkNode: self.moduleList.addItem(modName) self.moduleList.setCurrentRow(0) 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(230, 40)) self.updateBtn.setMaximumSize(QtCore.QSize(230, 40)) self.updateBtn.setSizePolicy(mainSizePolicy) font = QtGui.QFont() font.setPointSize(12) self.updateBtn.setFont(font) self.updateBtn.setObjectName("blueButton") #hookup signal/slot on create button self.updateBtn.clicked.connect(self.setMirrorModule)
def completeBuild(self): """ Locks down all network nodes, saves the scene, and alerts user that the rig build is complete. """ self.infoText.append(" \n") self.infoText.append("Cleaning Up..") # go through each module instance, and lock down the nodes cmds.select("rig_grp", hi=True) rigNodes = cmds.ls(sl=True) numNodes = len(rigNodes) self.currentTask.setMaximum(numNodes) for node in rigNodes: curVal = self.currentTask.value() try: cmds.lockNode(node, lock=True) self.currentTask.setValue(curVal + 1) except: pass # save scene cmds.file(save=True, type="mayaAscii") # iterate total progress self.totalProgress.setValue(12) # add build info font = QtGui.QFont() font.setPointSize(20) font.setBold(True) self.infoText.setFont(font) self.infoText.setTextColor(QtGui.QColor(0, 255, 18)) self.infoText.append("\n\nPUBLISH COMPLETE!") font.setPointSize(8) font.setBold(False) self.infoText.setTextColor(QtGui.QColor(255, 255, 255)) self.infoText.setFont(font) # get file name fileName = cmds.file(q=True, sceneName=True) iconPath = cmds.getAttr("ART_RIG_ROOT.iconPath") self.infoText.append("Assets Created: ") self.infoText.append(" " + fileName) self.infoText.append(" " + iconPath) self.infoText.append(str(self.warnings) + " warnings") self.infoText.append(str(self.errors) + " errors") # tell user build is complete msgBox = QtWidgets.QMessageBox() msgBox.setIcon(QtWidgets.QMessageBox.Information) msgBox.setText("Rig Build Complete!") msgBox.addButton("New Scene", QtWidgets.QMessageBox.YesRole) msgBox.addButton("Edit Rig", QtWidgets.QMessageBox.NoRole) ret = msgBox.exec_() if ret == 1: import ART_RigCreatorUI as ART_RigCreatorUI reload(ART_RigCreatorUI) ART_RigCreatorUI.createUI() cmds.refresh(force=True) cmds.dockControl("pyArtRigCreatorDock", e=True, r=True) else: # if the rigCreatorUI exists delete UI if cmds.dockControl("pyArtRigCreatorDock", q=True, exists=True): cmds.deleteUI("pyArtRigCreatorUi") cmds.deleteUI("pyArtRigCreatorDock", control=True) cmds.file(new=True)
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 buildSettingsUi(self): #fonts self.font = QtGui.QFont() self.font.setPointSize(10) self.font.setBold(False) self.fontSmall = QtGui.QFont() self.fontSmall.setPointSize(9) self.fontSmall.setBold(False) self.titleFont = QtGui.QFont() self.titleFont.setPointSize(40) self.titleFont.setBold(True) #images frameBackground = os.path.normcase( os.path.join(self.iconsPath, "System/field_background.png")) if frameBackground.partition("\\")[2] != "": frameBackground = frameBackground.replace("\\", "/") imageBkgrd = os.path.normcase( os.path.join(self.iconsPath, "System/toolbar_background.png")) if imageBkgrd.partition("\\")[2] != "": imageBkgrd = imageBkgrd.replace("\\", "/") imageBtnBkrd = os.path.normcase( os.path.join(self.iconsPath, "System/blue_field_background.png")) if imageBtnBkrd.partition("\\")[2] != "": imageBtnBkrd = imageBtnBkrd.replace("\\", "/") #load stylesheet styleSheetFile = utils.returnNicePath( self.toolsPath, "Core/Scripts/Interfaces/StyleSheets/mainScheme.qss") f = open(styleSheetFile, "r") self.style = f.read() f.close() self.setStyleSheet(self.style) #size policies mainSizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) #create the main widget self.mainWidget = QtWidgets.QWidget() self.mainWidget.setStyleSheet(self.style) self.mainWidget.setStyleSheet( "background-color: rgb(0, 0, 0);, color: rgb(0,0,0);") self.setCentralWidget(self.mainWidget) #set qt object name self.setObjectName(windowObject) self.setWindowTitle(windowTitle) self.setAttribute(QtCore.Qt.WA_DeleteOnClose) #create the mainLayout for the rig creator UI self.layout = QtWidgets.QVBoxLayout(self.mainWidget) self.resize(600, 300) self.setSizePolicy(mainSizePolicy) self.setMinimumSize(QtCore.QSize(600, 300)) self.setMaximumSize(QtCore.QSize(600, 300)) #create the QFrame self.frame = QtWidgets.QFrame() self.layout.addWidget(self.frame) self.widgetLayout = QtWidgets.QVBoxLayout(self.frame) #info page styling self.frame.setStyleSheet("background-image: url(" + imageBkgrd + ");") #detailed information self.infoText = QtWidgets.QTextEdit() self.infoText.acceptRichText() self.infoText.setStyleSheet( "background-color: rgb(120,120,120); background-image: url(" + frameBackground + ");") self.widgetLayout.addWidget(self.infoText) self.infoText.setMinimumSize(QtCore.QSize(550, 170)) self.infoText.setMaximumSize(QtCore.QSize(550, 170)) self.infoText.setReadOnly(True) self.infoText.setAutoFormatting(QtWidgets.QTextEdit.AutoBulletList) self.infoText.setLineWrapMode(QtWidgets.QTextEdit.WidgetWidth) #progress bar self.progressBar = QtWidgets.QProgressBar() self.progressBar.setStyleSheet(self.style) self.progressBar.setMinimumSize(QtCore.QSize(550, 25)) self.progressBar.setMaximumSize(QtCore.QSize(550, 25)) self.widgetLayout.addWidget(self.progressBar) #button bar self.buttonLayout = QtWidgets.QHBoxLayout() self.widgetLayout.addLayout(self.buttonLayout) self.cancelButton = QtWidgets.QPushButton("Close") self.buttonLayout.addWidget(self.cancelButton) self.cancelButton.setStyleSheet(self.style) self.cancelButton.setObjectName("blueButton") self.cancelButton.clicked.connect(self.cancel) self.updateButton = QtWidgets.QPushButton("Update") self.buttonLayout.addWidget(self.updateButton) self.updateButton.setStyleSheet(self.style) self.updateButton.setObjectName("blueButton") self.updateButton.clicked.connect(self.downloadUpdates) if self.credentials != None: self.getInfo()
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 skeletonSettings_UI(self, name): """ This is the UI for the module that has all of the configuration settings. :param name: user given name of module (prefix + base_name + suffix) :param width: width of the skeleton settings groupBox. 335 usually :param height: height of the skeleton settings groupBox. :param checkable: Whether or not the groupBox can be collapsed. Build the groupBox that contains all of the settings for this module. Parent the groupBox into the main skeletonSettingsUI layout. Lastly, call on updateSettingsUI to populate the UI based off of the network node values. .. image:: /images/skeletonSettings.png """ # width, height, checkable networkNode = self.returnNetworkNode font = QtGui.QFont() font.setPointSize(8) headerFont = QtGui.QFont() headerFont.setPointSize(8) headerFont.setBold(True) # groupbox all modules get ART_RigModule.skeletonSettings_UI(self, name, 335, 288, True) # STANDARD BUTTONS # create a VBoxLayout to add to our Groupbox and then add a QFrame for our signal/slot self.mainLayout = QtWidgets.QVBoxLayout(self.groupBox) self.frame = QtWidgets.QFrame(self.groupBox) self.mainLayout.addWidget(self.frame) self.frame.setSizePolicy(QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)) self.frame.setMinimumSize(QtCore.QSize(320, 270)) self.frame.setMaximumSize(QtCore.QSize(320, 270)) # create layout that is a child of the frame self.layout = QtWidgets.QVBoxLayout(self.frame) # mirror module self.mirrorModLayout = QtWidgets.QHBoxLayout() self.layout.addLayout(self.mirrorModLayout) self.mirrorModuleLabel = QtWidgets.QLabel("Mirror Module: ") self.mirrorModuleLabel.setFont(font) self.mirrorModLayout.addWidget(self.mirrorModuleLabel) mirror = cmds.getAttr(networkNode + ".mirrorModule") if mirror == "": mirror = "None" self.mirrorMod = QtWidgets.QLabel(mirror) self.mirrorMod.setFont(font) self.mirrorMod.setAlignment(QtCore.Qt.AlignHCenter) self.mirrorModLayout.addWidget(self.mirrorMod) # current parent self.currentParentMod = QtWidgets.QHBoxLayout() self.layout.addLayout(self.currentParentMod) self.currentParentLabel = QtWidgets.QLabel("Current Parent: ") self.currentParentLabel.setFont(font) self.currentParentMod.addWidget(self.currentParentLabel) parent = cmds.getAttr(networkNode + ".parentModuleBone") self.currentParent = QtWidgets.QLabel(parent) self.currentParent.setFont(font) self.currentParent.setAlignment(QtCore.Qt.AlignHCenter) self.currentParentMod.addWidget(self.currentParent) # button layout for name/parent self.buttonLayout = QtWidgets.QHBoxLayout() self.layout.addLayout(self.buttonLayout) self.changeNameBtn = QtWidgets.QPushButton("Change Name") self.changeParentBtn = QtWidgets.QPushButton("Change Parent") self.mirrorModuleBtn = QtWidgets.QPushButton("Mirror Module") self.buttonLayout.addWidget(self.changeNameBtn) self.buttonLayout.addWidget(self.changeParentBtn) self.buttonLayout.addWidget(self.mirrorModuleBtn) self.changeNameBtn.setObjectName("blueButton") self.changeParentBtn.setObjectName("blueButton") self.mirrorModuleBtn.setObjectName("blueButton") # button signal/slots self.changeNameBtn.clicked.connect(partial(self.changeModuleName, baseName, self, self.rigUiInst)) self.changeParentBtn.clicked.connect(partial(self.changeModuleParent, self, self.rigUiInst)) self.mirrorModuleBtn.clicked.connect(partial(self.setMirrorModule, self, self.rigUiInst)) # bake offsets button self.bakeToolsLayout = QtWidgets.QHBoxLayout() self.layout.addLayout(self.bakeToolsLayout) # Bake OFfsets self.bakeOffsetsBtn = QtWidgets.QPushButton("Bake Offsets") self.bakeOffsetsBtn.setFont(headerFont) self.bakeToolsLayout.addWidget(self.bakeOffsetsBtn) self.bakeOffsetsBtn.clicked.connect(self.bakeOffsets) self.bakeOffsetsBtn.setToolTip("Bake the offset mover values up to the global movers to get them in sync") self.bakeOffsetsBtn.setObjectName("blueButton") # Rig Settings spacerItem = QtWidgets.QSpacerItem(20, 10, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) self.layout.addItem(spacerItem) self.hasDynamics = QtWidgets.QCheckBox("Has Dynamics") self.layout.addWidget(self.hasDynamics) self.hasDynamics.setChecked(False) # self.hasDynamics.clicked.connect(partial(self.applyModuleChanges, self)) spacerItem = QtWidgets.QSpacerItem(20, 30, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) self.layout.addItem(spacerItem) # Number of joints in chain self.numJointsLayout = QtWidgets.QHBoxLayout() self.layout.addLayout(self.numJointsLayout) self.numJointsLabel = QtWidgets.QLabel("Number of Joints in Chain: ") self.numJointsLabel.setSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Preferred) self.numJointsLabel.setMinimumSize(QtCore.QSize(200, 20)) self.numJointsLabel.setMaximumSize(QtCore.QSize(200, 20)) self.numJointsLayout.addWidget((self.numJointsLabel)) self.numJoints = QtWidgets.QSpinBox() self.numJoints.setMaximum(99) self.numJoints.setMinimum(2) self.numJoints.setMinimumSize(QtCore.QSize(100, 20)) self.numJoints.setMaximumSize(QtCore.QSize(100, 20)) self.numJoints.setValue(3) self.numJoints.setSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) self.numJointsLayout.addWidget(self.numJoints) # rebuild button spacerItem = QtWidgets.QSpacerItem(20, 10, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed) self.layout.addItem(spacerItem) self.applyButton = QtWidgets.QPushButton("Apply Changes") self.layout.addWidget(self.applyButton) self.applyButton.setFont(headerFont) self.applyButton.setMinimumSize(QtCore.QSize(300, 40)) self.applyButton.setMaximumSize(QtCore.QSize(300, 40)) self.applyButton.setSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) self.applyButton.setEnabled(False) self.applyButton.clicked.connect(partial(self.applyModuleChanges, self)) # signal slot for groupbox checkbox QtCore.QObject.connect(self.groupBox, QtCore.SIGNAL("toggled(bool)"), self.frame.setVisible) self.groupBox.setChecked(False) # add custom skeletonUI settings name, parent, rig types to install, mirror module, etc. # add to the rig cretor UI's module settings layout VBoxLayout self.rigUiInst.moduleSettingsLayout.addWidget(self.groupBox)
def exportSkinWeights_populate(self): """ Populate the interface with an entry for each mesh the user has selected. This entry includes the mesh name, an QLineEdit to specify a file name for the .weight file, and a checkbox as to whether or not the user wants to export weights for that mesh. """ # get current selection selection = cmds.ls(sl=True) if len(selection) > 0: # Create headers font = QtGui.QFont() font.setPointSize(12) font.setBold(True) headerLayout = QtWidgets.QHBoxLayout() self.exportSkinWeights_VLayout.addLayout(headerLayout) headerExport = QtWidgets.QLabel(" ") headerLayout.addWidget(headerExport) headerExport.setStyleSheet("background: transparent;") headerGeo = QtWidgets.QLabel("Mesh") headerGeo.setMinimumSize(QtCore.QSize(180, 20)) headerGeo.setMaximumSize(QtCore.QSize(180, 20)) headerLayout.addWidget(headerGeo) headerGeo.setFont(font) headerGeo.setStyleSheet("background: transparent;") headerFileName = QtWidgets.QLabel("FileName") headerLayout.addWidget(headerFileName) headerFileName.setMinimumSize(QtCore.QSize(180, 20)) headerFileName.setMaximumSize(QtCore.QSize(180, 20)) headerFileName.setFont(font) headerFileName.setStyleSheet("background: transparent;") # loop through selection, checking selection is valid and has skinCluster for each in selection: # get dagPath of each dagPath = cmds.ls(each, long=True)[0] skinCluster = riggingUtils.findRelatedSkinCluster(dagPath) if skinCluster is not None: # create HBoxLayout layout = QtWidgets.QHBoxLayout() layout.setSpacing(10) self.exportSkinWeights_VLayout.addLayout(layout) # create checkbox checkBox = QtWidgets.QCheckBox() layout.addWidget(checkBox) checkBox.setChecked(True) # create non editable line edit niceName = each.rpartition("|")[2] geoName = QtWidgets.QLabel(niceName + " : ") geoName.setProperty("dag", dagPath) layout.addWidget(geoName) geoName.setMinimumSize(QtCore.QSize(180, 30)) geoName.setMaximumSize(QtCore.QSize(180, 30)) # create editable line edit if cmds.objExists(dagPath + ".weightFile"): path = cmds.getAttr(dagPath + ".weightFile") niceName = path.rpartition("/")[2].partition(".")[0] dirPath = path.rpartition("/")[0] dirPath = utils.returnFriendlyPath(dirPath) self.exportSkinWeights_lineEdit.setText(dirPath) skinFileName = QtWidgets.QLineEdit(niceName) layout.addWidget(skinFileName) skinFileName.setMinimumSize(QtCore.QSize(170, 30)) skinFileName.setMaximumSize(QtCore.QSize(170, 30)) # add spacer self.exportSkinWeights_scrollContents.setLayout( self.exportSkinWeights_VLayout) else: label = QtWidgets.QLabel( "No Geometry Selected For Export. Select Geometry and Relaunch." ) label.setAlignment(QtCore.Qt.AlignCenter) self.exportSkinWeights_VLayout.addWidget(label)
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 buildSettingsUi(self): #fonts self.font = QtGui.QFont() self.font.setPointSize(10) self.font.setBold(False) self.fontSmall = QtGui.QFont() self.fontSmall.setPointSize(9) self.fontSmall.setBold(False) self.titleFont = QtGui.QFont() self.titleFont.setPointSize(40) self.titleFont.setBold(True) #load stylesheet styleSheetFile = utils.returnNicePath( self.toolsPath, "Core/Scripts/Interfaces/StyleSheets/mainScheme.qss") f = open(styleSheetFile, "r") self.style = f.read() f.close() self.setStyleSheet(self.style) #size policies mainSizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) #create the main widget self.mainWidget = QtWidgets.QWidget() self.mainWidget.setStyleSheet(self.style) self.mainWidget.setStyleSheet( "background-color: rgb(0, 0, 0);, color: rgb(0,0,0);") self.setCentralWidget(self.mainWidget) #set qt object name self.setObjectName(windowObject) self.setWindowTitle(windowTitle) self.setAttribute(QtCore.Qt.WA_DeleteOnClose) #create the mainLayout for the rig creator UI self.layout = QtWidgets.QVBoxLayout(self.mainWidget) self.resize(300, 600) self.setSizePolicy(mainSizePolicy) self.setMinimumSize(QtCore.QSize(300, 600)) self.setMaximumSize(QtCore.QSize(300, 600)) #create the QFrame self.frame = QtWidgets.QFrame() self.frame.setObjectName("epic") self.layout.addWidget(self.frame) self.widgetLayout = QtWidgets.QVBoxLayout(self.frame) #Title of Issue self.titleLayout = QtWidgets.QHBoxLayout() self.widgetLayout.addLayout(self.titleLayout) titleLabel = QtWidgets.QLabel("Title: ") self.titleLayout.addWidget(titleLabel) self.issueTitle = QtWidgets.QLineEdit() self.issueTitle.setPlaceholderText("Title of Issue") self.titleLayout.addWidget(self.issueTitle) self.issueTitle.setMinimumWidth(200) self.issueTitle.setMaximumWidth(200) #Type of Issue (from labels) self.labelLayout = QtWidgets.QHBoxLayout() self.widgetLayout.addLayout(self.labelLayout) typeLabel = QtWidgets.QLabel("Issue Type: ") self.labelLayout.addWidget(typeLabel) self.issueType = QtWidgets.QComboBox() self.labelLayout.addWidget(self.issueType) self.issueType.setMinimumWidth(200) self.issueType.setMaximumWidth(200) #Information summaryLabel = QtWidgets.QLabel("Summary: ") self.widgetLayout.addWidget(summaryLabel) infoText = QtWidgets.QTextEdit() infoText.setReadOnly(True) infoText.setEnabled(False) self.widgetLayout.addWidget(infoText) infoText.setMinimumHeight(60) infoText.setMaximumHeight(60) infoText.setTextColor(QtGui.QColor(120, 120, 120)) infoText.append( "(Please include any errors and stacktrace if applicable. Also include any reproduction steps if possible.)" ) self.issueInfo = QtWidgets.QTextEdit() self.widgetLayout.addWidget(self.issueInfo) self.issueInfo.setObjectName("light") #Create Issue self.createIssueBtn = QtWidgets.QPushButton("Create Issue") self.createIssueBtn.setObjectName("blueButton") self.widgetLayout.addWidget(self.createIssueBtn) self.createIssueBtn.clicked.connect(self.createIssue) self.credentials = git.getGitCreds() if self.credentials == None: git.gitCredsUI(self) self.credentials = git.getGitCreds() self.getLabels()
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 importSkinWeights_populate(self): """ Populate the interface with an entry for each piece of selected geometry. Each entry will have the geometry name and allow the user to point to the geometry's .weight file. """ # get current selection selection = cmds.ls(sl=True) if len(selection) > 0: # Create headers font = QtGui.QFont() font.setPointSize(12) font.setBold(True) headerLayout = QtWidgets.QHBoxLayout() self.importSkinWeights_VLayout.addLayout(headerLayout) headerExport = QtWidgets.QLabel(" ") headerExport.setStyleSheet("background: transparent;") headerLayout.addWidget(headerExport) headerGeo = QtWidgets.QLabel("Mesh") headerGeo.setStyleSheet("background: transparent;") headerGeo.setMinimumSize(QtCore.QSize(180, 20)) headerGeo.setMaximumSize(QtCore.QSize(180, 20)) headerLayout.addWidget(headerGeo) headerGeo.setFont(font) headerFileName = QtWidgets.QLabel("Weight File") headerFileName.setStyleSheet("background: transparent;") headerLayout.addWidget(headerFileName) headerFileName.setMinimumSize(QtCore.QSize(180, 20)) headerFileName.setMaximumSize(QtCore.QSize(180, 20)) headerFileName.setFont(font) # get a list of weight files weightFiles = [] for root, subFolders, files in os.walk(self.toolsPath): for file in files: if file.rpartition(".")[2] == "weights": fullPath = utils.returnFriendlyPath(os.path.join(root, file)) weightFiles.append(fullPath) print weightFiles # loop through selection, checking selection is valid and has skinCluster for each in selection: try: # get dagPath and shape and create a nice display name dagPath = cmds.ls(each, long=True)[0] shapeNode = cmds.listRelatives(dagPath, children=True) nicename = each.rpartition("|")[2] except Exception, e: traceback.format_exc() try: if cmds.nodeType(dagPath + "|" + shapeNode[0]) == "mesh": # create HBoxLayout layout = QtWidgets.QHBoxLayout() layout.setSpacing(10) self.importSkinWeights_VLayout.addLayout(layout) # create checkbox checkBox = QtWidgets.QCheckBox() layout.addWidget(checkBox) checkBox.setChecked(True) # create non editable line edit geoName = QtWidgets.QLabel(nicename + " : ") geoName.setStyleSheet("background: transparent;") geoName.setProperty("dag", dagPath) layout.addWidget(geoName) geoName.setMinimumSize(QtCore.QSize(100, 30)) geoName.setMaximumSize(QtCore.QSize(100, 30)) # create editable line edit skinFileName = QtWidgets.QLineEdit() layout.addWidget(skinFileName) skinFileName.setMinimumSize(QtCore.QSize(205, 30)) skinFileName.setMaximumSize(QtCore.QSize(205, 30)) # try to find a matching weight file for file in weightFiles: compareString = file.rpartition("/")[2].partition(".")[0] if nicename.lower() == compareString.lower(): skinFileName.setText(file) # check if geometry has weights file associated already if cmds.objExists(dagPath + ".weightFile"): path = cmds.getAttr(dagPath + ".weightFile") path = utils.returnFriendlyPath(path) if os.path.exists(path): skinFileName.setText(path) # browse button browseBtn = QtWidgets.QPushButton() layout.addWidget(browseBtn) browseBtn.setMinimumSize(35, 35) browseBtn.setMaximumSize(35, 35) icon = QtGui.QIcon(os.path.join(self.iconsPath, "System/fileBrowse.png")) browseBtn.setIconSize(QtCore.QSize(30, 30)) browseBtn.setIcon(icon) browseBtn.clicked.connect(partial(self.importSkinWeights_fileBrowse, skinFileName)) except Exception, e: print traceback.format_exc()
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 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 buildSettingsUi(self): #fonts font = QtGui.QFont() font.setPointSize(10) font.setBold(True) fontSmall = QtGui.QFont() fontSmall.setPointSize(9) fontSmall.setBold(True) #images frameBackground = os.path.normcase( os.path.join(self.iconsPath, "System/field_background.png")) if frameBackground.partition("\\")[2] != "": frameBackground = frameBackground.replace("\\", "/") imageBkgrd = os.path.normcase( os.path.join(self.iconsPath, "System/toolbar_background.png")) if imageBkgrd.partition("\\")[2] != "": imageBkgrd = imageBkgrd.replace("\\", "/") imageBtnBkrd = os.path.normcase( os.path.join(self.iconsPath, "System/blue_field_background.png")) if imageBtnBkrd.partition("\\")[2] != "": imageBtnBkrd = imageBtnBkrd.replace("\\", "/") #size policies mainSizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) #create the main widget self.mainWidget = QtWidgets.QWidget() self.mainWidget.setStyleSheet( "background-color: rgb(0, 0, 0);, color: rgb(0,0,0);") self.setCentralWidget(self.mainWidget) #set qt object name self.setObjectName(windowObject) self.setWindowTitle(windowTitle) self.setAttribute(QtCore.Qt.WA_DeleteOnClose) #create the mainLayout for the rig creator UI self.layout = QtWidgets.QVBoxLayout(self.mainWidget) self.resize(600, 260) self.setSizePolicy(mainSizePolicy) self.setMinimumSize(QtCore.QSize(600, 260)) self.setMaximumSize(QtCore.QSize(600, 260)) #create the QFrame self.frame = QtWidgets.QFrame() self.layout.addWidget(self.frame) self.widgetLayout = QtWidgets.QVBoxLayout(self.frame) #info page styling self.frame.setStyleSheet("background-image: url(" + imageBkgrd + ");") #MayaTools/Core : Sccipts, icons, jointmover, etc #MayaTools/Projects: actual project files (animation rigs, thumbnails, poses, etc) #location self.locationLayout = QtWidgets.QHBoxLayout() self.widgetLayout.addLayout(self.locationLayout) #location -> label label = QtWidgets.QLabel("Tools Location: ") self.locationLayout.addWidget(label) label.setFont(font) label.setMinimumWidth(150) #location -> line edit path = utils.returnFriendlyPath(self.toolsPath) self.locationPath = QtWidgets.QLineEdit(path) self.locationLayout.addWidget(self.locationPath) self.locationPath.setStyleSheet( "background-image: url(" + frameBackground + "); background-color: rgb(25,175,255);") self.locationPath.setMinimumHeight(35) #location -> browse button self.locationBrowse = QtWidgets.QPushButton() self.locationLayout.addWidget(self.locationBrowse) self.locationBrowse.setMinimumSize(35, 35) self.locationBrowse.setMaximumSize(35, 35) btnBackground = utils.returnNicePath(self.iconsPath, "System/fileBrowse.png") self.locationBrowse.setStyleSheet("background-image: url(" + btnBackground + ");") self.locationBrowse.clicked.connect( partial(self.browse, self.locationPath)) #scripts folder self.scriptsLayout = QtWidgets.QHBoxLayout() self.widgetLayout.addLayout(self.scriptsLayout) #scripts -> label label = QtWidgets.QLabel("Scripts: ") self.scriptsLayout.addWidget(label) label.setFont(fontSmall) label.setMinimumWidth(150) #scripts -> line edit path = utils.returnFriendlyPath(self.scriptPath) self.scriptsPath = QtWidgets.QLineEdit(path) self.scriptsLayout.addWidget(self.scriptsPath) self.scriptsPath.setStyleSheet("background-image: url(" + frameBackground + "); background-color: rgb(25,175,255);") self.scriptsPath.setMinimumHeight(35) #scripts -> browse button self.scriptsBrowse = QtWidgets.QPushButton() self.scriptsLayout.addWidget(self.scriptsBrowse) self.scriptsBrowse.setMinimumSize(35, 35) self.scriptsBrowse.setMaximumSize(35, 35) self.scriptsBrowse.setStyleSheet("background-image: url(" + btnBackground + ");") self.scriptsBrowse.clicked.connect( partial(self.browse, self.scriptsPath)) #icons folder self.iconsLayout = QtWidgets.QHBoxLayout() self.widgetLayout.addLayout(self.iconsLayout) #icons -> label label = QtWidgets.QLabel("Icons: ") self.iconsLayout.addWidget(label) label.setFont(fontSmall) label.setMinimumWidth(150) #icons -> line edit path = utils.returnFriendlyPath(self.iconsPath) self.iconPath = QtWidgets.QLineEdit(path) self.iconsLayout.addWidget(self.iconPath) self.iconPath.setStyleSheet("background-image: url(" + frameBackground + "); background-color: rgb(25,175,255);") self.iconPath.setMinimumHeight(35) #icons -> browse button self.iconsBrowse = QtWidgets.QPushButton() self.iconsLayout.addWidget(self.iconsBrowse) self.iconsBrowse.setMinimumSize(35, 35) self.iconsBrowse.setMaximumSize(35, 35) self.iconsBrowse.setStyleSheet("background-image: url(" + btnBackground + ");") self.iconsBrowse.clicked.connect(partial(self.browse, self.iconsPath)) #projects folder self.projectsLayout = QtWidgets.QHBoxLayout() self.widgetLayout.addLayout(self.projectsLayout) #projects -> label label = QtWidgets.QLabel("Projects: ") self.projectsLayout.addWidget(label) label.setFont(fontSmall) label.setMinimumWidth(150) #projects -> line edit path = utils.returnFriendlyPath(self.projPath) self.projectsPath = QtWidgets.QLineEdit(path) self.projectsLayout.addWidget(self.projectsPath) self.projectsPath.setStyleSheet( "background-image: url(" + frameBackground + "); background-color: rgb(25,175,255);") self.projectsPath.setMinimumHeight(35) #projects -> browse button self.projectsBrowse = QtWidgets.QPushButton() self.projectsLayout.addWidget(self.projectsBrowse) self.projectsBrowse.setMinimumSize(35, 35) self.projectsBrowse.setMaximumSize(35, 35) self.projectsBrowse.setStyleSheet("background-image: url(" + btnBackground + ");") self.projectsBrowse.clicked.connect( partial(self.browse, self.projectsPath)) #Save button self.saveChangesBtn = QtWidgets.QPushButton("Save Changes") self.widgetLayout.addWidget(self.saveChangesBtn) self.saveChangesBtn.setFont(font) self.saveChangesBtn.setMinimumHeight(35) self.saveChangesBtn.setStyleSheet( "background-image: url(" + imageBtnBkrd + ");background-color: rgb(25, 175, 255);") self.saveChangesBtn.clicked.connect(partial(self.saveSettings))
def __init__(self, currentParent, moduleInst, rigUiInst, parent=None): """ Instantiates the class, taking in current module information, and builds the interface. :param currentParent: The current module parent bone of this module. :param moduleInst: The instance in memory of the module whose name is to change. :param rigUiInst: The instance in memory of the Rig Creator UI from which this class was called. """ super(ART_ChangeModuleParent_UI, self).__init__(parent) # get the directory path of the tools settings = QtCore.QSettings("Epic Games", "ARTv2") self.toolsPath = settings.value("toolsPath") self.iconsPath = settings.value("iconPath") # create class variables self.currentParent = currentParent self.modInst = moduleInst self.rigUiInst = rigUiInst # load stylesheet styleSheetFile = utils.returnNicePath( self.toolsPath, "Core/Scripts/Interfaces/StyleSheets/mainScheme.qss") f = open(styleSheetFile, "r") style = f.read() f.close() self.setStyleSheet(style) # size policies mainSizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) # create the main widget self.mainWidget = QtWidgets.QWidget() self.setCentralWidget(self.mainWidget) # set qt object name self.setObjectName(windowObject) self.setWindowTitle(windowTitle) # create the mainLayout for the rig creator UI self.mainLayout = QtWidgets.QVBoxLayout(self.mainWidget) self.mainLayout.setContentsMargins(0, 0, 0, 0) self.setSizePolicy(mainSizePolicy) self.setMinimumSize(QtCore.QSize(250, 400)) self.setMaximumSize(QtCore.QSize(250, 400)) # create the background image self.frame = QtWidgets.QFrame() self.mainLayout.addWidget(self.frame) self.frame.setObjectName("mid") # create the layout for the widgets self.widgetLayout = QtWidgets.QVBoxLayout(self.frame) label = QtWidgets.QLabel("Choose New Parent:") font = QtGui.QFont() font.setBold(True) label.setFont(font) self.widgetLayout.addWidget(label) self.boneSearch = QtWidgets.QLineEdit() self.boneSearch.setPlaceholderText("Search..") self.boneSearch.textChanged.connect(self.searchList) self.widgetLayout.addWidget(self.boneSearch) self.boneList = QtWidgets.QListWidget() self.widgetLayout.addWidget(self.boneList) self.boneList.setMinimumHeight(200) # add items to comboBox bones = utils.getViableParents() # get our own bones modBones = self.modInst.returnCreatedJoints for bone in bones: if bone not in modBones: self.boneList.addItem(bone) if bone == "root": index = bones.index(bone) self.boneList.setCurrentRow(index) # update button self.updateBtn = QtWidgets.QPushButton("UPDATE") self.widgetLayout.addWidget(self.updateBtn) self.updateBtn.setMinimumSize(QtCore.QSize(230, 40)) self.updateBtn.setMaximumSize(QtCore.QSize(230, 40)) self.updateBtn.setSizePolicy(mainSizePolicy) font = QtGui.QFont() font.setPointSize(12) self.updateBtn.setFont(font) self.updateBtn.setObjectName("blueButton") # hookup signal/slot on create button self.updateBtn.clicked.connect(self.applyModuleParentChange) self.updateBtn.setFocus()
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()