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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
|
"""
Author: Jeremy Ernst
"""
import os
from functools import partial
import System.riggingUtils as riggingUtils
import System.utils as utils
import maya.cmds as cmds
from ThirdParty.Qt import QtGui, QtCore, QtWidgets
class ART_DebugRigs():
"""
This class is used in developing rigs for modules and quickly testing them without having to go
through the entire build/publish process.
.. image:: /images/debugRigs.png
"""
def __init__(self, mainUI):
"""
Instantiate the class, getting the QSettings, and building the interface.
:param mainUI: The instance of the Rig Creator UI from which this class was called.
"""
# get the directory path of the tools
settings = QtCore.QSettings("Epic Games", "ARTv2")
self.toolsPath = settings.value("toolsPath")
self.iconsPath = settings.value("iconPath")
self.projectPath = settings.value("projectPath")
self.mainUI = mainUI
# images
self.imageBkgrd = utils.returnFriendlyPath(os.path.join(self.iconsPath, "System/toolbar_background.png"))
self.imageBtnBkrd = utils.returnFriendlyPath(os.path.join(self.iconsPath, "System/blue_field_background.png"))
self.frameBackground = utils.returnFriendlyPath(os.path.join(self.iconsPath, "System/field_background.png"))
# build the UI
if cmds.window("ART_DebugRigsWin", exists=True):
cmds.deleteUI("ART_DebugRigsWin", wnd=True)
self.buildUI()
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
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 buildRigs(self):
"""
Builds the rigs for the selected module by calling on that module's buildRig function.
"""
data = self.moduleList.currentItem().data(QtCore.Qt.UserRole)
# call on inst build rigs functions
if not cmds.objExists("driver_root"):
riggingUtils.createDriverSkeleton()
data.buildRig(None, self.mainUI)
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
def deleteRig(self):
"""
Deletes the rigs for the selected module by calling on that module's deleteRig function.
"""
data = self.moduleList.currentItem().data(QtCore.Qt.UserRole)
data.deleteRig()
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
def close(self):
"""
Close the interface and delete the window.
"""
if cmds.window("ART_DebugRigsWin", exists=True):
cmds.deleteUI("ART_DebugRigsWin", wnd=True)
|