1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
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()
|