aboutsummaryrefslogtreecommitdiff
path: root/Core/Scripts/Interfaces/ART_Publish.py
blob: c97a0696d24c7705ec69205ad665bdc0f813ab4a (plain) (blame)
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
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
from functools import partial
import maya.cmds as cmds
import os, json
import maya.OpenMayaUI as mui
import maya.OpenMaya as openMaya
import System.utils as utils

from ThirdParty.Qt import QtGui, QtCore, QtWidgets
#maya 2016< maya2017> compatability
try:
    import shiboken as shiboken
except:
    import shiboken2 as shiboken



class ART_Publish():
    #Original Author: Jeremy Ernst

    def __init__(self, mainUI):

        #super(ART_Publish, self).__init__(parent = None)

        #publish file info
        self.publishFileInfo = []
        self.currentModule = None

        #get the directory path of the tools
        settings = QtCore.QSettings("Epic Games", "ARTv2")
        self.toolsPath = settings.value("toolsPath")
        self.projectPath = settings.value("projectPath")
        self.iconsPath = settings.value("iconPath")
        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_PublishWin", exists = True):
            cmds.deleteUI("ART_PublishWin", wnd = True)

        #create model poses
        for inst in self.mainUI.moduleInstances:
            if inst.name != "root":
                #call on the module's bakeOffsets method
                inst.aimMode_Setup(False)
                inst.getReferencePose("modelPose")

        self.buildPublishUI()


# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
    def buildPublishUI(self):
        #Original Author: Jeremy Ernst

        #create the main window
        self.mainWin = QtWidgets.QMainWindow(self.mainUI)
        self.mainWin.closeEvent = self.closeWin

        #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.mainWidget.setStyleSheet(self.style)
        self.mainWin.setCentralWidget(self.mainWidget)

        #set qt object name
        self.mainWin.setObjectName("ART_PublishWin")
        self.mainWin.setWindowTitle("Publish")

        #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)

        #create the menu bar
        self.menuBar = QtWidgets.QMenuBar()
        self.menuBar.setMaximumHeight(20)
        self.layout.addWidget(self.menuBar)

        #add items to menu bar
        helpMenu = self.menuBar.addMenu("Help")
        helpMenu.addAction("Help On Publish..", self.publishHelp)
        helpMenu.addAction("Help On Create Rig Pose..", self.rigPoseHelp)

        self.mainWin.resize(600, 400)
        self.mainWin.setSizePolicy(mainSizePolicy)
        self.mainWin.setMinimumSize(QtCore.QSize( 600, 400 ))
        self.mainWin.setMaximumSize(QtCore.QSize( 600, 400 ))

        #Create a stackedWidget
        self.stackWidget = QtWidgets.QStackedWidget()
        self.layout.addWidget(self.stackWidget)

        #build pages
        self.createInfoPage()
        self.createProjectPage()
        self.createRigPosePage()
        self.createMeshSlicerPage()
        self.createThumbnailCreatorPage()
        self.createSummaryPage()


        #show window
        self.mainWin.show()
        self.stackWidget.setCurrentIndex(0)



# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
    def createInfoPage(self):
        #Original Author: Jeremy Ernst

        #create the QFrame for this page
        self.infoPage = QtWidgets.QFrame()
        self.stackWidget.addWidget(self.infoPage)
        self.infoPageMainLayout = QtWidgets.QVBoxLayout(self.infoPage)
        self.infoPage.setObjectName("epic")
        self.infoPage.setStyleSheet(self.style)

        #label
        infoLabel = QtWidgets.QLabel("Publish Your Rig")
        infoLabel.setStyleSheet("background: transparent;")
        self.infoPageMainLayout.addWidget(infoLabel)
        font = QtGui.QFont()
        font.setPointSize(12)
        font.setBold(True)
        infoLabel.setFont(font)

        #image
        self.infoFrame = QtWidgets.QFrame()
        self.infoFrame.setMinimumSize(QtCore.QSize( 560, 250 ))
        self.infoFrame.setMaximumSize(QtCore.QSize( 560, 250 ))
        self.infoPageMainLayout.addWidget(self.infoFrame)


        #add the image showing the information to the user
        image =  utils.returnFriendlyPath(os.path.join(self.iconsPath, "System/publishInfo.png"))
        self.infoFrame.setStyleSheet("background-image: url(" + image + ");")

        #buttons
        self.infoPageButtonlayout = QtWidgets.QHBoxLayout()
        self.infoPageMainLayout.addLayout(self.infoPageButtonlayout)
        self.cancelPublishBtn = QtWidgets.QPushButton("Cancel")
        self.cancelPublishBtn.setMinimumHeight(50)
        self.cancelPublishBtn.setFont(font)
        self.continuePublishBtn = QtWidgets.QPushButton("Continue")
        self.continuePublishBtn.setMinimumHeight(50)
        self.continuePublishBtn.setFont(font)
        self.infoPageButtonlayout.addWidget(self.cancelPublishBtn)
        self.infoPageButtonlayout.addWidget(self.continuePublishBtn)


        #button styling
        self.cancelPublishBtn.setObjectName("blueButton")
        self.continuePublishBtn.setObjectName("blueButton")

        #button hookups
        self.cancelPublishBtn.clicked.connect(partial(self.cancelPublish))
        self.continuePublishBtn.clicked.connect(partial(self.continueToProject))


# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
    def createProjectPage(self):
        #Original Author: Jeremy Ernst

        #create the QFrame for this page
        self.projPage = QtWidgets.QFrame()
        self.stackWidget.addWidget(self.projPage)
        self.projPageMainLayout = QtWidgets.QHBoxLayout(self.projPage)
        self.projPage.setStyleSheet(self.style)
        self.projPage.setObjectName("dark")

        font = QtGui.QFont()
        font.setPointSize(12)
        font.setBold(True)



        #the HBoxLayout will have 2 VBoxLayouts
        self.projectPageLeftColumn = QtWidgets.QVBoxLayout()
        self.projectPageRightColumn = QtWidgets.QVBoxLayout()
        self.projPageMainLayout.addLayout(self.projectPageLeftColumn)
        self.projPageMainLayout.addLayout(self.projectPageRightColumn)

        # #Left Column # #
        #2 HBox children that contain comboBox + pushButton, listWidget that lists characters in that project/group

        #project
        self.projectCbLayout = QtWidgets.QHBoxLayout()
        self.projectPageLeftColumn.addLayout(self.projectCbLayout)

        self.projectComboBox = QtWidgets.QComboBox()
        self.projectCbLayout.addWidget(self.projectComboBox)
        self.projectComboBox.setMaximumWidth(200)
        self.projectComboBox.setMaximumHeight(30)
        self.projectComboBox.currentIndexChanged.connect(self.populateGroups)
        self.projectComboBox.setToolTip("Choose a project to build the rig to.")

        self.addProjectBtn = QtWidgets.QPushButton("+")
        self.addProjectBtn.setFont(font)
        self.addProjectBtn.setMaximumWidth(30)
        self.addProjectBtn.setMaximumHeight(30)
        self.addProjectBtn.setToolTip("Add a new project to the list.")
        self.projectCbLayout.addWidget(self.addProjectBtn)
        self.addProjectBtn.clicked.connect(partial(self.addNewProject, True))
        self.addProjectBtn.setToolTip("Create a new project.")
        self.addProjectBtn.setObjectName("blueButton")

        #group
        self.groupCbLayout = QtWidgets.QHBoxLayout()
        self.projectPageLeftColumn.addLayout(self.groupCbLayout)

        self.groupComboBox = QtWidgets.QComboBox()
        self.groupCbLayout.addWidget(self.groupComboBox)
        self.groupComboBox.setMaximumWidth(200)
        self.groupComboBox.setMaximumHeight(30)
        self.groupComboBox.currentIndexChanged.connect(self.populateCharacters)
        self.groupComboBox.setToolTip("Choose a group to build the rig to in the selected project. (optional)")

        self.addGroupBtn = QtWidgets.QPushButton("+")
        self.addGroupBtn.setFont(font)
        self.addGroupBtn.setMaximumWidth(30)
        self.addGroupBtn.setMaximumHeight(30)
        self.addGroupBtn.setToolTip("Add a new group to the list.")
        self.groupCbLayout.addWidget(self.addGroupBtn)
        self.addGroupBtn.clicked.connect(self.addNewGroup)
        self.addGroupBtn.setToolTip("Create a new group.")
        self.addGroupBtn.setObjectName("blueButton")



        #listWidget
        self.characterList = QtWidgets.QListWidget()
        self.characterList.setMaximumWidth(230)
        self.projectPageLeftColumn.addWidget(self.characterList)
        self.characterList.itemClicked.connect(self.setCharacterName)
        self.characterList.setToolTip("List of characters in the specified character and group.")
        self.characterList.setFont(font)
        self.characterList.setSpacing(3)

        # #Right Column # #
        #line edit for character name, 2 hboxLayouts for pre/post script path lineEdits + pushButtons, spacers, and continue button

        #character name
        style = """
        QLineEdit
        {
            border: 2px solid rgb(0,0,0);
            border-radius: 5px;
            background-color: rgb(80,80,80);
            font: bold 30px;
            selection-background-color: black;
        }

        QLineEdit::focus
        {
            border: 1px solid rgb(25,175,255);

        }
        """
        self.characterName = QtWidgets.QLineEdit()
        self.projectPageRightColumn.addWidget(self.characterName)
        self.characterName.setMinimumHeight(75)
        self.characterName.setMaximumHeight(75)
        self.characterName.setPlaceholderText("Asset Name")
        self.characterName.setStyleSheet(style)
        self.characterName.setAlignment(QtCore.Qt.AlignCenter)
        spacerItem = QtWidgets.QSpacerItem(20, 200, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
        self.projectPageRightColumn.addItem(spacerItem)
        self.characterName.setToolTip("Name the asset will be published with.")

        #character node
        characterNode = utils.returnCharacterModule()
        attrs = cmds.listAttr(characterNode, ud = True)

        #select character, if applicable
        version = 0
        for attr in attrs:
            if attr.find("version") == 0:
                version = cmds.getAttr(characterNode + ".version")

        if version > 0:
            #change type (for versioning)
            self.changeTypeLayout = QtWidgets.QHBoxLayout()
            self.projectPageRightColumn.addLayout(self.changeTypeLayout)

            label = QtWidgets.QLabel("Change Type:")
            label.setStyleSheet("background: transparent;")
            self.changeTypeLayout.addWidget(label)
            self.changeType = QtWidgets.QComboBox()
            self.changeTypeLayout.addWidget(self.changeType)

            self.changeType.addItem("Cosmetic Change")
            self.changeType.addItem("Minor Change")
            self.changeType.addItem("Major Change")
            self.changeType.setToolTip("The type of change that was done, leading to a republish.")

            #add note box for revision
            noteLabel = QtWidgets.QLabel("Revision Note (optional):")
            noteLabel.setStyleSheet("background: transparent;")
            self.projectPageRightColumn.addWidget(noteLabel)

            self.revisionNote = QtWidgets.QTextEdit()
            self.projectPageRightColumn.addWidget(self.revisionNote)
            self.revisionNote.setObjectName("light")

        spacerItem = QtWidgets.QSpacerItem(20, 200, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
        self.projectPageRightColumn.addItem(spacerItem)


        #pre script
        self.preScriptLayout = QtWidgets.QHBoxLayout()
        self.projectPageRightColumn.addLayout(self.preScriptLayout)

        self.preScriptLineEdit = QtWidgets.QLineEdit()
        self.preScriptLineEdit.setMinimumHeight(30)
        self.preScriptLineEdit.setMaximumHeight(30)
        self.preScriptLineEdit.setPlaceholderText("Pre-Script (optional)")
        self.preScriptLayout.addWidget(self.preScriptLineEdit)
        self.preScriptLineEdit.setToolTip("If you want to run any custom code before the rig is built, load in a MEL or Python script here.")

        self.preScriptBrowse = QtWidgets.QPushButton()
        self.preScriptLayout.addWidget(self.preScriptBrowse)
        self.preScriptBrowse.setMinimumSize(35,35)
        self.preScriptBrowse.setMaximumSize(35, 35)
        self.preScriptBrowse.clicked.connect(partial(self.addCustomScripts, True, False))
        icon = QtGui.QIcon(os.path.join(self.iconsPath, "System/fileBrowse.png"))
        self.preScriptBrowse.setIconSize(QtCore.QSize(30,30))
        self.preScriptBrowse.setIcon(icon)

        #post script
        self.postScriptLayout = QtWidgets.QHBoxLayout()
        self.projectPageRightColumn.addLayout(self.postScriptLayout)

        self.postScriptLineEdit = QtWidgets.QLineEdit()
        self.postScriptLineEdit.setMinimumHeight(30)
        self.postScriptLineEdit.setMaximumHeight(30)
        self.postScriptLineEdit.setPlaceholderText("Post-Script (optional)")
        self.postScriptLayout.addWidget(self.postScriptLineEdit)
        self.postScriptLineEdit.setToolTip("If you want to run any custom code after the rig is built, load in a MEL or Python script here.")

        self.postScriptBrowse = QtWidgets.QPushButton()
        self.postScriptLayout.addWidget(self.postScriptBrowse)
        self.postScriptBrowse.setMinimumSize(35,35)
        self.postScriptBrowse.setMaximumSize(35, 35)
        self.postScriptBrowse.clicked.connect(partial(self.addCustomScripts, False, True))
        icon = QtGui.QIcon(os.path.join(self.iconsPath, "System/fileBrowse.png"))
        self.postScriptBrowse.setIconSize(QtCore.QSize(30,30))
        self.postScriptBrowse.setIcon(icon)


        spacerItem = QtWidgets.QSpacerItem(20, 50, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
        self.projectPageRightColumn.addItem(spacerItem)


        #continue btn
        self.goToRigPoseBtn = QtWidgets.QPushButton("Continue")
        self.goToRigPoseBtn.setFont(font)
        self.goToRigPoseBtn.setMinimumHeight(50)
        self.goToRigPoseBtn.setMaximumHeight(50)
        self.projectPageRightColumn.addWidget(self.goToRigPoseBtn)
        self.goToRigPoseBtn.clicked.connect(self.createNewCharacter)
        self.goToRigPoseBtn.setObjectName("blueButton")

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
    def createRigPosePage(self):
        #Original Author: Jeremy Ernst

        #create the QFrame for this page
        self.rigPosePage = QtWidgets.QFrame()
        self.rigPosePage.setMinimumSize(560, 250)
        self.stackWidget.addWidget(self.rigPosePage)
        self.rpPageMainLayout = QtWidgets.QHBoxLayout(self.rigPosePage)
        self.rigPosePage.setStyleSheet(self.style)
        self.rigPosePage.setObjectName("dark")

        font = QtGui.QFont()
        font.setPointSize(12)
        font.setBold(True)

        #the HBoxLayout will have 2 VBoxLayouts
        self.rpPageLeftColumn = QtWidgets.QVBoxLayout()
        self.rpPageRightColumn = QtWidgets.QVBoxLayout()
        self.rpPageMainLayout.addLayout(self.rpPageLeftColumn)
        self.rpPageMainLayout.addLayout(self.rpPageRightColumn)


        #left column (list of modules, back button)
        self.rpPage_moduleList = QtWidgets.QListWidget()
        self.rpPage_moduleList.setMinimumSize(200, 280)
        self.rpPage_moduleList.setMaximumSize(200, 280)
        self.rpPageLeftColumn.addWidget(self.rpPage_moduleList)
        self.rpPage_moduleList.setToolTip("This list of modules make up your character.\nSelect a module from the list to alter the rig \npose for that module.\n\nA rig pose is the ideal pose for each\nmodule for rigging. For legs, this means that\nthe leg is coplanar for the IK solve and\nthe feet are aligned to the world.\n\nFor arms, the same. It's the T-Pose that's\nbest suited to building the rig, since models\nare not always built in that pose.")
        self.rpPage_moduleList.setFont(font)
        self.rpPage_moduleList.setSpacing(3)

        #populate list
        modules = utils.returnRigModules()
        for mod in modules:
            name = cmds.getAttr(mod + ".moduleName")
            if name != "root":
                self.rpPage_moduleList.addItem(name)

        self.rpPage_moduleList.itemClicked.connect(self.moduleSelected)

        #button layout
        self.rpPage_leftButtonLayout = QtWidgets.QHBoxLayout()
        self.rpPageLeftColumn.addLayout(self.rpPage_leftButtonLayout)
        self.rpPage_leftButtonLayout.setContentsMargins(0,0,100,0)

        #button/spacer
        self.rpPage_backButton = QtWidgets.QPushButton("Back")
        self.rpPage_leftButtonLayout.addWidget(self.rpPage_backButton)
        self.rpPage_backButton.setFont(font)
        self.rpPage_backButton.setMinimumHeight(50)
        self.rpPage_backButton.setMaximumHeight(50)
        self.rpPage_backButton.clicked.connect(self.backToProject)
        self.rpPage_backButton.setObjectName("blueButton")


        #right column (scrollArea for module settings)

        #scroll area contents
        self.rpPage_scrollContents = QtWidgets.QFrame()
        scrollSizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Expanding)
        self.rpPage_scrollContents.setSizePolicy(scrollSizePolicy)
        self.rpPage_scrollContents.setObjectName("dark")


        #scroll area
        self.rpPage_Settings = QtWidgets.QScrollArea()
        self.rpPage_Settings.setMinimumSize(350, 280)
        self.rpPage_Settings.setMaximumSize(350, 280)
        self.rpPageRightColumn.addWidget(self.rpPage_Settings)
        self.rpPage_Settings.setWidgetResizable(True)
        self.rpPage_Settings.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOn)
        self.rpPage_Settings.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
        self.rpPage_Settings.setWidget(self.rpPage_scrollContents)


        #layout for scroll area
        self.rpPage_layout = QtWidgets.QVBoxLayout(self.rpPage_scrollContents)

        #stacked widget
        self.rpPage_stackWidget = QtWidgets.QStackedWidget()
        self.rpPage_layout.addWidget(self.rpPage_stackWidget)


        #message
        self.message = QtWidgets.QLabel("Select a module from the list to adjust the rig pose for that module.")
        self.message.setStyleSheet("background: transparent;")
        self.message.setAlignment(QtCore.Qt.AlignCenter)
        self.rpPage_stackWidget.addWidget(self.message)

        #button layout
        self.rpPage_righttButtonLayout = QtWidgets.QHBoxLayout()
        self.rpPageRightColumn.addLayout(self.rpPage_righttButtonLayout)
        self.rpPage_righttButtonLayout.setContentsMargins(100,0,0,0)

        #button/spacer
        self.rpPage_continueButton = QtWidgets.QPushButton("Continue")
        self.rpPage_righttButtonLayout.addWidget(self.rpPage_continueButton)
        self.rpPage_continueButton.setFont(font)
        self.rpPage_continueButton.setMinimumHeight(50)
        self.rpPage_continueButton.setMaximumHeight(50)
        self.rpPage_continueButton.clicked.connect(partial(self.continueToCreateAnimMesh))
        self.rpPage_continueButton.setObjectName("blueButton")



# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
    def createMeshSlicerPage(self):
        #Original Author: Jeremy Ernst

        #create the QFrame for this page
        self.meshSlicerPage = QtWidgets.QFrame()
        self.meshSlicerPage.setMinimumSize(560, 250)
        self.stackWidget.addWidget(self.meshSlicerPage)
        self.msPageMainLayout = QtWidgets.QVBoxLayout(self.meshSlicerPage)

        #info page styling
        self.meshSlicerPage.setStyleSheet(self.style)
        self.meshSlicerPage.setObjectName("epic")

        font = QtGui.QFont()
        font.setPointSize(12)
        font.setBold(True)

        #create the label for the instructional gif
        self.movie_screen = QtWidgets.QLabel()

        # expand and center the label
        self.movie_screen.setAlignment(QtCore.Qt.AlignCenter)
        self.msPageMainLayout.addWidget(self.movie_screen)

        #set movie from file path
        gif = utils.returnFriendlyPath(os.path.join(self.iconsPath, "Help/meshSlicer.gif"))
        self.movie = QtGui.QMovie(gif, QtCore.QByteArray())
        self.movie.setCacheMode(QtGui.QMovie.CacheAll)
        self.movie.setSpeed(100)
        self.movie_screen.setMovie(self.movie)

        #button layout
        self.msPageButtonLayout = QtWidgets.QHBoxLayout()
        self.msPageMainLayout.addLayout(self.msPageButtonLayout)

        self.msPageBackBtn = QtWidgets.QPushButton("Back")
        self.msPageBackBtn.setMinimumHeight(50)
        self.msPageBackBtn.setFont(font)
        self.msPageBackBtn.clicked.connect(partial(self.backToRigPose))
        self.msPageBackBtn.setObjectName("blueButton")

        self.msPageSkipBtn = QtWidgets.QPushButton("Skip")
        self.msPageSkipBtn.setMinimumHeight(50)
        self.msPageSkipBtn.setFont(font)
        self.msPageSkipBtn.clicked.connect(partial(self.skipToCreateThumbnail))
        self.msPageSkipBtn.setObjectName("blueButton")

        self.mePageContBtn = QtWidgets.QPushButton("Continue")
        self.mePageContBtn.setMinimumHeight(50)
        self.mePageContBtn.setFont(font)
        self.mePageContBtn.clicked.connect(partial(self.continueToCreateThumbnail))
        self.mePageContBtn.setObjectName("blueButton")

        self.msPageButtonLayout.addWidget(self.msPageBackBtn)
        spacer = QtWidgets.QSpacerItem(200, 20)
        self.msPageButtonLayout.addSpacerItem(spacer)
        self.msPageButtonLayout.addWidget(self.msPageSkipBtn)
        self.msPageButtonLayout.addWidget(self.mePageContBtn)

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
    def createThumbnailCreatorPage(self):
        #Original Author: Jeremy Ernst

        #create the QFrame for this page
        self.thumbCreatorPage = QtWidgets.QFrame()
        self.thumbCreatorPage.setMinimumSize(560, 250)
        self.stackWidget.addWidget(self.thumbCreatorPage)
        self.tcPageMainLayout = QtWidgets.QVBoxLayout(self.thumbCreatorPage)

        #info page styling
        self.thumbCreatorPage.setStyleSheet(self.style)
        self.thumbCreatorPage.setObjectName("dark")

        font = QtGui.QFont()
        font.setPointSize(20)
        font.setBold(True)

        buttonFont = QtGui.QFont()
        buttonFont.setPointSize(12)
        buttonFont.setBold(True)


        #viewport and tabs layout
        self.tcPageViewportLayout = QtWidgets.QHBoxLayout()
        self.tcPageMainLayout.addLayout(self.tcPageViewportLayout)
        self.viewportToggle = QtWidgets.QStackedWidget()
        self.viewportToggle.setMinimumSize(200,200)
        self.viewportToggle.setMaximumSize(200,200)
        self.tcPageViewportLayout.addWidget(self.viewportToggle)

        #custom image loaded
        self.customImg = QtWidgets.QFrame()
        self.customImg.setMinimumSize(200,200)
        self.customImg.setMaximumSize(200,200)
        self.viewportToggle.addWidget(self.customImg)

        # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
        # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
        # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
        #first element in this layout is our viewport

        #create the camera for the viewport
        self.thumbnailCamera = cmds.camera(name = "thumbnail_camera")[0]
        constraint = cmds.parentConstraint("persp", self.thumbnailCamera)
        cmds.setAttr(self.thumbnailCamera + ".v", 0)
        cmds.lockNode(self.thumbnailCamera, lock = True)

        #create light rig
        self.lightGrp = cmds.group(empty = True, name = "thumbnail_lights")

        #key light
        self.spot1 = cmds.spotLight(rgb = (.902, .785, .478), name = "thumbnail_spot1", ca = 100, do = 1)
        cmds.setAttr(self.spot1 + ".useDepthMapShadows", 1)
        self.spot1Parent = cmds.listRelatives(self.spot1, parent = True)[0]
        cmds.setAttr(self.spot1Parent + ".tx", 150)
        cmds.setAttr(self.spot1Parent + ".ty", -150)
        cmds.setAttr(self.spot1Parent + ".tz", 300)
        aim = cmds.aimConstraint("root", self.spot1Parent, aimVector = [0,0,-1], upVector = [0,1,0], worldUpType = "scene")[0]
        cmds.delete(aim)

        #bounce light
        self.spot2 = cmds.spotLight(rgb = (.629, .799, .949), name = "thumbnail_spot2", ca = 100, do = 1)
        cmds.setAttr(self.spot2 + ".useDepthMapShadows", 1)
        self.spot2Parent = cmds.listRelatives(self.spot2, parent = True)[0]
        cmds.setAttr(self.spot2Parent + ".tx", -150)
        cmds.setAttr(self.spot2Parent + ".ty", -150)
        cmds.setAttr(self.spot2Parent + ".tz", 300)
        aim = cmds.aimConstraint("root", self.spot2Parent, aimVector = [0,0,-1], upVector = [0,1,0], worldUpType = "scene")[0]
        cmds.delete(aim)

        #fill light
        self.spot3 = cmds.spotLight(rgb = (1, 1, 1), name = "thumbnail_spot3", ca = 100, do = 1)
        cmds.setAttr(self.spot3 + ".useDepthMapShadows", 1)
        self.spot3Parent = cmds.listRelatives(self.spot3, parent = True)[0]
        cmds.setAttr(self.spot3Parent + ".tx", 0)
        cmds.setAttr(self.spot3Parent + ".ty", 150)
        cmds.setAttr(self.spot3Parent + ".tz", 300)
        aim = cmds.aimConstraint("root", self.spot3Parent, aimVector = [0,0,-1], upVector = [0,1,0], worldUpType = "scene")[0]
        cmds.delete(aim)

        cmds.parent([self.spot1Parent, self.spot2Parent, self.spot3Parent], self.lightGrp)

        cmds.lockNode(self.spot1Parent, lock = True)
        cmds.lockNode(self.spot2Parent, lock = True)
        cmds.lockNode(self.spot3Parent, lock = True)
        cmds.lockNode(self.lightGrp, lock = True)


        #model editor
        self.tcViewport = cmds.modelEditor(camera = self.thumbnailCamera, dl = "all", da = "smoothShaded", hud = False, gr = False, dtx = True, sdw = True, j = False, ca = False, lt = False)
        pointer = mui.MQtUtil.findControl(self.tcViewport)
        self.tcViewWidget = shiboken.wrapInstance(long(pointer), QtWidgets.QWidget)
        self.viewportToggle.addWidget(self.tcViewWidget)
        self.tcViewWidget.setMinimumSize(200,200)
        self.tcViewWidget.setMaximumSize(200,200)
        self.viewportToggle.setCurrentIndex(1)

        #add image plane with image
        imagePlanePath = utils.returnFriendlyPath(os.path.join(self.iconsPath, "System/imagePlane.png"))
        self.imagePlane = cmds.imagePlane(fn = imagePlanePath, c = self.thumbnailCamera, lt = self.thumbnailCamera, sia = False )
        cmds.setAttr(self.imagePlane[1] + ".depth", 3000)
        cmds.setAttr(self.imagePlane[1] + ".sizeX", 2)
        cmds.setAttr(self.imagePlane[1] + ".sizeY", 2)

        #second element in this layout is a tabWidget

        #tab stylesheet (tab stylesheet via QSS doesn't seem to work for some reason
        stylesheet = """
        QTabBar::tab
        {
            background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 rgb(90,90,90), stop:1 rgb(30,30,30));
            border: 2px solid black;
            width: 180px;
            padding-left: -10px;
            font: 8pt;
        }
        QTabBar::tab:selected
        {
            background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 rgb(255,174,0), stop:1 rgb(30,30,30));
            border: 2px solid black;
            font: bold 10pt;
        }
        QTabBar::tab:hover
        {
            background: rgb(132,95,16);
            font: bold 10pt;
        }
        QTabBar::tab:!selected
        {
            margin-top: 5px;
        }
        QTabWidget::pane
        {
            border: 2px solid rgb(0,0,0);
        }
        """


        self.tcPageTabs = QtWidgets.QTabWidget()
        self.tcPageTabs.setStyleSheet(stylesheet)
        self.tcPageViewportLayout.addWidget(self.tcPageTabs)
        self.tcPageTabs.setMinimumHeight(200)
        self.tcPageTabs.setMaximumHeight(200)



        # # # # # # # # # # # # # # # # # # # # # # # # # #
        # # # # # # # # # # # # # # # # # # # # # # # # # #
        #rendering tab
        self.renderTab = QtWidgets.QFrame()
        self.tcPageTabs.addTab(self.renderTab, "LIGHT OPTIONS")
        self.renderTab.setObjectName("epic")

        #rendering tab main layout
        self.renderTabLayout = QtWidgets.QHBoxLayout(self.renderTab)
        self.renderTabLayout.setSpacing(10)

        #left column of render tab options
        self.renderTabLeft = QtWidgets.QVBoxLayout()
        self.renderTabLayout.addLayout(self.renderTabLeft)

        icon = utils.returnFriendlyPath(os.path.join(self.iconsPath, "System/spotLight.png"))


        # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
        # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
        #light 1
        self.light1Layout = QtWidgets.QHBoxLayout()
        self.renderTabLeft.addLayout(self.light1Layout)

        self.light1Img = QtWidgets.QPushButton("")
        self.light1Img.setFont(font)
        self.light1Img.setMinimumSize(40,40)
        self.light1Img.setMaximumSize(40,40)
        self.light1Img.setStyleSheet("background-image: url(" + icon + "); border: black solid 0px;")
        self.light1Layout.addWidget(self.light1Img)

        self.light1Dial = QtWidgets.QDial()
        self.light1Dial.setToolTip("Light Intensity")
        self.light1Layout.addWidget(self.light1Dial)
        self.light1Dial.setMinimumSize(50,50)
        self.light1Dial.setMaximumSize(50,50)
        self.light1Dial.setRange(0,100)
        self.light1Dial.setValue(50)
        shadow1 = QtWidgets.QGraphicsDropShadowEffect(self.light1Dial)
        shadow1.setBlurRadius(5)
        shadow1.setColor(QtGui.QColor (0, 0, 0, 255))
        self.light1Dial.setStyleSheet("background-color: rgb(60, 60, 60);")
        self.light1Dial.setGraphicsEffect(shadow1)
        self.light1Dial.valueChanged.connect(partial(self.changeLightIntensity, self.spot1, self.light1Dial))

        self.light1Swatch = QtWidgets.QPushButton("Color")
        self.light1Layout.addWidget(self.light1Swatch)
        self.light1Swatch.setMinimumSize(60,30)
        self.light1Swatch.setMaximumSize(60,30)
        self.light1Swatch.setFont(buttonFont)
        self.light1Swatch.setStyleSheet("color: rgb(230, 200, 122);")
        shadow2 = QtWidgets.QGraphicsDropShadowEffect(self.light1Swatch)
        shadow2.setBlurRadius(5)
        shadow2.setColor(QtGui.QColor (0, 0, 0, 255))
        self.light1Swatch.setGraphicsEffect(shadow2)
        self.light1Swatch.clicked.connect(partial(self.changeLightColor, self.spot1, self.light1Swatch))

        # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
        # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
        #light 2
        self.light2Layout = QtWidgets.QHBoxLayout()
        self.renderTabLeft.addLayout(self.light2Layout)

        self.light2Img = QtWidgets.QPushButton("")
        self.light2Img.setFont(font)
        self.light2Img.setMinimumSize(40,40)
        self.light2Img.setMaximumSize(40,40)
        self.light2Img.setStyleSheet("background-image: url(" + icon + "); border: black solid 0px;")
        self.light2Layout.addWidget(self.light2Img)

        self.light2Dial = QtWidgets.QDial()
        self.light2Dial.setToolTip("Light Intensity")
        self.light2Layout.addWidget(self.light2Dial)
        self.light2Dial.setMinimumSize(50,50)
        self.light2Dial.setMaximumSize(50,50)
        self.light2Dial.setRange(0,100)
        self.light2Dial.setValue(50)
        shadow1 = QtWidgets.QGraphicsDropShadowEffect(self.light2Dial)
        shadow1.setBlurRadius(5)
        shadow1.setColor(QtGui.QColor (0, 0, 0, 255))
        self.light2Dial.setStyleSheet("background-color: rgb(60, 60, 60);")
        self.light2Dial.setGraphicsEffect(shadow1)
        self.light2Dial.valueChanged.connect(partial(self.changeLightIntensity, self.spot2, self.light2Dial))

        self.light2Swatch = QtWidgets.QPushButton("Color")
        self.light2Layout.addWidget(self.light2Swatch)
        self.light2Swatch.setMinimumSize(60,30)
        self.light2Swatch.setMaximumSize(60,30)
        self.light2Swatch.setFont(buttonFont)
        self.light2Swatch.setStyleSheet("color: rgb(160, 204, 242);")
        shadow2 = QtWidgets.QGraphicsDropShadowEffect(self.light2Swatch)
        shadow2.setBlurRadius(5)
        shadow2.setColor(QtGui.QColor (0, 0, 0, 255))
        self.light2Swatch.setGraphicsEffect(shadow2)
        self.light2Swatch.clicked.connect(partial(self.changeLightColor, self.spot2, self.light2Swatch))

        # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
        # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
        #light 3
        self.light3Layout = QtWidgets.QHBoxLayout()
        self.renderTabLeft.addLayout(self.light3Layout)

        self.light3Img = QtWidgets.QPushButton("")
        self.light3Img.setFont(font)
        self.light3Img.setMinimumSize(40,40)
        self.light3Img.setMaximumSize(40,40)
        self.light3Img.setStyleSheet("background-image: url(" + icon + "); border: black solid 0px;")
        self.light3Layout.addWidget(self.light3Img)

        self.light3Dial = QtWidgets.QDial()
        self.light3Dial.setToolTip("Light Intensity")
        self.light3Layout.addWidget(self.light3Dial)
        self.light3Dial.setMinimumSize(50,50)
        self.light3Dial.setMaximumSize(50,50)
        self.light3Dial.setRange(0,100)
        self.light3Dial.setValue(50)
        shadow1 = QtWidgets.QGraphicsDropShadowEffect(self.light3Dial)
        shadow1.setBlurRadius(5)
        shadow1.setColor(QtGui.QColor (0, 0, 0, 255))
        self.light3Dial.setStyleSheet("background-color: rgb(60, 60, 60);")
        self.light3Dial.setGraphicsEffect(shadow1)
        self.light3Dial.valueChanged.connect(partial(self.changeLightIntensity, self.spot3, self.light3Dial))

        self.light3Swatch = QtWidgets.QPushButton("Color")
        self.light3Layout.addWidget(self.light3Swatch)
        self.light3Swatch.setMinimumSize(60,30)
        self.light3Swatch.setMaximumSize(60,30)
        self.light3Swatch.setFont(buttonFont)
        self.light3Swatch.setStyleSheet("color: rgb(255, 255, 255);")
        shadow2 = QtWidgets.QGraphicsDropShadowEffect(self.light3Swatch)
        shadow2.setBlurRadius(5)
        shadow2.setColor(QtGui.QColor (0, 0, 0, 255))
        self.light3Swatch.setGraphicsEffect(shadow2)
        self.light3Swatch.clicked.connect(partial(self.changeLightColor, self.spot3, self.light3Swatch))


        #right column
        self.renderTabRight = QtWidgets.QVBoxLayout()
        self.renderTabLayout.addLayout(self.renderTabRight)


        #orbit layout
        self.orbitLayout = QtWidgets.QHBoxLayout()
        self.renderTabRight.addLayout(self.orbitLayout)


        label = QtWidgets.QLabel("Orbit: ")
        label.setStyleSheet("background: transparent;")
        label.setFont(buttonFont)
        label.setMinimumHeight(30)
        label.setMaximumHeight(30)
        self.orbitLayout.addWidget(label)

        self.orbitDial = QtWidgets.QDial()
        self.orbitDial.setToolTip("Light Rig Position")
        self.orbitLayout.addWidget(self.orbitDial)
        self.orbitDial.setMinimumSize(75,75)
        self.orbitDial.setMaximumSize(75,75)
        self.orbitDial.setRange(0,360)
        self.orbitDial.setValue(0)
        shadow = QtWidgets.QGraphicsDropShadowEffect(self.orbitDial)
        shadow.setBlurRadius(5)
        shadow.setColor(QtGui.QColor (0, 0, 0, 255))
        self.orbitDial.setGraphicsEffect(shadow)
        self.orbitDial.valueChanged.connect(partial(self.orbitLights, self.lightGrp, self.orbitDial))


        #pitch layout
        self.pitchLayout = QtWidgets.QHBoxLayout()
        self.renderTabRight.addLayout(self.pitchLayout)


        label = QtWidgets.QLabel("Pitch: ")
        label.setStyleSheet("background: transparent;")
        label.setFont(buttonFont)
        label.setMinimumHeight(30)
        label.setMaximumHeight(30)
        self.pitchLayout.addWidget(label)


        self.pitchSlider = QtWidgets.QSlider()
        self.pitchSlider.setOrientation(QtCore.Qt.Horizontal)
        self.pitchSlider.setToolTip("Light Aim Height")
        self.pitchSlider.setRange(-180, 180)
        self.pitchLayout.addWidget(self.pitchSlider)
        self.pitchSlider.valueChanged.connect(partial(self.pitchLights, [self.spot1Parent, self.spot2Parent, self.spot3Parent], self.pitchSlider))

        #options layout
        self.tcPageOptionsLayout = QtWidgets.QHBoxLayout()
        self.tcPageMainLayout.addLayout(self.tcPageOptionsLayout)

        self.hqRenderCB = QtWidgets.QCheckBox("High Quality")
        self.tcPageOptionsLayout.addWidget(self.hqRenderCB)
        self.hqRenderCB.clicked.connect(partial(self.highQualityToggle))
        self.hqRenderCB.setChecked(False)


        self.shadowsCB = QtWidgets.QCheckBox("Shadows")
        self.tcPageOptionsLayout.addWidget(self.shadowsCB)
        self.shadowsCB.setChecked(False)
        self.shadowsCB.clicked.connect(partial(self.shadowsToggle, [self.spot1, self.spot2, self.spot3]))

        self.customThumbnail = QtWidgets.QLineEdit()
        self.tcPageOptionsLayout.addWidget(self.customThumbnail)
        self.customThumbnail.setStyleSheet("background-image: url(" + self.frameBackground + ");")

        self.loadThumbBtn = QtWidgets.QPushButton("Load Custom")
        self.tcPageOptionsLayout.addWidget(self.loadThumbBtn)
        self.loadThumbBtn.clicked.connect(self.loadCustomImg)
        self.loadThumbBtn.setObjectName("blueButton")

        #button layout
        self.tcPageButtonLayout = QtWidgets.QHBoxLayout()
        self.tcPageMainLayout.addLayout(self.tcPageButtonLayout)

        self.tcPageBackBtn = QtWidgets.QPushButton("Back")
        self.tcPageBackBtn.setMinimumHeight(50)
        self.tcPageBackBtn.setFont(font)
        self.tcPageBackBtn.clicked.connect(partial(self.backToMeshSlicer))
        self.tcPageBackBtn.setObjectName("blueButton")

        self.tcPageContBtn = QtWidgets.QPushButton("Continue")
        self.tcPageContBtn.setMinimumHeight(50)
        self.tcPageContBtn.setFont(font)
        self.tcPageContBtn.clicked.connect(partial(self.continueToSummary, False))
        self.tcPageContBtn.setObjectName("blueButton")

        self.tcPageButtonLayout.addWidget(self.tcPageBackBtn)
        spacer = QtWidgets.QSpacerItem(200, 20)
        self.tcPageButtonLayout.addSpacerItem(spacer)
        self.tcPageButtonLayout.addWidget(self.tcPageContBtn)


# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
    def createSummaryPage(self):
        #Original Author: Jeremy Ernst

        #create the QFrame for this page
        self.summaryPage = QtWidgets.QFrame()
        self.summaryPage.setMinimumSize(560, 250)
        self.stackWidget.addWidget(self.summaryPage)
        self.sumPageMainLayout = QtWidgets.QVBoxLayout(self.summaryPage)

        #info page styling
        self.summaryPage.setStyleSheet(self.style)
        self.summaryPage.setObjectName("epic")

        font = QtGui.QFont()
        font.setPointSize(20)
        font.setBold(True)

        buttonFont = QtGui.QFont()
        buttonFont.setPointSize(12)
        buttonFont.setBold(True)

        #top section of UI will contain Hbox layout with icon and character information
        self.sumPageTopLayout = QtWidgets.QHBoxLayout()
        self.sumPageMainLayout.addLayout(self.sumPageTopLayout)

        #left side of top layout
        self.sumPageIcon = QtWidgets.QFrame()
        self.sumPageIcon.setMinimumSize(200,200)
        self.sumPageIcon.setMaximumSize(200,200)
        self.sumPageTopLayout.addWidget(self.sumPageIcon)
        shadow = QtWidgets.QGraphicsDropShadowEffect(self.sumPageIcon)
        shadow.setBlurRadius(5)
        shadow.setColor(QtGui.QColor (0, 0, 0, 255))
        self.sumPageIcon.setGraphicsEffect(shadow)



        #right side of top layout (vbox with 5 hbox children)
        self.sumPageTopRight = QtWidgets.QVBoxLayout()
        self.sumPageTopLayout.addLayout(self.sumPageTopRight)


        #character name
        assetNameLayout = QtWidgets.QHBoxLayout()
        self.sumPageTopRight.addLayout(assetNameLayout)
        assetNameLayout.setContentsMargins(3,0,3,0)

        label = QtWidgets.QLabel("Asset Name: ")
        label.setStyleSheet("background: transparent;")
        assetNameLayout.addWidget(label)
        label.setAlignment(QtCore.Qt.AlignLeft)
        label.setMinimumWidth(80)
        label.setMaximumWidth(80)

        self.sumPageAssetName = QtWidgets.QLineEdit()
        assetNameLayout.addWidget(self.sumPageAssetName)
        self.sumPageAssetName.setMinimumWidth(240)
        self.sumPageAssetName.setMaximumWidth(240)
        self.sumPageAssetName.setAlignment(QtCore.Qt.AlignRight)
        self.sumPageAssetName.setReadOnly(True)

        #project
        projLayout = QtWidgets.QHBoxLayout()
        self.sumPageTopRight.addLayout(projLayout)
        projLayout.setContentsMargins(3,0,3,0)

        label = QtWidgets.QLabel("Project: ")
        label.setStyleSheet("background: transparent;")
        projLayout.addWidget(label)
        label.setAlignment(QtCore.Qt.AlignLeft)
        label.setMinimumWidth(80)
        label.setMaximumWidth(80)

        self.sumPageProj = QtWidgets.QLineEdit()
        projLayout.addWidget(self.sumPageProj)
        self.sumPageProj.setMinimumWidth(240)
        self.sumPageProj.setMaximumWidth(240)
        self.sumPageProj.setAlignment(QtCore.Qt.AlignRight)
        self.sumPageProj.setReadOnly(True)


        #group
        groupNameLayout = QtWidgets.QHBoxLayout()
        self.sumPageTopRight.addLayout(groupNameLayout)
        groupNameLayout.setContentsMargins(3,0,3,0)

        label = QtWidgets.QLabel("Group: ")
        label.setStyleSheet("background: transparent;")
        groupNameLayout.addWidget(label)
        label.setAlignment(QtCore.Qt.AlignLeft)
        label.setMinimumWidth(80)
        label.setMaximumWidth(80)

        self.sumPageGroup = QtWidgets.QLineEdit()
        groupNameLayout.addWidget(self.sumPageGroup)
        self.sumPageGroup.setMinimumWidth(240)
        self.sumPageGroup.setMaximumWidth(240)
        self.sumPageGroup.setAlignment(QtCore.Qt.AlignRight)
        self.sumPageGroup.setReadOnly(True)


        #revision type
        revisionTypeLayout = QtWidgets.QHBoxLayout()
        self.sumPageTopRight.addLayout(revisionTypeLayout)
        revisionTypeLayout.setContentsMargins(3,0,3,0)

        label = QtWidgets.QLabel("Revision Type: ")
        label.setStyleSheet("background: transparent;")
        revisionTypeLayout.addWidget(label)
        label.setAlignment(QtCore.Qt.AlignLeft)
        label.setMinimumWidth(80)
        label.setMaximumWidth(80)

        self.sumPageRevisionType = QtWidgets.QLineEdit()
        revisionTypeLayout.addWidget(self.sumPageRevisionType)
        self.sumPageRevisionType.setMinimumWidth(240)
        self.sumPageRevisionType.setMaximumWidth(240)
        self.sumPageRevisionType.setAlignment(QtCore.Qt.AlignRight)
        self.sumPageRevisionType.setReadOnly(True)


        #options
        optionsLayout = QtWidgets.QHBoxLayout()
        self.sumPageTopRight.addLayout(optionsLayout)
        optionsLayout.setContentsMargins(3,0,3,0)

        self.sp_preScriptCB = QtWidgets.QCheckBox("Pre-Script?")
        optionsLayout.addWidget(self.sp_preScriptCB)
        self.sp_preScriptCB.setEnabled(False)

        self.sp_postScriptCB = QtWidgets.QCheckBox("Post-Script?")
        optionsLayout.addWidget(self.sp_postScriptCB)
        self.sp_postScriptCB.setEnabled(False)

        self.sp_animMeshCB = QtWidgets.QCheckBox("Animation Mesh?")
        optionsLayout.addWidget(self.sp_animMeshCB)
        self.sp_animMeshCB.setEnabled(False)


        #button layout
        self.sp_PageButtonLayout = QtWidgets.QHBoxLayout()
        self.sumPageMainLayout.addLayout(self.sp_PageButtonLayout)

        self.sp_PageBackBtn = QtWidgets.QPushButton("Back")
        self.sp_PageBackBtn.setMinimumHeight(50)
        self.sp_PageBackBtn.setFont(font)
        self.sp_PageBackBtn.clicked.connect(partial(self.backToMeshIconCreation))
        self.sp_PageBackBtn.setObjectName("blueButton")


        self.sp_PageContBtn = QtWidgets.QPushButton("BUILD")
        self.sp_PageContBtn.setMinimumHeight(50)
        self.sp_PageContBtn.setFont(font)
        self.sp_PageContBtn.clicked.connect(partial(self.launchBuild))
        self.sp_PageContBtn.setObjectName("blueButton")

        self.sp_PageButtonLayout.addWidget(self.sp_PageBackBtn)
        spacer = QtWidgets.QSpacerItem(200, 20)
        self.sp_PageButtonLayout.addSpacerItem(spacer)
        self.sp_PageButtonLayout.addWidget(self.sp_PageContBtn)

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
    def highQualityToggle(self):

        state = self.hqRenderCB.isChecked()

        if state:
            cmds.modelEditor(self.tcViewport, edit = True, rnm = "ogsRenderer")

        if not state:
            cmds.modelEditor(self.tcViewport, edit = True, rnm = "base_OpenGL_Renderer")

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
    def shadowsToggle(self, lights):

        state = self.shadowsCB.isChecked()

        for light in lights:
            cmds.setAttr(light + ".useDepthMapShadows", state)


# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
    def pitchLights(self, lights, slider, *args):

        value = slider.value()

        for light in lights:
            cmds.setAttr(light + ".rotateX", value)

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
    def changeLightIntensity(self, light, dial, *args):

        #get dial value
        value = dial.value()
        value = float(value)/50.0

        cmds.setAttr(light + ".intensity", value)

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
    def changeLightColor(self, light, button, *args):

        #launch color dialog
        self.qColorDialog = QtWidgets.QColorDialog.getColor()
        color = self.qColorDialog.getRgb()
        red = float(color[0])
        green = float(color[1])
        blue = float(color[2])

        cmds.setAttr(light + ".colorR", float(red/255))
        cmds.setAttr(light + ".colorG", float(green/255))
        cmds.setAttr(light + ".colorB", float(blue/255))

        button.setStyleSheet("color: rgb(" + str(red) + "," + str(green) + "," + str(blue) + ");")

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
    def orbitLights(self, group, dial, *args):

        value = dial.value()
        cmds.setAttr(group + ".rotateZ", value)

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
    def loadCustomImg(self):

        try:
            imgPath = cmds.fileDialog2(fm = 1, dir = self.iconsPath)[0]
            imgPath = utils.returnFriendlyPath(imgPath)

            #check to make sure image is valid
            extension = imgPath.rpartition(".")[2]
            if extension != "png":
                cmds.warning("Please upload only png files!")
            else:
                self.customImg.setStyleSheet("background-image: url(" + imgPath + ");")
                self.customThumbnail.setText(imgPath)
                self.viewportToggle.setCurrentIndex(0)

        except:
            cmds.warning("No File Chosen")

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
    def moduleSelected(self):
        #Original Author: Jeremy Ernst

        currentSelection = cmds.ls(sl = True)

        #run toggleMoverVisibility
        self.mainUI.setMoverVisibility()

        #clean up current module
        if self.currentModule != None:
            self.currentModule.cleanUpRigPose()

        #find the currently selected module
        selected = self.rpPage_moduleList.selectedItems()
        module = selected[0].text()

        #find the network node this module belongs to
        networkNode = None
        modules = utils.returnRigModules()
        for mod in modules:
            modName = cmds.getAttr(mod + ".moduleName")
            if modName == module:
                networkNode = mod
                break

        #find the instance in memory of the selected module
        if networkNode != None:

            for inst in  self.mainUI.moduleInstances:

                if inst.returnNetworkNode == networkNode:

                    #call on module's method for unhiding and constraining joints
                    inst.setupForRigPose()

                    #call on the module's getRigPose method
                    inst.getReferencePose("rigPose")

                    #call on the module's rigPose_UI method
                    index = self.rpPage_stackWidget.indexOf(inst.rigPoseFrame)
                    self.rpPage_stackWidget.setCurrentIndex(index)

                    #set current module
                    self.currentModule = inst

        cmds.select(clear = True)
        if len(currentSelection) > 0:
            cmds.select(currentSelection)


# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
    def populateProjects(self):
        #Original Author: Jeremy Ernst

        #if the project path doesn't exist on disk, create it
        if not os.path.exists(self.projectPath):
            os.makedirs(self.projectPath)

        #get a list of the existing folders in projects
        existingProjects = os.listdir(self.projectPath)
        folders = []

        #find out which returned items are directories
        for each in existingProjects:
            if os.path.isdir(os.path.join(self.projectPath, each)):
                folders.append(each)

        #if there are no projects, bring up add project interface
        if len(folders) == 0:
            self.addNewProject(False)

        #otherwise, add each project to the combo box
        else:
            self.projectComboBox.clear()
            for each in folders:
                self.projectComboBox.addItem(each)


        #find selected project and populate groups
        self.populateGroups()

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
    def populateGroups(self):
        #Original Author: Jeremy Ernst

        #get a list of the existing folders in projects
        selectedProject = self.projectComboBox.currentText()
        project = os.path.join(self.projectPath, selectedProject)
        existingGroups = os.listdir(project)
        folders = []

        #find out which returned items are directories
        for each in existingGroups:
            if os.path.isdir(os.path.join(project, each)):
                folders.append(each)

        #otherwise, add each project to the combo box
        self.groupComboBox.clear()
        self.groupComboBox.addItem(" ")
        for each in folders:
            self.groupComboBox.addItem(each)


        #populate characters
        self.populateCharacters()
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
    def populateCharacters(self):
        #Original Author: Jeremy Ernst

        #get a list of the existing folders in projects
        selectedProject = self.projectComboBox.currentText()
        fullPath = os.path.join(self.projectPath, selectedProject)
        selectedGroup = self.groupComboBox.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])
            self.characterList.addItem(item)

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
    def addNewProject(self, fromButton):
        #Original Author: Jeremy Ernst

        #simple UI for user to add new Project
        if cmds.window("ART_Publish_AddNewProjUI", exists = True):
            cmds.deleteUI("ART_Publish_AddNewProjUI", wnd = True)

        #launch a UI to get the name information
        self.addNewProjWindow = QtWidgets.QMainWindow(self.mainWin)

        #size policies
        mainSizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)

        #create the main widget
        self.addNewProjWindow_mainWidget = QtWidgets.QWidget()
        self.addNewProjWindow.setCentralWidget(self.addNewProjWindow_mainWidget)

        #set qt object name
        self.addNewProjWindow.setObjectName("ART_Publish_AddNewProjUI")
        self.addNewProjWindow.setWindowTitle("Add New Project")

        #create the mainLayout for the rig creator UI
        self.addNewProjWindow_mainLayout = QtWidgets.QVBoxLayout(self.addNewProjWindow_mainWidget)
        self.addNewProjWindow_mainLayout.setContentsMargins(0, 0, 0, 0)

        self.addNewProjWindow.resize(300, 100)
        self.addNewProjWindow.setSizePolicy(mainSizePolicy)
        self.addNewProjWindow.setMinimumSize(QtCore.QSize( 300, 100 ))
        self.addNewProjWindow.setMaximumSize(QtCore.QSize( 300, 100 ))

        #add stackWidget for ability to swap between two different pages (page 1: No projects exist. page 2: add new project)
        self.addNewProjWindow_stackWidget = QtWidgets.QStackedWidget()
        self.addNewProjWindow_mainLayout.addWidget(self.addNewProjWindow_stackWidget)


        #NO PROJECT EXISTS PAGE

        #add background image/QFrame for first page
        page1Widget = QtWidgets.QWidget()
        self.addNewProjWindow_stackWidget.addWidget(page1Widget)

        self.addNewProjWindow_frame = QtWidgets.QFrame(page1Widget)
        self.addNewProjWindow_frame.setMinimumSize(QtCore.QSize( 300, 100 ))
        self.addNewProjWindow_frame.setMaximumSize(QtCore.QSize( 300, 100 ))
        self.addNewProjWindow_frame.setStyleSheet("background-image: url(" + self.imageBkgrd + ");")

        #Add simple VBoxLayout for page
        self.addNewProjWindow_page1Layout = QtWidgets.QVBoxLayout(self.addNewProjWindow_frame)

        #add label
        label = QtWidgets.QLabel("No projects exist in this directory. Would you like to add one now?")
        label.setWordWrap(True)
        label.setAlignment(QtCore.Qt.AlignCenter)
        self.addNewProjWindow_page1Layout.addWidget(label)

        #add buttons for Yes/Cancel
        self.addNewProjWinPage1_buttonLayout = QtWidgets.QHBoxLayout()
        self.addNewProjWindow_page1Layout.addLayout(self.addNewProjWinPage1_buttonLayout)

        self.addNewProjWinPage1_CancelButton = QtWidgets.QPushButton("Cancel")
        self.addNewProjWinPage1_buttonLayout.addWidget(self.addNewProjWinPage1_CancelButton)
        self.addNewProjWinPage1_CancelButton.setStyleSheet("background-image: url(" + self.imageBtnBkrd + ");background-color: rgb(25, 175, 255);")
        self.addNewProjWinPage1_CancelButton.clicked.connect(self.addNewProjWindow.close)


        self.addNewProjWinPage1_YesButton = QtWidgets.QPushButton("Yes")
        self.addNewProjWinPage1_buttonLayout.addWidget(self.addNewProjWinPage1_YesButton)
        self.addNewProjWinPage1_YesButton.setStyleSheet("background-image: url(" + self.imageBtnBkrd + ");background-color: rgb(25, 175, 255);")
        self.addNewProjWinPage1_YesButton.clicked.connect(partial(self.addNewProjWindow_stackWidget.setCurrentIndex,1))



        #ADD NEW PROJECT PAGE

        #add background image/QFrame for first page
        page2Widget = QtWidgets.QWidget()
        self.addNewProjWindow_stackWidget.addWidget(page2Widget)

        self.addNewProjWinPage2_frame = QtWidgets.QFrame(page2Widget)
        self.addNewProjWinPage2_frame.setMinimumSize(QtCore.QSize( 300, 100 ))
        self.addNewProjWinPage2_frame.setMaximumSize(QtCore.QSize( 300, 100 ))
        self.addNewProjWinPage2_frame.setStyleSheet("background-image: url(" + self.imageBkgrd + ");")

        #Add simple VBoxLayout for page
        self.addNewProjWindow_page2Layout = QtWidgets.QVBoxLayout(self.addNewProjWinPage2_frame)

        #line edit for writing project name
        self.addNewProjLineEdit = QtWidgets.QLineEdit()
        self.addNewProjLineEdit.setPlaceholderText("Project Name")
        self.addNewProjWindow_page2Layout.addWidget(self.addNewProjLineEdit)
        self.addNewProjLineEdit.setStyleSheet("background-image: url(" + self.frameBackground + ");")


        #add project button
        font = QtGui.QFont()
        font.setPointSize(12)
        font.setBold(True)

        self.addNewProj_AddButton = QtWidgets.QPushButton("Create New Project")
        self.addNewProjWindow_page2Layout.addWidget(self.addNewProj_AddButton)
        self.addNewProj_AddButton.setFont(font)
        self.addNewProj_AddButton.setStyleSheet("background-image: url(" + self.imageBtnBkrd + ");background-color: rgb(25, 175, 255);")
        self.addNewProj_AddButton.clicked.connect(self.createNewProject)

        #show the ui
        self.addNewProjWindow.show()

        if not fromButton:
            self.addNewProjWindow_stackWidget.setCurrentIndex(0)
        if fromButton:
            self.addNewProjWindow_stackWidget.setCurrentIndex(1)


# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
    def addNewGroup(self):
        #Original Author: Jeremy Ernst

        #simple UI for user to add new Group
        if cmds.window("ART_Publish_AddNewGrpUI", exists = True):
            cmds.deleteUI("ART_Publish_AddNewGrpUI", wnd = True)

        #launch a UI to get the name information
        self.addNewGrpWin = QtWidgets.QMainWindow(self.mainWin)

        #size policies
        mainSizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)

        #create the main widget
        self.addNewGrpWin_mainWidget = QtWidgets.QWidget()
        self.addNewGrpWin.setCentralWidget(self.addNewGrpWin_mainWidget)

        #set qt object name
        self.addNewGrpWin.setObjectName("ART_Publish_AddNewGrpUI")
        self.addNewGrpWin.setWindowTitle("Add New Group")

        #create the mainLayout for the rig creator UI
        self.addNewGrpWin_mainLayout = QtWidgets.QVBoxLayout(self.addNewGrpWin_mainWidget)
        self.addNewGrpWin_mainLayout.setContentsMargins(0, 0, 0, 0)

        self.addNewGrpWin.resize(300, 100)
        self.addNewGrpWin.setSizePolicy(mainSizePolicy)
        self.addNewGrpWin.setMinimumSize(QtCore.QSize( 300, 100 ))
        self.addNewGrpWin.setMaximumSize(QtCore.QSize( 300, 100 ))


        #add background image/QFrame for first page
        self.addNewGrpWin_frame = QtWidgets.QFrame()
        self.addNewGrpWin_mainLayout.addWidget(self.addNewGrpWin_frame)
        self.addNewGrpWin_frame.setMinimumSize(QtCore.QSize( 300, 100 ))
        self.addNewGrpWin_frame.setMaximumSize(QtCore.QSize( 300, 100 ))
        self.addNewGrpWin_frame.setStyleSheet("background-image: url(" + self.imageBkgrd + ");")

        #create vertical layout
        self.addNewGrpWin_vLayout = QtWidgets.QVBoxLayout(self.addNewGrpWin_frame)

        #line edit for writing group name
        self.addNewGrpWinLineEdit = QtWidgets.QLineEdit()
        self.addNewGrpWinLineEdit.setPlaceholderText("Group Name")
        self.addNewGrpWin_vLayout.addWidget(self.addNewGrpWinLineEdit)
        self.addNewGrpWinLineEdit.setStyleSheet("background-image: url(" + self.frameBackground + ");")


        #add group button
        font = QtGui.QFont()
        font.setPointSize(12)
        font.setBold(True)

        self.addNewGrpWin_AddButton = QtWidgets.QPushButton("Create New Group")
        self.addNewGrpWin_vLayout.addWidget(self.addNewGrpWin_AddButton)
        self.addNewGrpWin_AddButton.setFont(font)
        self.addNewGrpWin_AddButton.setStyleSheet("background-image: url(" + self.imageBtnBkrd + ");background-color: rgb(25, 175, 255);")
        self.addNewGrpWin_AddButton.clicked.connect(self.createNewGroup)

        #show the ui
        self.addNewGrpWin.show()

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
    def setCharacterName(self):
        #Original Author: Jeremy Ernst

        selected = self.characterList.currentItem().text()
        self.characterName.setText(selected)
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
    def createNewProject(self):
        #Original Author: Jeremy Ernst

        #get name from lineEdit
        projectName = self.addNewProjLineEdit.text()
        if len(projectName) == 0:
            cmds.warning("No valid Project Name entered.")
            return

        #make sure there are no naming conflicts
        existingProjects = os.listdir(self.projectPath)
        if projectName in existingProjects:
            cmds.warning("Project with that name already exists. Aborting..")
            return

        #make the directory
        path = os.path.join(self.projectPath, projectName)
        os.makedirs(path)

        #close the ui
        self.addNewProjWindow.close()

        #repopulate
        self.populateProjects()


# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
    def createNewGroup(self):
        #Original Author: Jeremy Ernst

        #get name from lineEdit
        groupName = self.addNewGrpWinLineEdit.text()
        if len(groupName) == 0:
            cmds.warning("No valid Group Name entered.")
            return

        #make sure there are no naming conflicts
        selectedProject = self.projectComboBox.currentText()
        project = os.path.join(self.projectPath, selectedProject)
        existingGroups = os.listdir(project)

        if groupName in existingGroups:
            cmds.warning("Group with that name already exists. Aborting..")
            return

        #make the directory
        path = os.path.join(project, groupName)
        os.makedirs(path)

        #close the ui
        self.addNewGrpWin.close()

        #repopulate
        self.populateGroups()


# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
    def createNewCharacter(self):
        #Original Author: Jeremy Ernst

        #get character name from lineEdit
        characterName = self.characterName.text()
        toContinue = False

        #get existing names in characterList
        existingCharacters = []
        for i in range(self.characterList.count()):
            existingCharacters.append(self.characterList.item(i).text())

        #check if name is unique. If not, ask if user wants to overwrite
        if characterName not in existingCharacters:
            toContinue = True

        else:
            toContinue = self.overwriteCharacterUI()

        if toContinue:

            #if the name is not an empty string, proceed.
            if len(characterName) > 0:

                #check for attributes on ART_RIG_ROOT node
                characterNode = utils.returnCharacterModule()
                firstVersion = False

                if cmds.objExists(characterNode + ".project") == False:
                    cmds.addAttr(characterNode, ln = "project", dt = "string", keyable = True)

                if cmds.objExists(characterNode + ".group") == False:
                    cmds.addAttr(characterNode, ln = "group", dt = "string", keyable = True)

                if cmds.objExists(characterNode + ".name") == False:
                    cmds.addAttr(characterNode, ln = "name", dt = "string", keyable = True)

                if cmds.objExists(characterNode + ".version") == False:
                    cmds.addAttr(characterNode, ln = "version", keyable = True)
                    firstVersion = True

                if cmds.objExists(characterNode + ".versionNote") == False:
                    cmds.addAttr(characterNode, ln = "versionNote", dt = "string", keyable = True)

                if cmds.objExists(characterNode + ".publishedBy") == False:
                    cmds.addAttr(characterNode, ln = "publishedBy", dt = "string", keyable = True)


                #get data from UI
                projectName = self.projectComboBox.currentText()
                groupName = self.groupComboBox.currentText()
                charName = self.characterName.text()

                #get user
                for name in ('LOGNAME', 'USER', 'LNAME', 'USERNAME'):
                    user = os.environ.get(name)
                cmds.setAttr(characterNode + ".publishedBy", user, type = "string")


                #version character
                if firstVersion:
                    cmds.setAttr(characterNode + ".version", 1)
                    cmds.setAttr(characterNode + ".versionNote", json.dumps([[1, "initial checkin", cmds.getAttr(characterNode + ".publishedBy")]]), type = "string")

                #if this is not the firstVersion, check to see if it's technically being saved as a new file
                if not firstVersion:
                    #get current data off node
                    currentProj = cmds.getAttr(characterNode + ".project")
                    currentGrp = cmds.getAttr(characterNode + ".group")
                    currentName = cmds.getAttr(characterNode + ".name")

                    if type(currentGrp) == type(None):
                        currentGrp = " "


                    #figure out if this is truly a new version, or if this is getting published as something else
                    doVersion = False
                    if projectName == currentProj:
                        if groupName == currentGrp:
                            if charName == currentName:
                                doVersion = True

                    if doVersion:
                        currentVersion = cmds.getAttr(characterNode + ".version")

                        #find type of revision
                        changeType = self.changeType.currentText()
                        if changeType == "Cosmetic Change":
                            value = .01
                        if changeType == "Minor Change":
                            value = .1
                        if changeType == "Major Change":
                            value = 1

                        cmds.setAttr(characterNode + ".version", currentVersion + value)

                    else:
                        cmds.setAttr(characterNode + ".version", 1)
                        cmds.setAttr(characterNode + ".versionNote", json.dumps([1, "initial checkin", cmds.getAttr(characterNode + ".publishedBy")]), type = "string")

                    #version note
                    string = self.revisionNote.toPlainText()
                    revisionHistory = json.loads(cmds.getAttr(characterNode + ".versionNote"))
                    revisionHistory.append([cmds.getAttr(characterNode + ".version"), string, cmds.getAttr(characterNode + ".publishedBy")])
                    cmds.setAttr(characterNode + ".versionNote", json.dumps(revisionHistory), type = "string")

                #set data on characterNode
                cmds.setAttr(characterNode + ".project", projectName, type = "string")
                cmds.setAttr(characterNode + ".group", groupName, type = "string")
                cmds.setAttr(characterNode + ".name", charName, type = "string")



                #save maya ascii file in path
                selectedProject = self.projectComboBox.currentText()
                fullPath = os.path.join(self.projectPath, selectedProject)
                selectedGroup = self.groupComboBox.currentText()
                if len(selectedGroup) > 1:
                    fullPath = os.path.join(fullPath, selectedGroup)
                else:
                    selectedGroup = None

                #save file
                fullPath = utils.returnFriendlyPath(os.path.join(fullPath, charName + ".ma"))
                cmds.file(rename = fullPath)
                cmds.file(save = True, type = "mayaAscii")


                #repopulate character list
                self.populateCharacters()

                #add info to publishFileInfo
                self.publishFileInfo.append([fullPath, selectedProject, selectedGroup, charName])


                #go to next page
                self.continueToRigPose()

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
    def overwriteCharacterUI(self):
        #Original Author: Jeremy Ernst

        #message box for confirming if character should be overwritten or not
        msgBox = QtWidgets.QMessageBox()
        msgBox.setIcon(QtWidgets.QMessageBox.Warning)
        msgBox.setText("A character already exists with the given name!")
        msgBox.addButton("Overwrite", QtWidgets.QMessageBox.YesRole)
        msgBox.addButton("Cancel", QtWidgets.QMessageBox.NoRole)
        ret = msgBox.exec_()

        if ret == 1:
            return False
        else:
            return True

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
    def overwriteIconUI(self, path):
        #Original Author: Jeremy Ernst

        #message box for confirming if icon should be overwritten or not
        msgBox = QtWidgets.QMessageBox()
        msgBox.setIcon(QtWidgets.QMessageBox.Question)
        msgBox.setText("This asset already has an icon associated with it.")
        msgBox.addButton("Overwrite", QtWidgets.QMessageBox.YesRole)
        msgBox.addButton("Keep Current Icon", QtWidgets.QMessageBox.NoRole)
        msgBox.setDetailedText("Current Icon:\n\n" + path)
        ret = msgBox.exec_()

        if ret == 1:
            return False
        else:
            return True



# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
    def cancelPublish(self):
        #Original Author: Jeremy Ernst

        cmds.deleteUI("ART_PublishWin", wnd = True)

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
    def continueToProject(self):
        #Original Author: Jeremy Ernst

        self.stackWidget.setCurrentIndex(1)

        #populate projects
        self.populateProjects()

        #populate project page info if it exists on character node
        characterNode = utils.returnCharacterModule()

        attrs = cmds.listAttr(characterNode, ud = True)
        for attr in attrs:
            #set project if applicable
            if attr.find("project") == 0:
                project = cmds.getAttr(characterNode + ".project")
                for i in range(self.projectComboBox.count()):
                    item = self.projectComboBox.itemText(i)
                    if item == project:
                        self.projectComboBox.setCurrentIndex(i)

            #set group if applicable
            if attr.find("group") == 0:
                group = cmds.getAttr(characterNode + ".group")
                for i in range(self.groupComboBox.count()):
                    item = self.groupComboBox.itemText(i)
                    if item == group:
                        self.groupComboBox.setCurrentIndex(i)

            #select character, if applicable
            if attr.find("name") == 0:
                name = cmds.getAttr(characterNode + ".name")
                for i in range(self.characterList.count()):
                    item = self.characterList.item(i).text()
                    if item == name:
                        self.characterList.setCurrentRow(i)
                        self.setCharacterName()

            #set pre-script, if applicable
            if attr.find("preScriptPath") == 0:
                path = cmds.getAttr(characterNode + ".preScriptPath")
                self.preScriptLineEdit.setText(path)

            #set post-script, if applicable
            if attr.find("postScriptPath") == 0:
                path = cmds.getAttr(characterNode + ".postScriptPath")
                self.postScriptLineEdit.setText(path)


# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
    def continueToRigPose(self):
        #Original Author: Jeremy Ernst

        self.stackWidget.setCurrentIndex(2)

        self.mainWin.setWindowTitle("Create Rig Pose")

        #if pre/post script slots are empty, and the attrs exist, remove attrs
        characterModule = utils.returnCharacterModule()

        if self.preScriptLineEdit.text() == "":
            if cmds.objExists(characterModule + ".preScriptPath"):
                cmds.deleteAttr(characterModule, at = "preScriptPath")

        if self.postScriptLineEdit.text() == "":
            if cmds.objExists(characterModule + ".postScriptPath"):
                cmds.deleteAttr(characterModule, at = "postScriptPath")


        #setup the interfaces
        for inst in self.mainUI.moduleInstances:
            listItems = []
            for i in range(self.rpPage_moduleList.count()):

                text = self.rpPage_moduleList.item(i).text()
                listItems.append(text)

            if inst.name in listItems:
                inst.rigPose_UI(self.rpPage_stackWidget)

            #set slider states if attribute exists
            networkNode = inst.returnNetworkNode
            if cmds.objExists(networkNode + ".rigPoseState"):
                sliderData = json.loads(cmds.getAttr(networkNode + ".rigPoseState"))


                #create progress bar
                progBar = QtWidgets.QProgressDialog(self.mainWin)
                progBar.setCancelButton(None)
                progBar.setStyleSheet(self.style)
                progBar.setLabelText("Setting rig pose slider values for " + inst.name)
                progBar.setMinimum(0)

                #get the slider children, if there is a match between the name property and the name data in the list, set slider value
                sliders = inst.rigPoseFrame.findChildren(QtWidgets.QSlider)

                progBar.setMaximum(len(sliders))
                progBar.show()

                for slider in sliders:
                    name = slider.property("name")
                    progBar.setValue(progBar.value() + 1)

                    for data in sliderData:
                        sliderName = data.get("name")

                        if sliderName == name:
                            value = data.get("value")
                            inst.setupForRigPose()
                            slider.setValue(value)
                            if cmds.objExists(networkNode + ".rigPose"):
                                inst.setReferencePose("rigPose")
                            inst.cleanUpRigPose()

                progBar.deleteLater()


        self.rpPage_stackWidget.setCurrentIndex(0)

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
    def continueToCreateAnimMesh(self):
        #Original Author: Jeremy Ernst

        #save slider states and rig pose
        for inst in self.mainUI.moduleInstances:
            if inst.name != "root":
                networkNode = inst.returnNetworkNode
                inst.cleanUpRigPose()

                #add attr if it doesn't exist
                if not cmds.objExists(networkNode + ".rigPoseState"):
                    cmds.addAttr(networkNode, ln = "rigPoseState", dt = "string")

                #if rig pose doesn't exist, get and set it
                inst.getReferencePose("rigPose", False)


                #get the sliders from this widget (name and value)
                sliderList = []
                sliders = inst.rigPoseFrame.findChildren(QtWidgets.QSlider)
                for slider in sliders:
                    sliderData = {}
                    sliderData["name"] = slider.property("name")
                    sliderData["value"] = slider.value()

                    sliderList.append(sliderData)

                #set the rigPoseState attr
                jsonString = json.dumps(sliderList)
                cmds.setAttr(networkNode + ".rigPoseState", jsonString, type = "string")

        #get the character node
        characterNode = utils.returnCharacterModule()

        #go to next UI page
        self.mainWin.setWindowTitle("Create Animation Mesh")
        self.stackWidget.setCurrentIndex(3)
        self.movie.start()


# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
    def skipToCreateThumbnail(self):
        #Original Author: Jeremy Ernst

        #get the character node
        characterNode = utils.returnCharacterModule()

        #get the icon path if present
        if cmds.objExists(characterNode + ".iconPath"):
            path = cmds.getAttr(characterNode + ".iconPath")
            if os.path.exists(utils.returnNicePath(self.projectPath,path)):
                toContinue = self.overwriteIconUI(path)

                # if the user wants to overwrite the existing icon
                if toContinue:

                    self.stackWidget.setCurrentIndex(4)
                    self.mainWin.setWindowTitle("Create Thumbnail")
                # if the user wants to keep the existing icon
                else:
                    self.continueToSummary(True)

            # if the icon path did not exist on disc
            else:
                self.stackWidget.setCurrentIndex(4)
                self.mainWin.setWindowTitle("Create Thumbnail")

        else:
            self.stackWidget.setCurrentIndex(4)
            self.mainWin.setWindowTitle("Create Thumbnail")



# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
    def continueToCreateThumbnail(self):
        #Original Author: Jeremy Ernst

        #get the character node
        characterNode = utils.returnCharacterModule()

        #get asset name
        name = cmds.getAttr(characterNode + ".name")

        #get LOD0 meshes
        if cmds.objExists(characterNode + ".LOD_0"):
            jsonData = json.loads(cmds.getAttr(characterNode + ".LOD_0"))
            meshes = jsonData.get("Meshes")
        else:
            meshes = utils.findAllSkinnableGeo()

        for mesh in meshes:
            newMesh = utils.splitMesh(mesh, name)
            cmds.select(newMesh)

            #select all new meshes and add to layer if layer doesn't exist
            if not cmds.objExists("Animation_Mesh_Geo"):
                cmds.createDisplayLayer(newMesh, name = "Animation_Mesh_Geo")

            else:
                cmds.editDisplayLayerMembers("Animation_Mesh_Geo", newMesh)


        #get the icon path if present
        cmds.select(clear = True)
        if cmds.objExists(characterNode + ".iconPath"):
            path = cmds.getAttr(characterNode + ".iconPath")
            if os.path.exists(utils.returnNicePath(self.projectPath, path)):
                toContinue = self.overwriteIconUI(path)
                if toContinue:

                    self.stackWidget.setCurrentIndex(5)
                    self.mainWin.setWindowTitle("Create Thumbnail")

                else:
                    self.continueToSummary(True)
        else:
            self.stackWidget.setCurrentIndex(5)
            self.mainWin.setWindowTitle("Create Thumbnail")



# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
    def continueToSummary(self, skip):


        #set window title
        self.mainWin.setWindowTitle("Summary")

        #get character attributes to build up the path
        characterNode = utils.returnCharacterModule()
        project = cmds.getAttr(characterNode + ".project")
        group = cmds.getAttr(characterNode + ".group")
        name = cmds.getAttr(characterNode + ".name")
        version = cmds.getAttr(characterNode + ".version")


        #create the path
        if len(group) > 1:
            path = utils.returnFriendlyPath(project + "/" + group + "/" + name + ".png")
        else:
            path = utils.returnFriendlyPath(project + "/" + name + ".png")

        #add icon attr to character node if needed
        if not cmds.objExists(characterNode + ".iconPath"):
            cmds.addAttr(characterNode, ln = "iconPath", dt = "string", keyable = True)

        cmds.setAttr(characterNode + ".iconPath", path, type = "string")

        #render our images if needed
        if not skip:
            if self.viewportToggle.currentIndex() == 1:

                #use API to grab image from view
                newView = mui.M3dView()
                view = mui.M3dView.getM3dViewFromModelEditor(self.tcViewport, newView)

                #read the color buffer from the view, and save the MImage to disk
                image = openMaya.MImage()
                newView.readColorBuffer(image, True)
                image.writeToFile(utils.returnNicePath(self.projectPath, path), 'png')


            #if user passed in an image, save it to the appropriate location with the correct extension
            else:
                customPath = self.customThumbnail.text()
                print customPath, path

                import shutil
                shutil.copyfile(customPath, utils.returnNicePath(self.projectPath, path))


        #switch to summary page
        self.stackWidget.setCurrentIndex(5)

        #find if pre/post script added
        preScript = False
        if cmds.objExists(characterNode + ".preScript"):
            preScript = True

        postScript = False
        if cmds.objExists(characterNode + ".postScript"):
            postScript = True

        #get latest icon
        self.sumPageIcon.setStyleSheet("background-image: url(" + utils.returnNicePath(self.projectPath, path) + ");")

        #set info
        self.sumPageAssetName.setText(name)
        self.sumPageProj.setText(project)
        self.sumPageGroup.setText(group)
        self.sumPageRevisionType.setText(str(version))
        self.sp_preScriptCB.setChecked(preScript)
        self.sp_postScriptCB.setChecked(postScript)

        if cmds.objExists(name + "_animMeshGrp"):
            self.sp_animMeshCB.setChecked(True)


# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
    def backToMeshIconCreation(self):

        self.stackWidget.setCurrentIndex(4)
        self.mainWin.setWindowTitle("Create Thumbnail")


# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
    def backToMeshSlicer(self):

        self.stackWidget.setCurrentIndex(3)
        self.mainWin.setWindowTitle("Create Animation Mesh")

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
    def backToProject(self):
        #Original Author: Jeremy Ernst

        self.stackWidget.setCurrentIndex(1)
        self.mainWin.setWindowTitle("Publish")


        #make sure we hide all joint movers when going back and put things in the proper state
        for inst in self.mainUI.moduleInstances:
            listItems = []
            for i in range(self.rpPage_moduleList.count()):

                text = self.rpPage_moduleList.item(i).text()
                listItems.append(text)

            if inst.name in listItems:
                inst.cleanUpRigPose()

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
    def backToRigPose(self):
        #Original Author: Jeremy Ernst

        self.stackWidget.setCurrentIndex(2)
        self.mainWin.setWindowTitle("Create Rig Pose")


# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
    def addCustomScripts(self, preScript, postScript):
        #Original Author: Jeremy Ernst

        #launch the file dialog window
        try:
            fileName = cmds.fileDialog2(startingDirectory = cmds.internalVar(usd = True), ff = "*.py;;*.mel", fm = 1, okCaption = "Load Script")[0]
            fileName = utils.returnFriendlyPath(fileName)

        except:
            return

        #add attributes if they don't exist to character node
        characterNode = utils.returnCharacterModule()

        #edit the lineEdit to have the path to the script
        if preScript:
            self.preScriptLineEdit.setText(fileName)

            if not cmds.objExists(characterNode + ".preScriptPath"):
                cmds.addAttr(characterNode, ln = "preScriptPath", dt = "string", keyable = True)

            #set attrs
            cmds.setAttr(characterNode + ".preScriptPath", fileName, type = "string")


        #edit the lineEdit to have the path to the script
        if postScript:
            self.postScriptLineEdit.setText(fileName)

            if not cmds.objExists(characterNode + ".postScriptPath"):
                cmds.addAttr(characterNode, ln = "postScriptPath", dt = "string", keyable = True)

            #set attrs
            cmds.setAttr(characterNode + ".postScriptPath", fileName, type = "string")

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
    def publishHelp(self):
        #Original Author: Jeremy Ernst

        import ART_Help
        reload(ART_Help)

        helpMovie = utils.returnFriendlyPath(os.path.join(self.iconsPath, "Help/publish.gif"))
        helpInst = ART_Help.ART_HelpMovie(self.mainWin, helpMovie)

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
    def rigPoseHelp(self):
        #Original Author: Jeremy Ernst

        import ART_Help
        reload(ART_Help)

        helpMovie = utils.returnFriendlyPath(os.path.join(self.iconsPath, "Help/rigPose.gif"))
        helpInst = ART_Help.ART_HelpMovie(self.mainWin, helpMovie)

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
    def launchBuild(self):
        #Original Author: Jeremy Ernst

        if cmds.window("ART_PublishWin", exists = True):
            cmds.deleteUI("ART_PublishWin", wnd = True)

        #save the file
        cmds.file(save = True)

        #launch build progress UI
        import ART_BuildProgressUI
        reload(ART_BuildProgressUI)
        ART_BuildProgressUI.ART_BuildProgress_UI(self.mainUI)

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
    def closeWin(self, event):
        #Original Author: Jeremy Ernst

        if cmds.window("ART_PublishWin", exists = True):
            self.mainWin.close()

        #override the close event for the window with a custom function that makes sure the scene is cleaned up
        #delete the light and camera rig for the icon creator
        try:
            for node in [self.thumbnailCamera, self.lightGrp]:
                children = cmds.listRelatives(node, children = True)
                if len(children) > 0:
                    for each in children:
                        cmds.lockNode(each, lock = False)
                cmds.lockNode(node, lock = False)
                cmds.delete(node)
        except:
            pass

        for inst in self.mainUI.moduleInstances:
            try:
                #call on the module's bakeOffsets method
                inst.setupForRigPose()
                inst.setReferencePose("modelPose")
                inst.cleanUpRigPose()
            except Exception, e:
                print e

        event.accept()