39
39
2024-06-10 : v1.2.0 : Rearranging some of the App import UI elements. Bugfixing
40
40
App.importSkin : It wasn't closing the undoChunk. Adding the 'Auto-Fix Broken
41
41
skinCluster' to the 'Extras' tab. Updating tooltips, making multi-line.
42
+ 2024-10-26 : v1.3.0 : Updating to support PySide6, adding 'Reset Preferences'
43
+ button to the 'Extras' tab.
42
44
43
45
Examples:
44
46
54
56
55
57
from maya .app .general .mayaMixin import MayaQWidgetBaseMixin
56
58
57
- from PySide2 import QtWidgets , QtCore , QtGui
58
-
59
- from . import core , utils
59
+ try :
60
+ from PySide6 import QtWidgets , QtCore , QtGui
61
+ except :
62
+ from PySide2 import QtWidgets , QtCore , QtGui
60
63
64
+ from . import utils
65
+ from . import core
61
66
from . import __version__ , __documentation__ , __source__
62
67
63
68
#-----------------------
@@ -168,6 +173,7 @@ def __init__(self, vcExecCmd=None, vcDepotRoot=None, autoFillSubdir=None, docsOv
168
173
iconPath = utils .getIconPath ()
169
174
if iconPath :
170
175
self .setWindowIcon (QtGui .QIcon (iconPath ))
176
+ utils .confirmDependencies ()
171
177
172
178
self .nnOptions = []
173
179
self .weightPaths = []
@@ -382,7 +388,7 @@ def populate(self):
382
388
self .widget_unbindFirst = QtWidgets .QCheckBox ("Unbind First?" )
383
389
layout_moreOptions .addWidget (self .widget_unbindFirst )
384
390
self .widget_unbindFirst .setToolTip ("If any mesh is currently skinned, unbind it before import?\n This will set the mesh back to the bindpose before the import.\n Otherwise the old/new skinning is merged together." )
385
- if self .settings .value (SETTING_UNBIND_FIRST , True ):
391
+ if self .settings .value (SETTING_UNBIND_FIRST , False ):
386
392
self .widget_unbindFirst .setChecked (True )
387
393
self .widget_unbindFirst .clicked .connect (self .cbUnbindFirst )
388
394
layout_import .addWidget (makeSeparator ())
@@ -619,12 +625,21 @@ def populate(self):
619
625
layout_docs .addWidget (widget_docs )
620
626
widget_docs .clicked .connect (self .cbShowDocs )
621
627
622
- self .widget_verboseLogging = QtWidgets .QCheckBox ("Verbose Logging?" )
623
- layout_extrasGrid .addWidget (self .widget_verboseLogging , 1 ,0 )
624
- self .widget_verboseLogging .setToolTip ("Print verbose results of the import/export operations to the Maya Script Editor?\n If this is unchecked, nothing (unless errors) will be printed to the Script Editor." )
625
- if self .settings .value (SETTING_VERBOSE_LOG , True ):
626
- self .widget_verboseLogging .setChecked (True )
627
- self .widget_verboseLogging .clicked .connect (self .cbVerboseLog )
628
+ layout_loggingResetPrefs = QtWidgets .QHBoxLayout ()
629
+ layout_extrasGrid .addLayout (layout_loggingResetPrefs , 1 ,0 )
630
+ if layout_loggingResetPrefs :
631
+
632
+ self .widget_verboseLogging = QtWidgets .QCheckBox ("Verbose Logging?" )
633
+ layout_loggingResetPrefs .addWidget (self .widget_verboseLogging )
634
+ self .widget_verboseLogging .setToolTip ("Print verbose results of the import/export operations to the Maya Script Editor?\n If this is unchecked, nothing (unless errors) will be printed to the Script Editor." )
635
+ if self .settings .value (SETTING_VERBOSE_LOG , True ):
636
+ self .widget_verboseLogging .setChecked (True )
637
+ self .widget_verboseLogging .clicked .connect (self .cbVerboseLog )
638
+
639
+ widget_resetBut = QtWidgets .QPushButton ("Reset Preferences" )
640
+ widget_resetBut .setToolTip ("Reset all user changed values back to defaults." )
641
+ layout_loggingResetPrefs .addWidget (widget_resetBut )
642
+ widget_resetBut .clicked .connect (self .cbResetSettings )
628
643
629
644
layout_autoFill = QtWidgets .QHBoxLayout ()
630
645
layout_extrasGrid .addLayout (layout_autoFill , 1 ,1 )
@@ -881,7 +896,7 @@ def cbMissingInfs(self):
881
896
Callback executed to save the state of the 'Build Missing Influences?'
882
897
checkbox.
883
898
"""
884
- if self .widget_buildMissingInfs .checkState ():
899
+ if self .widget_buildMissingInfs .isChecked ():
885
900
self .settings .setValue (SETTING_BUILD_MISSING_INFS , 1 )
886
901
else :
887
902
self .settings .setValue (SETTING_BUILD_MISSING_INFS , 0 )
@@ -891,7 +906,7 @@ def cbForceUberChunk(self):
891
906
Callback executed to save the state of the 'Force Import From UberChunk?'
892
907
checkbox.
893
908
"""
894
- if self .widget_forceUberChunk .checkState ():
909
+ if self .widget_forceUberChunk .isChecked ():
895
910
self .settings .setValue (SETTING_FORCE_UBERCHUNK , 1 )
896
911
else :
897
912
self .settings .setValue (SETTING_FORCE_UBERCHUNK , 0 )
@@ -902,7 +917,7 @@ def cbSelInstead(self):
902
917
"""
903
918
Callback executed to save the state of the 'Select instead of skin' checkbox.
904
919
"""
905
- if self .widget_selectInstead .checkState ():
920
+ if self .widget_selectInstead .isChecked ():
906
921
self .settings .setValue (SETTING_SELECT_INSTEAD , 1 )
907
922
else :
908
923
self .settings .setValue (SETTING_SELECT_INSTEAD , 0 )
@@ -911,7 +926,7 @@ def cbVerboseLog(self):
911
926
"""
912
927
Callback executed to save the state of the 'Verbose Logging?'checkbox.
913
928
"""
914
- if self .widget_verboseLogging .checkState ():
929
+ if self .widget_verboseLogging .isChecked ():
915
930
self .settings .setValue (SETTING_VERBOSE_LOG , 1 )
916
931
else :
917
932
self .settings .setValue (SETTING_VERBOSE_LOG , 0 )
@@ -1036,7 +1051,7 @@ def cbExportSetToBindpose(self):
1036
1051
Callback executed to save the state of the 'Set To Bindpose?' checkbox in the
1037
1052
export tab.
1038
1053
"""
1039
- if self .widget_exportSetBindpose .checkState ():
1054
+ if self .widget_exportSetBindpose .isChecked ():
1040
1055
self .settings .setValue (SETTING_EXPORT_SET_TO_BINDPOSE , 1 )
1041
1056
else :
1042
1057
self .settings .setValue (SETTING_EXPORT_SET_TO_BINDPOSE , 0 )
@@ -1048,7 +1063,7 @@ def cbImpoprtUsingPreDeformedShapePos(self):
1048
1063
Positions?' checkbox in the import tab. It also unchecks 'Set To Bindpose'
1049
1064
and 'Unbind First'.
1050
1065
"""
1051
- if self .widget_usePreDeformedShape .checkState ():
1066
+ if self .widget_usePreDeformedShape .isChecked ():
1052
1067
self .settings .setValue (SETTINGS_IMPORT_USE_PRE_DEFORMED_SHAPE , 1 )
1053
1068
1054
1069
self .widget_importSetBindpose .setChecked (False )
@@ -1063,7 +1078,7 @@ def cbImportSetToBindpose(self):
1063
1078
Callback executed to save the state of the 'Set To Bindpose?' checkbox in the
1064
1079
import tab. This also unchecks 'Import Using Pre-Deformed Shape Positions?'.
1065
1080
"""
1066
- if self .widget_importSetBindpose .checkState ():
1081
+ if self .widget_importSetBindpose .isChecked ():
1067
1082
self .settings .setValue (SETTING_IMPORT_SET_TO_BINDPOSE , 1 )
1068
1083
1069
1084
self .widget_usePreDeformedShape .setChecked (False )
@@ -1077,7 +1092,7 @@ def cbUnbindFirst(self):
1077
1092
It also unchecks 'Import Using Pre-Deformed Shape Positions?' and enables
1078
1093
'Set To Bindpose'.
1079
1094
"""
1080
- if self .widget_unbindFirst .checkState ():
1095
+ if self .widget_unbindFirst .isChecked ():
1081
1096
self .settings .setValue (SETTING_UNBIND_FIRST , 1 )
1082
1097
1083
1098
self .widget_importSetBindpose .setChecked (True )
@@ -1088,6 +1103,12 @@ def cbUnbindFirst(self):
1088
1103
else :
1089
1104
self .settings .setValue (SETTING_UNBIND_FIRST , 0 )
1090
1105
1106
+ def cbResetSettings (self ):
1107
+ """
1108
+ Reset any user=based settings.
1109
+ """
1110
+ self .settings .clear ()
1111
+ App ()
1091
1112
1092
1113
#------------------
1093
1114
# Actions
@@ -1105,7 +1126,7 @@ def printSkinInfo(self):
1105
1126
printArgs = {}
1106
1127
for checkbox in self .widgets_printerCheckBoxes :
1107
1128
text = checkbox .text ()
1108
- checked = int (checkbox .checkState ())
1129
+ checked = int (checkbox .isChecked ())
1109
1130
if checked :
1110
1131
printArgs [text ] = True
1111
1132
else :
@@ -1165,13 +1186,13 @@ def importSkin(self, mode="browser"):
1165
1186
fallbackSkinningMethod = "closestNeighbors"
1166
1187
elif uiFallbackSkinMethod == "Closest Point" :
1167
1188
fallbackSkinningMethod = "closestPoint"
1168
- buildMissingInfs = True if int (self .widget_buildMissingInfs .checkState ()) else False
1189
+ buildMissingInfs = True if int (self .widget_buildMissingInfs .isChecked ()) else False
1169
1190
setToBindpose = self .widget_importSetBindpose .isChecked ()
1170
- forceUberChunk = True if int (self .widget_forceUberChunk .checkState ()) else False
1171
- importUsingPreDeformedPoints = True if int (self .widget_usePreDeformedShape .checkState ()) else False
1172
- unbindFirst = True if int (self .widget_unbindFirst .checkState ()) else False
1173
- selInsteadOfSkin = True if int (self .widget_selectInstead .checkState ()) else False
1174
- verbose = True if int (self .widget_verboseLogging .checkState ()) else False #!!! NEED TO FIX
1191
+ forceUberChunk = True if int (self .widget_forceUberChunk .isChecked ()) else False
1192
+ importUsingPreDeformedPoints = True if int (self .widget_usePreDeformedShape .isChecked ()) else False
1193
+ unbindFirst = True if int (self .widget_unbindFirst .isChecked ()) else False
1194
+ selInsteadOfSkin = True if int (self .widget_selectInstead .isChecked ()) else False
1195
+ verbose = True if int (self .widget_verboseLogging .isChecked ()) else False #!!! NEED TO FIX
1175
1196
printOverview = False
1176
1197
printOverviewMode = "byImportType"
1177
1198
checkedButWidget = self .widget_importOvererviewGroup .checkedButton ()
@@ -1270,7 +1291,7 @@ def exportSkin(self, mode="browser"):
1270
1291
elif mode == "temp" :
1271
1292
path = core .TEMP_FILE_PATH
1272
1293
1273
- verbose = True if int (self .widget_verboseLogging .checkState ()) else False
1294
+ verbose = True if int (self .widget_verboseLogging .isChecked ()) else False
1274
1295
1275
1296
setToBindPose = self .widget_exportSetBindpose .isChecked ()
1276
1297
0 commit comments