diff options
| author | MobileMachine\jeremy <[email protected]> | 2017-06-06 22:59:03 -0400 |
|---|---|---|
| committer | MobileMachine\jeremy <[email protected]> | 2017-06-06 22:59:03 -0400 |
| commit | 24725fa8681f906ab44d80687c09fecc171a2896 (patch) | |
| tree | 312a601df29aca7f8db9f44082d96ebc7a679138 /Core/Scripts/Interfaces/ART_ModuleStatus.py | |
| parent | Initial commit (diff) | |
| download | artv2-24725fa8681f906ab44d80687c09fecc171a2896.tar.xz artv2-24725fa8681f906ab44d80687c09fecc171a2896.zip | |
Initial Submission
First submission of current state of ARTv2. Currently considered to be in Alpha. There are a couple of animation tools not implemented yet, and one module not implemented yet, as well as incomplete documentation.
Diffstat (limited to 'Core/Scripts/Interfaces/ART_ModuleStatus.py')
| -rw-r--r-- | Core/Scripts/Interfaces/ART_ModuleStatus.py | 156 |
1 files changed, 156 insertions, 0 deletions
diff --git a/Core/Scripts/Interfaces/ART_ModuleStatus.py b/Core/Scripts/Interfaces/ART_ModuleStatus.py new file mode 100644 index 0000000..0f305e7 --- /dev/null +++ b/Core/Scripts/Interfaces/ART_ModuleStatus.py @@ -0,0 +1,156 @@ +from ThirdParty.Qt import QtGui, QtCore, QtWidgets +import maya.cmds as cmds +import System.utils as utils + + +windowTitle = "Module Stats" +windowObject = "pyArtModStatusUi" + + + +class ART_ModStatusWin(QtWidgets.QMainWindow): + + def __init__(self, parent = None): + + + super(ART_ModStatusWin, 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") + + + #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) + + #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.setMinimumSize(QtCore.QSize(300, 400)) + self.setMaximumSize(QtCore.QSize(300, 600)) + self.resize(QtCore.QSize(300, 400)) + + + #create the background + self.frame = QtWidgets.QFrame() + self.frame.setObjectName("mid") + self.mainLayout.addWidget(self.frame) + + + #create the widget layout + self.widgetLayout = QtWidgets.QVBoxLayout(self.frame) + + #create the table widget + self.modTable = QtWidgets.QTableWidget() + self.modTable.setObjectName("mid") + self.widgetLayout.addWidget(self.modTable) + self.modTable.setColumnCount(3) + self.modTable.setHorizontalHeaderLabels(["Module", "Pinned", "Aiming"]) + self.modTable.setColumnWidth(0, 100) + self.modTable.setColumnWidth(1, 65) + self.modTable.setColumnWidth(2, 65) + + #populate the table widget + self.populateTable() + + + #add refresh button + self.refreshButton = QtWidgets.QPushButton("Refresh") + self.widgetLayout.addWidget(self.refreshButton) + self.refreshButton.setObjectName("blueButton") + self.refreshButton.clicked.connect(self.refresh) + + + self.show() + + # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # + # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # + # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # + # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # + # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # + # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # + def populateTable(self): + + pixmap = QtGui.QPixmap(20, 20) + pixmap.fill(QtGui.QColor(0, 255, 0)) + iconOn = QtGui.QIcon(pixmap) + + pixmapOff = QtGui.QPixmap(20, 20) + pixmapOff.fill(QtGui.QColor(255, 0, 0)) + iconOff = QtGui.QIcon(pixmapOff) + + modules = utils.returnRigModules() + self.modTable.setRowCount(100 + len(modules)) + counter = 0 + for module in modules: + + aimState = False + pinState = False + + #get module name + moduleName = cmds.getAttr(module + ".moduleName") + + if cmds.objExists(module + ".aimMode"): + aimState = cmds.getAttr(module + ".aimMode") + if cmds.objExists(module + ".pinned"): + pinState = cmds.getAttr(module + ".pinned") + + moduleItem = QtWidgets.QTableWidgetItem(moduleName) + self.modTable.setItem(counter, 0, moduleItem) + + if aimState: + lockItem = QtWidgets.QTableWidgetItem(iconOn, "") + else: + lockItem = QtWidgets.QTableWidgetItem(iconOff, "") + + self.modTable.setItem(counter, 2, lockItem) + + + if pinState: + pinItem = QtWidgets.QTableWidgetItem(iconOn, "") + else: + pinItem = QtWidgets.QTableWidgetItem(iconOff, "") + + self.modTable.setItem(counter, 1, pinItem) + + counter += 1 + + # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # + # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # + # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # + # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # + # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # + # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # + def refresh(self): + + while self.modTable.rowCount() > 0: + self.modTable.removeRow(0) + + self.populateTable() + + + + +def run(parent): + + if cmds.window("pyArtModStatusUi", exists = True): + cmds.deleteUI("pyArtModStatusUi", wnd = True) + + win = ART_ModStatusWin(parent) + win.show() + |