From b62ca8570c6016f9c62b0165c8659a2cbed22f40 Mon Sep 17 00:00:00 2001 From: Eugene Date: Mon, 22 Jul 2024 12:34:28 -0700 Subject: [PATCH 01/16] cleanup --- GETOOLS_SOURCE/_prototypes/Dialogs.py | 27 +++++++++++++++++++ GETOOLS_SOURCE/_prototypes/Namespaces.py | 6 ++--- .../_prototypes/SetAttributesBySimpleName.py | 2 +- .../ToggleChannelBoxAndAttributeEditor.py | 4 +-- GETOOLS_SOURCE/_prototypes/ToggleValues.py | 14 +++++----- GETOOLS_SOURCE/modules/GeneralWindow.py | 2 +- GETOOLS_SOURCE/modules/Overlappy.py | 20 +++++++------- GETOOLS_SOURCE/utils/Layers.py | 8 +++--- GETOOLS_SOURCE/utils/Scene.py | 2 +- 9 files changed, 56 insertions(+), 29 deletions(-) create mode 100644 GETOOLS_SOURCE/_prototypes/Dialogs.py diff --git a/GETOOLS_SOURCE/_prototypes/Dialogs.py b/GETOOLS_SOURCE/_prototypes/Dialogs.py new file mode 100644 index 0000000..325f227 --- /dev/null +++ b/GETOOLS_SOURCE/_prototypes/Dialogs.py @@ -0,0 +1,27 @@ +import maya.cmds as cmds + +cmds.confirmDialog( + title = "Zero offset detected", + message = "For ROTATION BAKING need to use particle offset with non zero values.\nIf offset is zero the particle will remain on the same position as original object, so no rotation will be generated.\n", + messageAlign = "left", + icon = "warning", + + button = ["Continue anyway","Cancel"], + annotation = ["bla", "qwe"], + + defaultButton = "Cancel", + cancelButton = "Cancel", + + dismissString = "Dismissed" + ) + + +# Maya 2022+ +cmds.framelessDialog( + title = "Zero offset detected", + message = "For ROTATION BAKING need to use particle offset with non zero values.\nIf offset is zero the particle will remain on the same position as original object, so no rotation will be generated.\n", + path = "OVERLAPPY\Particle Offset\MoveX-Y-Z", + button = ["Bake with zero offset", "Cancel"], + primary = ["OK"] + ) + diff --git a/GETOOLS_SOURCE/_prototypes/Namespaces.py b/GETOOLS_SOURCE/_prototypes/Namespaces.py index ebdadc4..91af0a9 100644 --- a/GETOOLS_SOURCE/_prototypes/Namespaces.py +++ b/GETOOLS_SOURCE/_prototypes/Namespaces.py @@ -19,18 +19,18 @@ def ClearRigNamespaces(_namespace=''): def NamespacesFromSelected(self, *args): selected = cmds.ls(sl = 1) - if(selected): + if (selected): namespaces = list("") for i in range(len(selected)): namespace = selected[i].split(':')[0] # Empty namespace count = selected[i].split(':') - if(len(count) < 2): + if (len(count) < 2): namespace = "" for i in range(len(selected)): - if(namespace not in namespaces): + if (namespace not in namespaces): namespaces.append(namespace) return selected, namespaces diff --git a/GETOOLS_SOURCE/_prototypes/SetAttributesBySimpleName.py b/GETOOLS_SOURCE/_prototypes/SetAttributesBySimpleName.py index 2c8018f..4a4e0d2 100644 --- a/GETOOLS_SOURCE/_prototypes/SetAttributesBySimpleName.py +++ b/GETOOLS_SOURCE/_prototypes/SetAttributesBySimpleName.py @@ -4,7 +4,7 @@ def FindAllObjects(objName): objects = cmds.ls(type = "transform", long = True) result = [] for item in objects: - if(item.endswith("|" + objName) or item.endswith(":" + objName)): + if (item.endswith("|" + objName) or item.endswith(":" + objName)): result.append(item) return result diff --git a/GETOOLS_SOURCE/_prototypes/ToggleChannelBoxAndAttributeEditor.py b/GETOOLS_SOURCE/_prototypes/ToggleChannelBoxAndAttributeEditor.py index acfc108..a9e1baa 100644 --- a/GETOOLS_SOURCE/_prototypes/ToggleChannelBoxAndAttributeEditor.py +++ b/GETOOLS_SOURCE/_prototypes/ToggleChannelBoxAndAttributeEditor.py @@ -1,8 +1,8 @@ -if(`isChannelBoxRaised`) +if (`isChannelBoxRaised`) { openAEWindow; } -else if(`isAttributeEditorRaised`) +else if (`isAttributeEditorRaised`) { raiseChannelBox; } \ No newline at end of file diff --git a/GETOOLS_SOURCE/_prototypes/ToggleValues.py b/GETOOLS_SOURCE/_prototypes/ToggleValues.py index 9fe2201..36c4517 100644 --- a/GETOOLS_SOURCE/_prototypes/ToggleValues.py +++ b/GETOOLS_SOURCE/_prototypes/ToggleValues.py @@ -9,7 +9,7 @@ resultNamespace = selected.split(':')[0] count = selected.split(':') -if(len(count) < 2): +if (len(count) < 2): resultNamespace = None attributePath = selected + ".translateY" @@ -17,23 +17,23 @@ currentValue = cmds.getAttr(attributePath) resultValue = None -if(currentValue < toggleValue[0]): +if (currentValue < toggleValue[0]): resultValue = toggleValue[0] -elif(currentValue > toggleValue[1]): +elif (currentValue > toggleValue[1]): resultValue = toggleValue[1] -elif(currentValue > toggleValue[0] and currentValue < toggleValue[1]): +elif (currentValue > toggleValue[0] and currentValue < toggleValue[1]): mathResult = currentValue - (toggleValue[1] - toggleValue[0]) / 2 - if(mathResult <= 0): + if (mathResult <= 0): resultValue = toggleValue[0] else: resultValue = toggleValue[1] -elif(currentValue == toggleValue[0]): +elif (currentValue == toggleValue[0]): resultValue = toggleValue[1] -elif(currentValue == toggleValue[1]): +elif (currentValue == toggleValue[1]): resultValue = toggleValue[0] cmds.setAttr(attributePath, resultValue) diff --git a/GETOOLS_SOURCE/modules/GeneralWindow.py b/GETOOLS_SOURCE/modules/GeneralWindow.py index bc846ae..e670244 100644 --- a/GETOOLS_SOURCE/modules/GeneralWindow.py +++ b/GETOOLS_SOURCE/modules/GeneralWindow.py @@ -43,7 +43,7 @@ class GeneralWindow: - version = "v1.1.0" + version = "v1.1.1" name = "GETools" title = name + " " + version diff --git a/GETOOLS_SOURCE/modules/Overlappy.py b/GETOOLS_SOURCE/modules/Overlappy.py index 8f4f28e..f8e544e 100644 --- a/GETOOLS_SOURCE/modules/Overlappy.py +++ b/GETOOLS_SOURCE/modules/Overlappy.py @@ -482,7 +482,7 @@ def _SetupCreate(self, objCurrent, *args): # TODO replace locators by locators c self.nucleusNodesAfter = cmds.ls(type = "nucleus") nodesForRemoving = [item for item in self.nucleusNodesAfter if item not in self.nucleusNodesBefore] for item in nodesForRemoving: - if(item != self.nucleus): + if (item != self.nucleus): # cmds.warning("extra node deleted {0}".format(item)) cmds.delete(item) @@ -858,9 +858,9 @@ def _BakeLogic(self, parent, zeroOffsets=False, translation=True, deleteSetupLoc for i in range(len(_attrs)): _keyed = cmds.keyframe(_attrs[i], query = True) - if(_keyed): + if (_keyed): _muted = cmds.mute(_attrs[i], query = True) - if(_muted): + if (_muted): continue _locked = cmds.getAttr(_attrs[i], lock = True) @@ -869,16 +869,16 @@ def _BakeLogic(self, parent, zeroOffsets=False, translation=True, deleteSetupLoc _constrained = False _connections = cmds.listConnections(_attrs[i]) - if(_connections): + if (_connections): for item in _connections: _type = cmds.nodeType(item) - if(_type in Enums.Constraints.list): + if (_type in Enums.Constraints.list): _constrained = True - if(not _locked and _keyable and _settable and not _constrained): + if (not _locked and _keyable and _settable and not _constrained): _attributesFiltered.append(_attributesType[i]) - if(len(_attributesFiltered) == 0): + if (len(_attributesFiltered) == 0): cmds.warning("No attributes. Overlappy setup deleted") self._SetupDelete() return @@ -995,7 +995,7 @@ def RunBakeLogicVariant(): ### LAYERS def _LayerCreate(self, name, *args): # TODO additional naming for translation and rotation # Create main layer - if(not cmds.objExists(OverlappySettings.nameLayers[0])): + if (not cmds.objExists(OverlappySettings.nameLayers[0])): self.layers[0] = Layers.Create(layerName = OverlappySettings.nameLayers[0]) # Create layers on selected @@ -1012,7 +1012,7 @@ def _LayerMoveToSafeOrTemp(self, safeLayer=True, *args): # TODO rework # Check source layer - if(not cmds.objExists(_layer1)): + if (not cmds.objExists(_layer1)): cmds.warning("Layer \"{0}\" doesn't exist".format(_layer1)) return @@ -1050,7 +1050,7 @@ def _LayerMoveToSafeOrTemp(self, safeLayer=True, *args): # TODO rework # Create safe layer - if(not cmds.objExists(_layer2)): + if (not cmds.objExists(_layer2)): self.layers[_id[1]] = cmds.animLayer(_layer2, override = True) diff --git a/GETOOLS_SOURCE/utils/Layers.py b/GETOOLS_SOURCE/utils/Layers.py index c58a3f3..1e54c37 100644 --- a/GETOOLS_SOURCE/utils/Layers.py +++ b/GETOOLS_SOURCE/utils/Layers.py @@ -31,7 +31,7 @@ def Create(layerName, parent=LayerBase, *args): - # if(cmds.objExists(layerName)): + # if (cmds.objExists(layerName)): # cmds.warning("Layer \"{0}\" already exists".format(layerName)) # return None # else: @@ -50,7 +50,7 @@ def CreateForSelected(selected, parent=LayerBase, prefix=LayerPrefix, *args): return layers def Delete(layerName, *args): - if(cmds.objExists(layerName)): + if (cmds.objExists(layerName)): cmds.delete(layerName) print("Layer \"{0}\" deleted".format(layerName)) else: @@ -58,11 +58,11 @@ def Delete(layerName, *args): def MoveChildrenToParent(children, parent): # TODO rework # Check child layer - # if(not cmds.objExists(layerChild)): + # if (not cmds.objExists(layerChild)): # cmds.warning("Layer \"{0}\" doesn't exist".format(layerChild)) # return # # Check parent layer - # if(not cmds.objExists(layerParent)): + # if (not cmds.objExists(layerParent)): # cmds.warning("Layer \"{0}\" doesn't exist".format(layerParent)) # return diff --git a/GETOOLS_SOURCE/utils/Scene.py b/GETOOLS_SOURCE/utils/Scene.py index 57b7893..1f6795e 100644 --- a/GETOOLS_SOURCE/utils/Scene.py +++ b/GETOOLS_SOURCE/utils/Scene.py @@ -26,7 +26,7 @@ def Reload(*args): currentScene = cmds.file(query = True, sceneName = True) - if(currentScene): + if (currentScene): cmds.file(currentScene, open = True, force = True) else: cmds.file(newFile = True, force = True) From 8a6fa1caabbc16693b642f4ac92a664ce2b30ac6 Mon Sep 17 00:00:00 2001 From: Eugene Date: Mon, 22 Jul 2024 13:35:31 -0700 Subject: [PATCH 02/16] Added confirm dialog for zero particle offset --- GETOOLS_SOURCE/modules/GeneralWindow.py | 2 +- GETOOLS_SOURCE/modules/Overlappy.py | 27 ++++++++++++++++++++++--- changelog.txt | 3 +++ 3 files changed, 28 insertions(+), 4 deletions(-) diff --git a/GETOOLS_SOURCE/modules/GeneralWindow.py b/GETOOLS_SOURCE/modules/GeneralWindow.py index e670244..6c17480 100644 --- a/GETOOLS_SOURCE/modules/GeneralWindow.py +++ b/GETOOLS_SOURCE/modules/GeneralWindow.py @@ -43,7 +43,7 @@ class GeneralWindow: - version = "v1.1.1" + version = "v1.2.0" name = "GETools" title = name + " " + version diff --git a/GETOOLS_SOURCE/modules/Overlappy.py b/GETOOLS_SOURCE/modules/Overlappy.py index f8e544e..2182f3a 100644 --- a/GETOOLS_SOURCE/modules/Overlappy.py +++ b/GETOOLS_SOURCE/modules/Overlappy.py @@ -125,7 +125,7 @@ class OverlappySettings: rangeOffsetZ = (float("-inf"), float("inf"), 0, 100) class Overlappy: - version = "v2.8" + version = "v2.9" name = "OVERLAPPY" title = name + " " + version @@ -843,15 +843,36 @@ def _ResetOffsets(self, *args): ### BAKE def _BakeLogic(self, parent, zeroOffsets=False, translation=True, deleteSetupLock=False, *args): + # Check zero particle offset + if (not translation): + _checkOffsetX = self.sliderOffsetX.Get() == 0 + _checkOffsetY = self.sliderOffsetY.Get() == 0 + _checkOffsetZ = self.sliderOffsetZ.Get() == 0 + if (_checkOffsetX and _checkOffsetY and _checkOffsetZ): + dialogResult = cmds.confirmDialog( + title = "Zero particle offset detected", + message = "For ROTATION BAKING, set the particle offset to non-zero values.\nIf all XYZ values are zero, the particle will stay in the same position as the original object, and no rotation will occur.\n", + messageAlign = "left", + icon = "warning", + button = ["Continue anyway", "Cancel"], + annotation = ["Bake with zero offset, no useful animation will be baked", "Cancel baking operation"], + defaultButton = "Cancel", + cancelButton = "Cancel", + dismissString = "TODO: dismissString" + ) + if (dialogResult == "Cancel"): + print("Baking cancelled") + self._SetupDelete() + return + # Filter attributes - _item = self.selectedObject - if (translation): _attributesType = Enums.Attributes.translateShort else: _attributesType = Enums.Attributes.rotateShort _attrs = ["", "", ""] + _item = self.selectedObject for i in range(len(_attrs)): _attrs[i] = "{0}.{1}".format(_item, _attributesType[i]) _attributesFiltered = [] diff --git a/changelog.txt b/changelog.txt index 42bcfc0..a757291 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,8 @@ GETools changelog +v1.2.0 +- [OVERLAPPY] Added confirm dialog for zero particle offset. + v1.1.0 - [CRITICAL] Fixed compatibility with Maya 2025. - [RIGGING] Added "Extract Shapes" logic from blendshapes. From 97e3f2f5a9a9f51febffcdd1a7289d5cd89cc0ef Mon Sep 17 00:00:00 2001 From: Eugene Date: Mon, 22 Jul 2024 14:19:45 -0700 Subject: [PATCH 03/16] move confirm dialog to the upper logic level --- GETOOLS_SOURCE/modules/Overlappy.py | 43 ++++++++++++++--------------- 1 file changed, 21 insertions(+), 22 deletions(-) diff --git a/GETOOLS_SOURCE/modules/Overlappy.py b/GETOOLS_SOURCE/modules/Overlappy.py index 2182f3a..6f33aaf 100644 --- a/GETOOLS_SOURCE/modules/Overlappy.py +++ b/GETOOLS_SOURCE/modules/Overlappy.py @@ -843,28 +843,6 @@ def _ResetOffsets(self, *args): ### BAKE def _BakeLogic(self, parent, zeroOffsets=False, translation=True, deleteSetupLock=False, *args): - # Check zero particle offset - if (not translation): - _checkOffsetX = self.sliderOffsetX.Get() == 0 - _checkOffsetY = self.sliderOffsetY.Get() == 0 - _checkOffsetZ = self.sliderOffsetZ.Get() == 0 - if (_checkOffsetX and _checkOffsetY and _checkOffsetZ): - dialogResult = cmds.confirmDialog( - title = "Zero particle offset detected", - message = "For ROTATION BAKING, set the particle offset to non-zero values.\nIf all XYZ values are zero, the particle will stay in the same position as the original object, and no rotation will occur.\n", - messageAlign = "left", - icon = "warning", - button = ["Continue anyway", "Cancel"], - annotation = ["Bake with zero offset, no useful animation will be baked", "Cancel baking operation"], - defaultButton = "Cancel", - cancelButton = "Cancel", - dismissString = "TODO: dismissString" - ) - if (dialogResult == "Cancel"): - print("Baking cancelled") - self._SetupDelete() - return - # Filter attributes if (translation): _attributesType = Enums.Attributes.translateShort @@ -985,6 +963,27 @@ def _BakeVariants(self, variant, *args): _selected = Selector.MultipleObjects() if (_selected == None): return + + # Check zero particle offset + if variant in [3, 4, 5]: + _checkOffsetX = self.sliderOffsetX.Get() == 0 + _checkOffsetY = self.sliderOffsetY.Get() == 0 + _checkOffsetZ = self.sliderOffsetZ.Get() == 0 + if (_checkOffsetX and _checkOffsetY and _checkOffsetZ): + dialogResult = cmds.confirmDialog( + title = "Zero particle offset detected", + message = "For ROTATION BAKING, set the particle offset to non-zero values.\nIf all XYZ values are zero, the particle will stay in the same position as the original object, and no rotation will occur.\n", + messageAlign = "left", + icon = "warning", + button = ["Continue anyway", "Cancel"], + annotation = ["Bake with zero offset, no useful animation will be baked", "Cancel baking operation"], + defaultButton = "Cancel", + cancelButton = "Cancel", + dismissString = "TODO: dismissString" + ) + if (dialogResult == "Cancel"): + cmds.warning("Overlappy Rotation Baking cancelled") + return MayaSettings.CachedPlaybackDeactivate() From 029dadc114dcdcca7cee6fa72011b234452a3e41 Mon Sep 17 00:00:00 2001 From: Eugene Date: Tue, 23 Jul 2024 11:51:32 -0700 Subject: [PATCH 04/16] save: - button icon toggle - refactor code --- DRAG_AND_DROP_INSTALL.py | 9 ++---- GETOOLS_SOURCE/Settings.py | 4 +-- GETOOLS_SOURCE/modules/GeneralWindow.py | 11 ++++--- GETOOLS_SOURCE/utils/Colors.py | 1 + GETOOLS_SOURCE/utils/Shelf.py | 39 +++++++++++++++++++++++-- GETOOLS_SOURCE/values/Icons.py | 14 ++++----- 6 files changed, 55 insertions(+), 23 deletions(-) diff --git a/DRAG_AND_DROP_INSTALL.py b/DRAG_AND_DROP_INSTALL.py index 5a7b4a6..5d8e108 100644 --- a/DRAG_AND_DROP_INSTALL.py +++ b/DRAG_AND_DROP_INSTALL.py @@ -36,9 +36,6 @@ scriptPath = scriptPath.replace("\\", "/") Install.AddPathToEnvironment(scriptPath) -# Button settings -buttonLabel = "GETools" - imports = """\ import os import sys @@ -59,9 +56,9 @@ def onMayaDroppedPythonFile(*args, **kwargs): Shelf.AddToCurrentShelf( command = buttonCommand, - label = buttonLabel, + label = Settings.buttonLabel, annotation = "GenEugene Animation Tools", - imagePath = scriptPath + (Icons.get1_face if Settings.useFaceIcon else Icons.get1), - imageHighlightPath= scriptPath + (Icons.get2_face if Settings.useFaceIcon else Icons.get2), + image = scriptPath + Icons.get1[0], + imageHighlight = scriptPath + Icons.get2[0], ) diff --git a/GETOOLS_SOURCE/Settings.py b/GETOOLS_SOURCE/Settings.py index e0dc3d0..65132df 100644 --- a/GETOOLS_SOURCE/Settings.py +++ b/GETOOLS_SOURCE/Settings.py @@ -24,7 +24,7 @@ from .utils import Colors -useFaceIcon = False +buttonLabel = "GETools" windowName = "windowGETools" dockName = "dockGETools" @@ -43,7 +43,7 @@ windowWidthScroll = windowWidth - windowWidthScrollSpace windowWidthMargin = windowWidthScroll - margin * 2 -frames1Color = Colors.blackWhite00 +frames1Color = Colors.blackWhite13 frames2Color = Colors.blackWhite20 frames2Prefix = "// " diff --git a/GETOOLS_SOURCE/modules/GeneralWindow.py b/GETOOLS_SOURCE/modules/GeneralWindow.py index 6c17480..e36b83a 100644 --- a/GETOOLS_SOURCE/modules/GeneralWindow.py +++ b/GETOOLS_SOURCE/modules/GeneralWindow.py @@ -37,13 +37,14 @@ from ..utils import MotionTrail from ..utils import Scene from ..utils import Selector +from ..utils import Shelf from ..utils import Skinning from ..utils import Toggles from ..values import Icons class GeneralWindow: - version = "v1.2.0" + version = "v1.2.1" name = "GETools" title = name + " " + version @@ -162,7 +163,7 @@ def LinkDiscord(self): cmds.showHelp("https://discord.gg/heMxJhTqCz", absolute = def LinkShareIdeas(self): cmds.showHelp("https://github.com/GenEugene/GETools/discussions/categories/ideas", absolute = True) def LinkReport(self): cmds.showHelp("https://github.com/GenEugene/GETools/discussions/categories/report-a-problem", absolute = True) - cmds.menuItem(label = "About GETools", enable = False, image = self.directory + Icons.get1) # TODO add window with information + cmds.menuItem(label = "About GETools", enable = False, image = self.directory + Icons.get1[0]) # TODO add window with information cmds.menuItem(label = "Version History", command = LinkVersionHistory) cmds.menuItem(dividerLabel = "Links", divider = True) cmds.menuItem(label = "GitHub", command = LinkGithub, image = Icons.home) @@ -177,7 +178,9 @@ def LinkReport(self): cmds.showHelp("https://github.com/GenEugene/GETools/discus cmds.menuItem(dividerLabel = "Support", divider = True) cmds.menuItem(label = "Share your Ideas", command = LinkShareIdeas, image = Icons.light) cmds.menuItem(label = "Report a Problem", command = LinkReport, image = Icons.warning) - + cmds.menuItem(divider = True) + cmds.menuItem(label = "Change Icon", command = partial(Shelf.ToggleButtonIcons, self.directory)) + # DEV ZONE def LayerCreate(*args): Layers.Create("testLayer") @@ -441,7 +444,7 @@ def LayoutMenuInstall(self): def LayoutTitle(self, parentLayout): # TODO figure out how to use resizeable images cmds.columnLayout("layoutTitle", parent = parentLayout, adjustableColumn = False) size = 30 - cmds.iconTextButton(label = "GETOOLS", style = "iconAndTextHorizontal", image = self.directory + Icons.get1, width = size, height = size) + cmds.iconTextButton(label = "GETOOLS", style = "iconAndTextHorizontal", image = self.directory + Icons.get1[0], width = size, height = size) # cmds.image(image = self.directory + Icons.get, width = size, height = size) def LayoutTools(self, parentLayout): diff --git a/GETOOLS_SOURCE/utils/Colors.py b/GETOOLS_SOURCE/utils/Colors.py index 3a72dd5..1d274bc 100644 --- a/GETOOLS_SOURCE/utils/Colors.py +++ b/GETOOLS_SOURCE/utils/Colors.py @@ -23,6 +23,7 @@ blackWhite00 = (0, 0, 0) blackWhite10 = (0.1, 0.1, 0.1) +blackWhite13 = (0.13, 0.13, 0.13) blackWhite20 = (0.2, 0.2, 0.2) blackWhite30 = (0.3, 0.3, 0.3) blackWhite40 = (0.4, 0.4, 0.4) diff --git a/GETOOLS_SOURCE/utils/Shelf.py b/GETOOLS_SOURCE/utils/Shelf.py index 0aa9edb..3249a9b 100644 --- a/GETOOLS_SOURCE/utils/Shelf.py +++ b/GETOOLS_SOURCE/utils/Shelf.py @@ -23,19 +23,52 @@ import maya.cmds as cmds +from .. import Settings +from GETOOLS_SOURCE.values import Icons + def GetCurrentShelf(): return cmds.shelfTabLayout("ShelfLayout", query = True, selectTab = True) -def AddToCurrentShelf(command="", label="label", labelImage="", imagePath="pythonFamily.png", imageHighlightPath="pythonFamily.png", annotation=""): +def AddToCurrentShelf(command="", label="label", labelImage="", image="pythonFamily.png", imageHighlight="pythonFamily.png", annotation=""): cmds.shelfButton( command = command, label = label, imageOverlayLabel = labelImage, annotation = annotation, - image = imagePath, - highlightImage = imageHighlightPath, + image = image, + highlightImage = imageHighlight, parent = GetCurrentShelf(), sourceType = "Python", ) +def GetButtonFromShelf(buttonName): + currentShelf = GetCurrentShelf() + shelfButtons = cmds.shelfLayout(currentShelf, query = True, childArray = True) + result = [] + for item in shelfButtons: + if (cmds.objectTypeUI(item) == "shelfButton"): + if (cmds.shelfButton(item, query = True, label = True) == buttonName): + result.append(item) + return None if (len(result) == 0) else result + +def ToggleButtonIcons(path, *args): + buttons = GetButtonFromShelf(Settings.buttonLabel) + + for item in buttons: + currentImage = cmds.shelfButton(item, query = True, image = True) + currentImageHighlight = cmds.shelfButton(item, query = True, highlightImage = True) + + count = len(Icons.get1) + for i in range(count): + if (path + Icons.get1[i] == currentImage): + if (i + 1 < count): + currentImage = path + Icons.get1[i + 1] + currentImageHighlight = path + Icons.get2[i + 1] + else: + currentImage = path + Icons.get1[0] + currentImageHighlight = path + Icons.get2[0] + break + + cmds.shelfButton(item, edit = True, image = currentImage, highlightImage = currentImageHighlight) + diff --git a/GETOOLS_SOURCE/values/Icons.py b/GETOOLS_SOURCE/values/Icons.py index c1f1012..6782bd7 100644 --- a/GETOOLS_SOURCE/values/Icons.py +++ b/GETOOLS_SOURCE/values/Icons.py @@ -21,16 +21,14 @@ # Author: Eugene Gataulin tek942@gmail.com https://www.linkedin.com/in/geneugene # Source code: https://github.com/GenEugene/GETools or https://app.gumroad.com/geneugene -root = "\\GETOOLS_SOURCE" +root = "/GETOOLS_SOURCE" -get1 = root + "\icons\GET1.png" -get2 = root + "\icons\GET2.png" -get1_face = root + "\icons\GET1_face.png" -get2_face = root + "\icons\GET2_face.png" +get1 = (root + "/icons/GET1.png", root + "/icons/GET1_face.png") +get2 = (root + "/icons/GET2.png", root + "/icons/GET2_face.png") -tools = root + "\icons\Tools.png" -centerOfMass = root + "\icons\CenterOfMass.png" -overlappy = root + "\icons\Overlappy.png" +tools = root + "/icons/Tools.png" +centerOfMass = root + "/icons/CenterOfMass.png" +overlappy = root + "/icons/Overlappy.png" # Maya's empty = "empty.png" From fec869d1744fd67e5c1b81d457ad05fd1823f8bb Mon Sep 17 00:00:00 2001 From: Eugene Date: Tue, 23 Jul 2024 12:08:48 -0700 Subject: [PATCH 05/16] fix icon swap --- GETOOLS_SOURCE/modules/GeneralWindow.py | 2 +- GETOOLS_SOURCE/utils/Shelf.py | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/GETOOLS_SOURCE/modules/GeneralWindow.py b/GETOOLS_SOURCE/modules/GeneralWindow.py index e36b83a..2318454 100644 --- a/GETOOLS_SOURCE/modules/GeneralWindow.py +++ b/GETOOLS_SOURCE/modules/GeneralWindow.py @@ -44,7 +44,7 @@ class GeneralWindow: - version = "v1.2.1" + version = "v1.2.2" name = "GETools" title = name + " " + version diff --git a/GETOOLS_SOURCE/utils/Shelf.py b/GETOOLS_SOURCE/utils/Shelf.py index 3249a9b..c344000 100644 --- a/GETOOLS_SOURCE/utils/Shelf.py +++ b/GETOOLS_SOURCE/utils/Shelf.py @@ -54,11 +54,15 @@ def GetButtonFromShelf(buttonName): def ToggleButtonIcons(path, *args): buttons = GetButtonFromShelf(Settings.buttonLabel) + if (buttons == None): + cmds.warning("No GETools button on current shelf") + return for item in buttons: currentImage = cmds.shelfButton(item, query = True, image = True) currentImageHighlight = cmds.shelfButton(item, query = True, highlightImage = True) + changed = False count = len(Icons.get1) for i in range(count): if (path + Icons.get1[i] == currentImage): @@ -68,7 +72,12 @@ def ToggleButtonIcons(path, *args): else: currentImage = path + Icons.get1[0] currentImageHighlight = path + Icons.get2[0] + changed = True break + + if (not changed): + currentImage = path + Icons.get1[0] + currentImageHighlight = path + Icons.get2[0] cmds.shelfButton(item, edit = True, image = currentImage, highlightImage = currentImageHighlight) From 5504d11ac3a613c2e7bb48db4d73c7f1e323146a Mon Sep 17 00:00:00 2001 From: Eugene Date: Tue, 23 Jul 2024 15:13:56 -0700 Subject: [PATCH 06/16] Update changelog.txt --- changelog.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/changelog.txt b/changelog.txt index a757291..bcb08c7 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,7 +1,8 @@ GETools changelog -v1.2.0 +v1.2.2 - [OVERLAPPY] Added confirm dialog for zero particle offset. +- [UI] Replaced button icon change approach, now simply use Help/Change Icon for toggling icons v1.1.0 - [CRITICAL] Fixed compatibility with Maya 2025. From 38c3e53e2c41fd12d428ef1f7b54c1a2e5dccf2a Mon Sep 17 00:00:00 2001 From: Eugene Date: Tue, 23 Jul 2024 16:46:33 -0700 Subject: [PATCH 07/16] add annotation draft logic --- GETOOLS_SOURCE/_prototypes/Namespaces.py | 2 +- GETOOLS_SOURCE/_prototypes/ToggleValues.py | 2 +- GETOOLS_SOURCE/modules/GeneralWindow.py | 5 +- GETOOLS_SOURCE/utils/Annotation.py | 58 ++++++++++++++++++++++ changelog.txt | 3 +- 5 files changed, 66 insertions(+), 4 deletions(-) create mode 100644 GETOOLS_SOURCE/utils/Annotation.py diff --git a/GETOOLS_SOURCE/_prototypes/Namespaces.py b/GETOOLS_SOURCE/_prototypes/Namespaces.py index 91af0a9..0eee05e 100644 --- a/GETOOLS_SOURCE/_prototypes/Namespaces.py +++ b/GETOOLS_SOURCE/_prototypes/Namespaces.py @@ -18,7 +18,7 @@ def ClearRigNamespaces(_namespace=''): cmds.select("SET_EXPORT_ANIM_ALL", r = 1) # Select all objects for baking def NamespacesFromSelected(self, *args): - selected = cmds.ls(sl = 1) + selected = cmds.ls(selection = True) if (selected): namespaces = list("") for i in range(len(selected)): diff --git a/GETOOLS_SOURCE/_prototypes/ToggleValues.py b/GETOOLS_SOURCE/_prototypes/ToggleValues.py index 36c4517..73a4cef 100644 --- a/GETOOLS_SOURCE/_prototypes/ToggleValues.py +++ b/GETOOLS_SOURCE/_prototypes/ToggleValues.py @@ -5,7 +5,7 @@ cmds.select("test1:cube1", replace = True) # Extract namespace from selected -selected = cmds.ls(sl = True)[0] +selected = cmds.ls(selection = True)[0] resultNamespace = selected.split(':')[0] count = selected.split(':') diff --git a/GETOOLS_SOURCE/modules/GeneralWindow.py b/GETOOLS_SOURCE/modules/GeneralWindow.py index 2318454..7c105be 100644 --- a/GETOOLS_SOURCE/modules/GeneralWindow.py +++ b/GETOOLS_SOURCE/modules/GeneralWindow.py @@ -29,6 +29,7 @@ from ..modules import Overlappy from ..modules import Rigging from ..modules import Tools +from ..utils import Annotation from ..utils import Blendshapes from ..utils import Colors from ..utils import Install @@ -44,7 +45,7 @@ class GeneralWindow: - version = "v1.2.2" + version = "v1.2.3" name = "GETools" title = name + " " + version @@ -108,6 +109,8 @@ def PrintChannelBoxAttributes(*args): cmds.menuItem(label = "Select Skinned Meshes Or Joints", command = Skinning.SelectSkinnedMeshesOrJoints) # cmds.menuItem(label = "Create Reset Button", command = Install.CreateResetButton) cmds.menuItem(divider = True) + cmds.menuItem(label = "Annotate selected", command = Annotation.AnnotateSelected) + cmds.menuItem(divider = True) cmds.menuItem(label = "Print selected objects to console", command = Selector.PrintSelected, image = Icons.text) cmds.menuItem(label = "Print channel box selected attributes", command = PrintChannelBoxAttributes, image = Icons.text) cmds.menuItem(dividerLabel = "Blendshapes", divider = True) diff --git a/GETOOLS_SOURCE/utils/Annotation.py b/GETOOLS_SOURCE/utils/Annotation.py new file mode 100644 index 0000000..e442f8e --- /dev/null +++ b/GETOOLS_SOURCE/utils/Annotation.py @@ -0,0 +1,58 @@ +# GETOOLS is under the terms of the MIT License +# Copyright (c) 2018-2024 Eugene Gataulin (GenEugene). All Rights Reserved. + +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: + +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. + +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +# Author: Eugene Gataulin tek942@gmail.com https://www.linkedin.com/in/geneugene +# Source code: https://github.com/GenEugene/GETools or https://app.gumroad.com/geneugene + +import maya.cmds as cmds + +from ..utils import Parent +from ..utils import Text + + +prefix = "ann_" + + +def Annotate(target, text, point=(0, 0, 0), displayArrow=True, useNameAsText=False, freeze=True): + textFinal = target if useNameAsText else text + annotation = cmds.annotate(target, text = textFinal, point = point) + cmds.setAttr(annotation + ".displayArrow", displayArrow) + if (freeze): + cmds.setAttr(annotation + ".overrideEnabled", 1) + cmds.setAttr(annotation + ".overrideDisplayType", 2) + return annotation + +def AnnotateSelected(*args): + selected = cmds.ls(selection = True) + for item in selected: + # Create annotation and get transform + annotation = Annotate(item, item, (0, 0, 0), displayArrow = False, useNameAsText = True) + transform = cmds.listRelatives(annotation, allParents = True)[0] + + # Rename + nameFinal = prefix + item + nameFinal = Text.ConvertSymbols(nameFinal) + transform = cmds.rename(transform, nameFinal) + + # Parent + Parent.FirstToSecond(transform, item, maintainOffset = False) + + # TODO add constraint logic and group all annotations together + diff --git a/changelog.txt b/changelog.txt index bcb08c7..3eebb88 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,8 +1,9 @@ GETools changelog -v1.2.2 +v1.2.3 - [OVERLAPPY] Added confirm dialog for zero particle offset. - [UI] Replaced button icon change approach, now simply use Help/Change Icon for toggling icons +- Added annotation creation draft logic v1.1.0 - [CRITICAL] Fixed compatibility with Maya 2025. From 5a5a7ec0216e234671540189d829708cd15694cb Mon Sep 17 00:00:00 2001 From: Eugene Date: Wed, 24 Jul 2024 11:21:18 -0700 Subject: [PATCH 08/16] save: - modify euler filter method - add option menu with euler filter checkbox (still in progress) - move "To Shelf" menu to the new "Options" menu --- GETOOLS_SOURCE/modules/GeneralWindow.py | 20 ++++++++++++-------- GETOOLS_SOURCE/modules/Tools.py | 2 +- GETOOLS_SOURCE/utils/Animation.py | 13 +++++++++---- GETOOLS_SOURCE/utils/Install.py | 4 ++-- GETOOLS_SOURCE/values/CodeSamples.py | 4 ++-- 5 files changed, 26 insertions(+), 17 deletions(-) diff --git a/GETOOLS_SOURCE/modules/GeneralWindow.py b/GETOOLS_SOURCE/modules/GeneralWindow.py index 7c105be..2d1feb8 100644 --- a/GETOOLS_SOURCE/modules/GeneralWindow.py +++ b/GETOOLS_SOURCE/modules/GeneralWindow.py @@ -45,7 +45,7 @@ class GeneralWindow: - version = "v1.2.3" + version = "v1.2.4" name = "GETools" title = name + " " + version @@ -151,8 +151,7 @@ def PrintChannelBoxAttributes(*args): cmds.menuItem(label = "Subdiv Surfaces", command = Toggles.ToggleSubdivSurfaces) cmds.menuItem(label = "Textures", command = Toggles.ToggleTextures, image = Icons.image) - - self.LayoutMenuInstall() + self.LayoutMenuOptions() cmds.menu(label = "Help", tearOff = True) # , helpMenu = True def LinkVersionHistory(self): cmds.showHelp("https://github.com/GenEugene/GETools/blob/master/changelog.txt", absolute = True) @@ -212,9 +211,14 @@ def LayerMove(*args): # cmds.menuItem(label = "Layer Get Selected", command = LayerGetSelected) # cmds.menuItem(label = "Layer Move", command = LayerMove) pass - def LayoutMenuInstall(self): - cmds.menu(label = "To Shelf", tearOff = True) - + def LayoutMenuOptions(self): + cmds.menu(label = "Options", tearOff = True) + cmds.menuItem(label = "Euler Filter After Baking", checkBox = False) + + cmds.menuItem(dividerLabel = "Install", divider = True) + + # Install + cmds.menuItem(subMenu = True, label = "Install Buttons To Current Shelf", tearOff = True, image = Icons.fileOpen) cmds.menuItem(subMenu = True, label = "File", tearOff = True, image = Icons.fileOpen) cmds.menuItem(label = "Reload Scene (force)", command = partial(Install.ToShelf_ReloadScene, self.directory), image = Icons.reset) cmds.menuItem(label = "Exit Maya (force)", command = partial(Install.ToShelf_ExitMaya, self.directory), image = Icons.off) @@ -350,7 +354,7 @@ def LayoutMenuInstall(self): cmds.menuItem(label = "Static", command = partial(Install.ToShelf_DeleteStatic, self.directory)) cmds.setParent('..', menu = True) # - cmds.menuItem(label = "Euler Filter", command = partial(Install.ToShelf_EulerFilter, self.directory), image = Icons.filterActive) + cmds.menuItem(label = "Euler Filter", command = partial(Install.ToShelf_EulerFilterOnSelected, self.directory), image = Icons.filterActive) # cmds.menuItem(subMenu = True, label = "Infinity", tearOff = True, image = Icons.infinity) cmds.menuItem(label = "Constant", command = partial(Install.ToShelf_SetInfinity, self.directory, 1)) @@ -433,7 +437,7 @@ def LayoutMenuInstall(self): cmds.menuItem(label = "Reconstruct", command = partial(Install.ToShelf_BlendshapesReconstruct, self.directory), image = Icons.blendshape) cmds.menuItem(label = "Extract Shapes", command = partial(Install.ToShelf_BlendshapesExtractShapes, self.directory), image = Icons.polyMesh) cmds.menuItem(label = "Zero Weights", command = partial(Install.ToShelf_BlendshapesZeroWeights, self.directory), image = Icons.zero) - cmds.setParent('..', menu = True) + # cmds.setParent('..', menu = True) cmds.menuItem(dividerLabel = "EXPERIMENTAL", divider = True) ### diff --git a/GETOOLS_SOURCE/modules/Tools.py b/GETOOLS_SOURCE/modules/Tools.py index d9c693c..b742ff5 100644 --- a/GETOOLS_SOURCE/modules/Tools.py +++ b/GETOOLS_SOURCE/modules/Tools.py @@ -265,7 +265,7 @@ def UILayoutAnimation(self, layoutMain): # countOffsets = 1 cmds.gridLayout(parent = layoutColumn, numberOfColumns = countOffsets, cellWidth = Settings.windowWidthMargin / countOffsets, cellHeight = Settings.lineHeight) - cmds.button(label = "Euler Filter", command = Animation.FilterCurve, backgroundColor = Colors.yellow10, annotation = ToolsAnnotations.filterCurve) + cmds.button(label = "Euler Filter", command = Animation.EulerFilterOnSelected, backgroundColor = Colors.yellow10, annotation = ToolsAnnotations.filterCurve) # countOffsets = 5 cmds.gridLayout(parent = layoutColumn, numberOfColumns = countOffsets, cellWidth = Settings.windowWidthMargin / countOffsets, cellHeight = Settings.lineHeight) diff --git a/GETOOLS_SOURCE/utils/Animation.py b/GETOOLS_SOURCE/utils/Animation.py index 3048e1f..7b43c4e 100644 --- a/GETOOLS_SOURCE/utils/Animation.py +++ b/GETOOLS_SOURCE/utils/Animation.py @@ -68,11 +68,16 @@ def DeleteStaticCurves(*args): Selector.MultipleObjects(1) cmds.delete(staticChannels = True) -def FilterCurve(*args): +def EulerFilterObject(obj): + cmds.filterCurve(obj) +def EulerFilterOnSelected(*args): # Check selected objects - Selector.MultipleObjects(1) - cmds.filterCurve() - + selected = Selector.MultipleObjects(1) + if (selected == None): + return None + for item in selected: + EulerFilterObject(item) + def SetInfinity(mode, items=None, *args): result = "" if (mode == 1): diff --git a/GETOOLS_SOURCE/utils/Install.py b/GETOOLS_SOURCE/utils/Install.py index 4101337..5bae8f4 100644 --- a/GETOOLS_SOURCE/utils/Install.py +++ b/GETOOLS_SOURCE/utils/Install.py @@ -204,8 +204,8 @@ def ToShelf_DeleteNonkeyable(path, *args): def ToShelf_DeleteStatic(path, *args): MoveToShelf(path, ReadFunctionAsString(CodeSamples.DeleteStatic), "DeleteStatic", "DStatic") -def ToShelf_EulerFilter(path, *args): - MoveToShelf(path, ReadFunctionAsString(CodeSamples.EulerFilter), "EulerFilter", "Euler") +def ToShelf_EulerFilterOnSelected(path, *args): + MoveToShelf(path, ReadFunctionAsString(CodeSamples.EulerFilterOnSelected), "EulerFilter", "Euler") def ToShelf_SetInfinity(path, mode, *args): MoveToShelf(path, ReadFunctionAsString(CodeSamples.SetInfinity) + "({0})".format(mode), "SetInfinity{0}".format(mode), "Inf{0}".format(mode)) diff --git a/GETOOLS_SOURCE/values/CodeSamples.py b/GETOOLS_SOURCE/values/CodeSamples.py index d238f9e..06de0e4 100644 --- a/GETOOLS_SOURCE/values/CodeSamples.py +++ b/GETOOLS_SOURCE/values/CodeSamples.py @@ -255,9 +255,9 @@ def DeleteStatic(): import GETOOLS_SOURCE.utils.Animation as animation animation.DeleteStaticCurves() -def EulerFilter(): +def EulerFilterOnSelected(): import GETOOLS_SOURCE.utils.Animation as animation - animation.FilterCurve() + animation.EulerFilterOnSelected() def SetInfinity(): # brackets added when method used import GETOOLS_SOURCE.utils.Animation as animation From dfb77713ca723973d2f7a987241dfec1ae9c8123 Mon Sep 17 00:00:00 2001 From: Eugene Date: Wed, 24 Jul 2024 11:58:52 -0700 Subject: [PATCH 09/16] add MenuCheckbox UI class --- GETOOLS_SOURCE/modules/GeneralWindow.py | 8 ++++++-- GETOOLS_SOURCE/utils/Animation.py | 11 ++++++++--- GETOOLS_SOURCE/utils/UI.py | 22 ++++++++++++++++++++++ 3 files changed, 36 insertions(+), 5 deletions(-) diff --git a/GETOOLS_SOURCE/modules/GeneralWindow.py b/GETOOLS_SOURCE/modules/GeneralWindow.py index 2d1feb8..a37d498 100644 --- a/GETOOLS_SOURCE/modules/GeneralWindow.py +++ b/GETOOLS_SOURCE/modules/GeneralWindow.py @@ -41,11 +41,12 @@ from ..utils import Shelf from ..utils import Skinning from ..utils import Toggles +from ..utils import UI from ..values import Icons class GeneralWindow: - version = "v1.2.4" + version = "v1.2.5" name = "GETools" title = name + " " + version @@ -56,6 +57,8 @@ def __init__(self): self.frameOverlappy = None self.frameCenterOfMass = None self.frameExperimental = None + + self.menuCheckboxEulerFilter = None def CreateUI(self): if cmds.window(Settings.windowName, exists = True): cmds.deleteUI(Settings.windowName) @@ -213,7 +216,8 @@ def LayerMove(*args): pass def LayoutMenuOptions(self): cmds.menu(label = "Options", tearOff = True) - cmds.menuItem(label = "Euler Filter After Baking", checkBox = False) + + self.menuCheckboxEulerFilter = UI.MenuCheckbox(label = "Euler Filter After Baking", value = False, valueDefault = False) cmds.menuItem(dividerLabel = "Install", divider = True) diff --git a/GETOOLS_SOURCE/utils/Animation.py b/GETOOLS_SOURCE/utils/Animation.py index 7b43c4e..0ee70d6 100644 --- a/GETOOLS_SOURCE/utils/Animation.py +++ b/GETOOLS_SOURCE/utils/Animation.py @@ -68,15 +68,20 @@ def DeleteStaticCurves(*args): Selector.MultipleObjects(1) cmds.delete(staticChannels = True) -def EulerFilterObject(obj): +def EulerFilterOnObject(obj): cmds.filterCurve(obj) + print("######## Euler Filtered {0}".format(obj)) +def EulerFilterOnObjects(objects): + if (objects == None): + return None + for item in objects: + EulerFilterOnObject(item) def EulerFilterOnSelected(*args): # Check selected objects selected = Selector.MultipleObjects(1) if (selected == None): return None - for item in selected: - EulerFilterObject(item) + EulerFilterOnObjects(selected) def SetInfinity(mode, items=None, *args): result = "" diff --git a/GETOOLS_SOURCE/utils/UI.py b/GETOOLS_SOURCE/utils/UI.py index c1ab71b..d0bad03 100644 --- a/GETOOLS_SOURCE/utils/UI.py +++ b/GETOOLS_SOURCE/utils/UI.py @@ -256,3 +256,25 @@ def SetCached(self, *args): def ResetCached(self, *args): self.valueCached = 0 +class MenuCheckbox: + def __init__(self, + # parent=None, # TODO + label="label", + value=False, + valueDefault=False, + enable=True, + command="pass", + ): + + self.valueDefault = valueDefault + self.checkbox = cmds.menuItem(label = label, checkBox = value, enable = enable, command = command) + + def Get(self, *args): + return cmds.menuItem(self.checkbox, query = True, checkBox = True) + + def Set(self, value=False, *args): + cmds.menuItem(self.checkbox, edit = True, checkBox = value) + + def Reset(self, *args): + cmds.menuItem(self.checkbox, edit = True, checkBox = self.valueDefault) + From 9d2400bea4a460076710a8dd2fa791ac90213452 Mon Sep 17 00:00:00 2001 From: Eugene Date: Wed, 24 Jul 2024 15:43:41 -0700 Subject: [PATCH 10/16] add euler filter check to baking logic --- GETOOLS_SOURCE/modules/GeneralWindow.py | 1 + GETOOLS_SOURCE/modules/Tools.py | 1 - GETOOLS_SOURCE/utils/Baker.py | 14 +++++++++----- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/GETOOLS_SOURCE/modules/GeneralWindow.py b/GETOOLS_SOURCE/modules/GeneralWindow.py index a37d498..d0e9489 100644 --- a/GETOOLS_SOURCE/modules/GeneralWindow.py +++ b/GETOOLS_SOURCE/modules/GeneralWindow.py @@ -52,6 +52,7 @@ class GeneralWindow: def __init__(self): self.directory = "" + self.frameTools = None self.frameRigging = None self.frameOverlappy = None diff --git a/GETOOLS_SOURCE/modules/Tools.py b/GETOOLS_SOURCE/modules/Tools.py index b742ff5..da937ce 100644 --- a/GETOOLS_SOURCE/modules/Tools.py +++ b/GETOOLS_SOURCE/modules/Tools.py @@ -29,7 +29,6 @@ from ..utils import Baker from ..utils import Colors from ..utils import Locators -from ..utils import Other from ..utils import Selector from ..utils import Timeline from ..utils import UI diff --git a/GETOOLS_SOURCE/utils/Baker.py b/GETOOLS_SOURCE/utils/Baker.py index de6ac3a..8331e13 100644 --- a/GETOOLS_SOURCE/utils/Baker.py +++ b/GETOOLS_SOURCE/utils/Baker.py @@ -23,12 +23,13 @@ import maya.cmds as cmds +from ..utils import Animation from ..utils import Constraints from ..utils import Selector from ..utils import Timeline -def BakeSelected(classic=True, preserveOutsideKeys=True, sampleBy=1.0, selectedRange=False, channelBox=False, attributes=None): +def BakeSelected(classic=True, preserveOutsideKeys=True, sampleBy=1.0, selectedRange=False, channelBox=False, attributes=None, euler=False): # Check selected objects selectedList = Selector.MultipleObjects(1) if (selectedList == None): @@ -69,7 +70,10 @@ def BakeSelected(classic=True, preserveOutsideKeys=True, sampleBy=1.0, selectedR cmds.cutKey(time = (timeRange[1], None)) # to right cmds.refresh(suspend = False) -def BakeSelectedByLastObject(pairOnly=False, sampleBy=1.0, selectedRange=False, channelBox=False, attributes=None): + if (euler): + Animation.EulerFilterOnObjects(selectedList) + +def BakeSelectedByLastObject(pairOnly=False, sampleBy=1.0, selectedRange=False, channelBox=False, attributes=None, euler=False): # Check selected objects selectedList = Selector.MultipleObjects(2) if (selectedList == None): @@ -85,7 +89,7 @@ def BakeSelectedByLastObject(pairOnly=False, sampleBy=1.0, selectedRange=False, # Bake objects cmds.select(selectedList) cmds.select(selectedList[-1], deselect = True) - BakeSelected(sampleBy = sampleBy, selectedRange = selectedRange, channelBox = channelBox, attributes = attributes) + BakeSelected(sampleBy = sampleBy, selectedRange = selectedRange, channelBox = channelBox, attributes = attributes, euler = euler) # Delete constraints Constraints.DeleteConstraints(selectedList[:-1]) @@ -93,7 +97,7 @@ def BakeSelectedByLastObject(pairOnly=False, sampleBy=1.0, selectedRange=False, cmds.select(selectedList) return selectedList -def BakeSelectedByWorld(sampleBy=1.0, selectedRange=False, channelBox=False, attributes=None): +def BakeSelectedByWorld(sampleBy=1.0, selectedRange=False, channelBox=False, attributes=None, euler=False): # Check selected objects selectedList = Selector.MultipleObjects(1) if (selectedList == None): @@ -102,7 +106,7 @@ def BakeSelectedByWorld(sampleBy=1.0, selectedRange=False, channelBox=False, att world = cmds.group(world = True, empty = True) selectedList.append(world) cmds.select(selectedList, replace = True) - BakeSelectedByLastObject(sampleBy = sampleBy, selectedRange = selectedRange, channelBox = channelBox, attributes = attributes) + BakeSelectedByLastObject(sampleBy = sampleBy, selectedRange = selectedRange, channelBox = channelBox, attributes = attributes, euler = euler) cmds.delete(world) # def BakeReverseParentOnPair(): # TODO add child locator on parent object (OPTIONAL) From 84a46da5298ec26f7e9a7330f1da4b4c855aef47 Mon Sep 17 00:00:00 2001 From: Eugene Date: Thu, 25 Jul 2024 11:38:44 -0700 Subject: [PATCH 11/16] save: - deselect keys after euler filter applied - pass general window instance to sub classes - use instance checkbox for euler filter --- GETOOLS_SOURCE/modules/GeneralWindow.py | 2 +- GETOOLS_SOURCE/modules/Tools.py | 26 ++++++++++++++----------- GETOOLS_SOURCE/utils/Animation.py | 1 + 3 files changed, 17 insertions(+), 12 deletions(-) diff --git a/GETOOLS_SOURCE/modules/GeneralWindow.py b/GETOOLS_SOURCE/modules/GeneralWindow.py index d0e9489..40bf8e0 100644 --- a/GETOOLS_SOURCE/modules/GeneralWindow.py +++ b/GETOOLS_SOURCE/modules/GeneralWindow.py @@ -461,7 +461,7 @@ def LayoutTitle(self, parentLayout): # TODO figure out how to use resizeable ima def LayoutTools(self, parentLayout): self.frameTools = cmds.frameLayout("layoutTools", parent = parentLayout, label = "1. " + Tools.Tools.title, collapsable = True, backgroundColor = Settings.frames1Color, marginWidth = Settings.margin, marginHeight = Settings.margin) - Tools.Tools().UICreate(self.frameTools) + Tools.Tools(self).UICreate(self.frameTools) def LayoutRigging(self, parentLayout): self.frameRigging = cmds.frameLayout("layoutRigging", parent = parentLayout, label = "2. " + Rigging.Rigging.title, collapsable = True, backgroundColor = Settings.frames1Color, marginWidth = Settings.margin, marginHeight = Settings.margin) Rigging.Rigging().UICreate(self.frameRigging) diff --git a/GETOOLS_SOURCE/modules/Tools.py b/GETOOLS_SOURCE/modules/Tools.py index da937ce..33f0201 100644 --- a/GETOOLS_SOURCE/modules/Tools.py +++ b/GETOOLS_SOURCE/modules/Tools.py @@ -108,7 +108,11 @@ class Tools: name = "TOOLS" title = name + " " + version - def __init__(self): + # HACK use only for code editor # TODO try to find better way to get access to other classes with cross import + # from ..modules import GeneralWindow + # def __init__(self, generalInstance: GeneralWindow.GeneralWindow): + def __init__(self, generalInstance): + self.generalInstance = generalInstance self.checkboxLocatorHideParent = None self.checkboxLocatorSubLocator = None self.floatLocatorSize = None @@ -393,27 +397,27 @@ def BakeSamplesAdd(self, direction=1, *args): self.fieldBakingSamples.Set(value) def BakeSelectedClassic(self, *args): - Baker.BakeSelected(classic = True, preserveOutsideKeys = True, sampleBy = self.fieldBakingSamples.Get(), selectedRange = True, channelBox = True) + Baker.BakeSelected(classic = True, preserveOutsideKeys = True, sampleBy = self.fieldBakingSamples.Get(), selectedRange = True, channelBox = True, euler = self.generalInstance.menuCheckboxEulerFilter.Get()) def BakeSelectedClassicCut(self, *args): - Baker.BakeSelected(classic = True, preserveOutsideKeys = False, sampleBy = self.fieldBakingSamples.Get(), selectedRange = True, channelBox = True) + Baker.BakeSelected(classic = True, preserveOutsideKeys = False, sampleBy = self.fieldBakingSamples.Get(), selectedRange = True, channelBox = True, euler = self.generalInstance.menuCheckboxEulerFilter.Get()) def BakeSelectedCustom(self, *args): # TODO , sampleBy = self.fieldBakingStep.Get() - Baker.BakeSelected(classic = False, preserveOutsideKeys = True, selectedRange = True, channelBox = True) + Baker.BakeSelected(classic = False, preserveOutsideKeys = True, selectedRange = True, channelBox = True, euler = self.generalInstance.menuCheckboxEulerFilter.Get()) def BakeSelectedCustomCut(self, *args): # TODO , sampleBy = self.fieldBakingStep.Get() - Baker.BakeSelected(classic = False, preserveOutsideKeys = False, selectedRange = True, channelBox = True) + Baker.BakeSelected(classic = False, preserveOutsideKeys = False, selectedRange = True, channelBox = True, euler = self.generalInstance.menuCheckboxEulerFilter.Get()) def BakeSelectedByLastObject(self, translate=True, rotate=True, *args): if (translate and rotate): - Baker.BakeSelectedByLastObject(sampleBy = self.fieldBakingSamples.Get(), selectedRange = True, channelBox = True) + Baker.BakeSelectedByLastObject(sampleBy = self.fieldBakingSamples.Get(), selectedRange = True, channelBox = True, euler = self.generalInstance.menuCheckboxEulerFilter.Get()) elif (translate and not rotate): - Baker.BakeSelectedByLastObject(sampleBy = self.fieldBakingSamples.Get(), selectedRange = True, channelBox = False, attributes = Enums.Attributes.translateShort) + Baker.BakeSelectedByLastObject(sampleBy = self.fieldBakingSamples.Get(), selectedRange = True, channelBox = False, attributes = Enums.Attributes.translateShort, euler = self.generalInstance.menuCheckboxEulerFilter.Get()) elif (not translate and rotate): - Baker.BakeSelectedByLastObject(sampleBy = self.fieldBakingSamples.Get(), selectedRange = True, channelBox = False, attributes = Enums.Attributes.rotateShort) + Baker.BakeSelectedByLastObject(sampleBy = self.fieldBakingSamples.Get(), selectedRange = True, channelBox = False, attributes = Enums.Attributes.rotateShort, euler = self.generalInstance.menuCheckboxEulerFilter.Get()) def BakeSelectedByWorld(self, translate=True, rotate=True, *args): if (translate and rotate): - Baker.BakeSelectedByWorld(sampleBy = self.fieldBakingSamples.Get(), selectedRange = True, channelBox = True) + Baker.BakeSelectedByWorld(sampleBy = self.fieldBakingSamples.Get(), selectedRange = True, channelBox = True, euler = self.generalInstance.menuCheckboxEulerFilter.Get()) elif (translate and not rotate): - Baker.BakeSelectedByWorld(sampleBy = self.fieldBakingSamples.Get(), selectedRange = True, channelBox = False, attributes = Enums.Attributes.translateShort) + Baker.BakeSelectedByWorld(sampleBy = self.fieldBakingSamples.Get(), selectedRange = True, channelBox = False, attributes = Enums.Attributes.translateShort, euler = self.generalInstance.menuCheckboxEulerFilter.Get()) elif (not translate and rotate): - Baker.BakeSelectedByWorld(sampleBy = self.fieldBakingSamples.Get(), selectedRange = True, channelBox = False, attributes = Enums.Attributes.rotateShort) + Baker.BakeSelectedByWorld(sampleBy = self.fieldBakingSamples.Get(), selectedRange = True, channelBox = False, attributes = Enums.Attributes.rotateShort, euler = self.generalInstance.menuCheckboxEulerFilter.Get()) # ANIMATION diff --git a/GETOOLS_SOURCE/utils/Animation.py b/GETOOLS_SOURCE/utils/Animation.py index 0ee70d6..081e9b9 100644 --- a/GETOOLS_SOURCE/utils/Animation.py +++ b/GETOOLS_SOURCE/utils/Animation.py @@ -70,6 +70,7 @@ def DeleteStaticCurves(*args): def EulerFilterOnObject(obj): cmds.filterCurve(obj) + cmds.selectKey(clear = True) print("######## Euler Filtered {0}".format(obj)) def EulerFilterOnObjects(objects): if (objects == None): From d24987d0f15ed92afb4c33110abe5e83a7ba5d16 Mon Sep 17 00:00:00 2001 From: Eugene Date: Fri, 26 Jul 2024 09:43:00 -0700 Subject: [PATCH 12/16] Update changelog.txt --- changelog.txt | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/changelog.txt b/changelog.txt index 3eebb88..73a2160 100644 --- a/changelog.txt +++ b/changelog.txt @@ -2,8 +2,12 @@ GETools changelog v1.2.3 - [OVERLAPPY] Added confirm dialog for zero particle offset. -- [UI] Replaced button icon change approach, now simply use Help/Change Icon for toggling icons -- Added annotation creation draft logic +- [UTILS] Added annotation creation draft logic. +- [UI] Replaced button icon change approach, now simply use Help/Change Icon for toggling icons. +- [UI] Added "Options" menu with euler filter checkbox. +- [UI] Moved "To Shelf" menu to the new "Options" menu. +- Setup connection between base class instance between sub classes. +- Improved euler filter method for using after baking. v1.1.0 - [CRITICAL] Fixed compatibility with Maya 2025. @@ -11,11 +15,11 @@ v1.1.0 - [UI] Added button icon change on highlight. - [UI] Added alternative secret meme icon (need to activate in Settings "useFaceIcon = True"). - Improved cache evaluator detection. -- Moved Settings script to the root folder +- Moved Settings script to the root folder. - General refactoring. v1.0.5 -- Fixed motion trails to shelf button +- Fixed motion trails to shelf button. - Decreased hardcode in Drag and Drop logic. - Reworked Button Install module. - [UI] Added tear-off to sub menus From 21616b7f5637e5ba2640ea9cab1ad1bfb22e1f61 Mon Sep 17 00:00:00 2001 From: Eugene Date: Fri, 26 Jul 2024 09:59:14 -0700 Subject: [PATCH 13/16] add more euler check support --- GETOOLS_SOURCE/modules/Overlappy.py | 7 ++++++- GETOOLS_SOURCE/modules/Tools.py | 8 ++++---- GETOOLS_SOURCE/utils/Locators.py | 14 +++++++------- changelog.txt | 5 +++-- 4 files changed, 20 insertions(+), 14 deletions(-) diff --git a/GETOOLS_SOURCE/modules/Overlappy.py b/GETOOLS_SOURCE/modules/Overlappy.py index 6f33aaf..2db9b56 100644 --- a/GETOOLS_SOURCE/modules/Overlappy.py +++ b/GETOOLS_SOURCE/modules/Overlappy.py @@ -129,7 +129,12 @@ class Overlappy: name = "OVERLAPPY" title = name + " " + version + # HACK use only for code editor # TODO try to find better way to get access to other classes with cross import + # from ..modules import GeneralWindow + # def __init__(self, generalInstance: GeneralWindow.GeneralWindow): def __init__(self): + self.generalInstance = generalInstance + # VALUES self.time = Timeline.TimeRangeHandler() self.startPositionGoalParticle = [None, (0, 0, 0)] @@ -916,7 +921,7 @@ def _BakeLogic(self, parent, zeroOffsets=False, translation=True, deleteSetupLoc cmds.select(_clone, replace = True) # Bake - Baker.BakeSelected(classic = True, preserveOutsideKeys = True) + Baker.BakeSelected(classic = True, preserveOutsideKeys = True, euler = self.generalInstance.menuCheckboxEulerFilter.Get()) Constraints.DeleteConstraints(_clone) # Copy keys, create layers and paste keys diff --git a/GETOOLS_SOURCE/modules/Tools.py b/GETOOLS_SOURCE/modules/Tools.py index 33f0201..63984d3 100644 --- a/GETOOLS_SOURCE/modules/Tools.py +++ b/GETOOLS_SOURCE/modules/Tools.py @@ -346,11 +346,11 @@ def LocatorsBakeReverse(self, translate=True, rotate=True, *args): # TODO , chan Locators.CreateOnSelected(scale = self.floatLocatorSize.Get(), hideParent = self.checkboxLocatorHideParent.Get(), subLocator = self.checkboxLocatorSubLocator.Get(), constraint = True, bake = True, constrainReverse = True, constrainTranslate = translate, constrainRotate = rotate) def LocatorsRelative(self, *args): - Locators.CreateAndBakeAsChildrenFromLastSelected(scale = self.floatLocatorSize.Get(), hideParent = self.checkboxLocatorHideParent.Get(), subLocator = self.checkboxLocatorSubLocator.Get()) + Locators.CreateAndBakeAsChildrenFromLastSelected(scale = self.floatLocatorSize.Get(), hideParent = self.checkboxLocatorHideParent.Get(), subLocator = self.checkboxLocatorSubLocator.Get(), euler = self.generalInstance.menuCheckboxEulerFilter.Get()) def LocatorsRelativeReverseSkipLast(self, *args): - Locators.CreateAndBakeAsChildrenFromLastSelected(scale = self.floatLocatorSize.Get(), hideParent = self.checkboxLocatorHideParent.Get(), subLocator = self.checkboxLocatorSubLocator.Get(), constraintReverse = True) + Locators.CreateAndBakeAsChildrenFromLastSelected(scale = self.floatLocatorSize.Get(), hideParent = self.checkboxLocatorHideParent.Get(), subLocator = self.checkboxLocatorSubLocator.Get(), constraintReverse = True, euler = self.generalInstance.menuCheckboxEulerFilter.Get()) def LocatorsRelativeReverse(self, *args): - Locators.CreateAndBakeAsChildrenFromLastSelected(scale = self.floatLocatorSize.Get(), hideParent = self.checkboxLocatorHideParent.Get(), subLocator = self.checkboxLocatorSubLocator.Get(), constraintReverse = True, skipLastReverse = False) + Locators.CreateAndBakeAsChildrenFromLastSelected(scale = self.floatLocatorSize.Get(), hideParent = self.checkboxLocatorHideParent.Get(), subLocator = self.checkboxLocatorSubLocator.Get(), constraintReverse = True, skipLastReverse = False, euler = self.generalInstance.menuCheckboxEulerFilter.Get()) def LocatorsBakeAim(self, axis, rotateOnly=False, *args): scale = self.floatLocatorSize.Get() @@ -365,7 +365,7 @@ def LocatorsBakeAim(self, axis, rotateOnly=False, *args): elif (axis == 5): axisVector = (0, 0, -1) elif (axis == 6): axisVector = (0, 0, 1) - Locators.CreateOnSelectedAim(scale = scale, hideParent = hideParent, subLocator = subLocators, rotateOnly = rotateOnly, aimVector = axisVector, distance = distance, reverse = True) + Locators.CreateOnSelectedAim(scale = scale, hideParent = hideParent, subLocator = subLocators, rotateOnly = rotateOnly, aimVector = axisVector, distance = distance, reverse = True, euler = self.generalInstance.menuCheckboxEulerFilter.Get()) if (distance == 0): cmds.warning("Aim distance is 0. Highly recommended to use non-zero value.") diff --git a/GETOOLS_SOURCE/utils/Locators.py b/GETOOLS_SOURCE/utils/Locators.py index 5b69209..145c582 100644 --- a/GETOOLS_SOURCE/utils/Locators.py +++ b/GETOOLS_SOURCE/utils/Locators.py @@ -105,7 +105,7 @@ def Create(name=nameBase, scale=scale, hideParent=False, subLocator=False): return locatorCurrent, subLocator else: return locatorCurrent -def CreateOnSelected(name=nameBase, scale=scale, minSelectedCount=minSelectedCount, hideParent=False, subLocator=False, constraint=False, bake=False, parentToLastSelected=False, constrainReverse=False, constrainTranslate=True, constrainRotate=True): +def CreateOnSelected(name=nameBase, scale=scale, minSelectedCount=minSelectedCount, hideParent=False, subLocator=False, constraint=False, bake=False, parentToLastSelected=False, constrainReverse=False, constrainTranslate=True, constrainRotate=True, euler=False): # Check selected objects selectedList = Selector.MultipleObjects(minSelectedCount) if (selectedList == None): @@ -142,7 +142,7 @@ def CreateOnSelected(name=nameBase, scale=scale, minSelectedCount=minSelectedCou # Bake locators and delete constraints cmds.select(locatorsList) - Baker.BakeSelected() + Baker.BakeSelected(euler = euler) Animation.DeleteStaticCurves() Constraints.DeleteConstraints(locatorsList) @@ -162,9 +162,9 @@ def CreateOnSelected(name=nameBase, scale=scale, minSelectedCount=minSelectedCou else: cmds.select(locatorsList) return selectedList, locatorsList -def CreateAndBakeAsChildrenFromLastSelected(scale=scale, minSelectedCount=2, hideParent=False, subLocator=False, constraintReverse=False, skipLastReverse=True): +def CreateAndBakeAsChildrenFromLastSelected(scale=scale, minSelectedCount=2, hideParent=False, subLocator=False, constraintReverse=False, skipLastReverse=True, euler=False): # Check selected objects - objects = CreateOnSelected(scale = scale, minSelectedCount = minSelectedCount, hideParent = hideParent, subLocator = subLocator, constraint = True, bake = True, parentToLastSelected = True) + objects = CreateOnSelected(scale = scale, minSelectedCount = minSelectedCount, hideParent = hideParent, subLocator = subLocator, constraint = True, bake = True, parentToLastSelected = True, euler = euler) if (objects == None): return None @@ -184,9 +184,9 @@ def CreateAndBakeAsChildrenFromLastSelected(scale=scale, minSelectedCount=2, hid else: cmds.select(objects[1][-1]) return objects -def CreateOnSelectedAim(name=nameAim, scale=scale, minSelectedCount=minSelectedCount, hideParent=False, subLocator=False, rotateOnly=False, aimVector=(1,0,0), distance=100, reverse=True): +def CreateOnSelectedAim(name=nameAim, scale=scale, minSelectedCount=minSelectedCount, hideParent=False, subLocator=False, rotateOnly=False, aimVector=(1,0,0), distance=100, reverse=True, euler=False): # Check selected objects - objects = CreateOnSelected(name = name, scale = scale, minSelectedCount = minSelectedCount, hideParent = hideParent, subLocator = subLocator) + objects = CreateOnSelected(name = name, scale = scale, minSelectedCount = minSelectedCount, hideParent = hideParent, subLocator = subLocator, euler = euler) if (objects == None): return None @@ -226,7 +226,7 @@ def CreateOnSelectedAim(name=nameAim, scale=scale, minSelectedCount=minSelectedC # Bake animation from original objects cmds.select(objects[1] + locatorsTargetsList, replace = True) - Baker.BakeSelected() + Baker.BakeSelected(euler = euler) Constraints.DeleteConstraints(objects[1]) Constraints.DeleteConstraints(locatorsTargetsList) Animation.DeleteStaticCurves() diff --git a/changelog.txt b/changelog.txt index 73a2160..116fb5b 100644 --- a/changelog.txt +++ b/changelog.txt @@ -6,8 +6,9 @@ v1.2.3 - [UI] Replaced button icon change approach, now simply use Help/Change Icon for toggling icons. - [UI] Added "Options" menu with euler filter checkbox. - [UI] Moved "To Shelf" menu to the new "Options" menu. -- Setup connection between base class instance between sub classes. -- Improved euler filter method for using after baking. +- [UI] Changed the color of the black panel to a lighter color. +- Added connection between base class instance and sub classes. +- Improved euler filter method for using after animation baking. v1.1.0 - [CRITICAL] Fixed compatibility with Maya 2025. From df2773de25aaf7d714a82e9eb663dd94053a614b Mon Sep 17 00:00:00 2001 From: Eugene Date: Fri, 26 Jul 2024 18:09:35 -0700 Subject: [PATCH 14/16] fix base class instance for euler check --- GETOOLS_SOURCE/modules/CenterOfMass.py | 11 ++++++++--- GETOOLS_SOURCE/modules/GeneralWindow.py | 4 ++-- GETOOLS_SOURCE/modules/Overlappy.py | 2 +- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/GETOOLS_SOURCE/modules/CenterOfMass.py b/GETOOLS_SOURCE/modules/CenterOfMass.py index bdae259..f3967ec 100644 --- a/GETOOLS_SOURCE/modules/CenterOfMass.py +++ b/GETOOLS_SOURCE/modules/CenterOfMass.py @@ -88,7 +88,12 @@ class CenterOfMass: name = "CENTER OF MASS" title = name + " " + version - def __init__(self): + # HACK use only for code editor # TODO try to find better way to get access to other classes with cross import + # from ..modules import GeneralWindow + # def __init__(self, generalInstance: GeneralWindow.GeneralWindow): + def __init__(self, generalInstance): + self.generalInstance = generalInstance + self.COMObject = None self.CachedSelectedObjects = None @@ -283,7 +288,7 @@ def BakeScenario2(self, *args): cmds.select(clear = True) return - self.CachedSelectedObjects = Locators.CreateAndBakeAsChildrenFromLastSelected() + self.CachedSelectedObjects = Locators.CreateAndBakeAsChildrenFromLastSelected(euler = self.generalInstance.menuCheckboxEulerFilter.Get()) return self.CachedSelectedObjects def BakeScenario3(self, *args): objects = self.BakeScenario2() @@ -299,7 +304,7 @@ def BakeCached(self, *args): return cmds.select(self.CachedSelectedObjects[0][0:-1]) - Baker.BakeSelected() + Baker.BakeSelected(euler = self.generalInstance.menuCheckboxEulerFilter.Get()) cmds.delete(self.CachedSelectedObjects[1][-1]) def LinkCached(self, maintainOffset=False, *args): diff --git a/GETOOLS_SOURCE/modules/GeneralWindow.py b/GETOOLS_SOURCE/modules/GeneralWindow.py index 40bf8e0..d4f2589 100644 --- a/GETOOLS_SOURCE/modules/GeneralWindow.py +++ b/GETOOLS_SOURCE/modules/GeneralWindow.py @@ -467,10 +467,10 @@ def LayoutRigging(self, parentLayout): Rigging.Rigging().UICreate(self.frameRigging) def LayoutOverlappy(self, parentLayout): self.frameOverlappy = cmds.frameLayout("layoutOverlappy", parent = parentLayout, label = "3. " + Overlappy.Overlappy.title, collapsable = True, backgroundColor = Settings.frames1Color, marginWidth = Settings.margin, marginHeight = Settings.margin) - Overlappy.Overlappy().UICreate(self.frameOverlappy) + Overlappy.Overlappy(self).UICreate(self.frameOverlappy) def LayoutCenterOfMass(self, parentLayout): self.frameCenterOfMass = cmds.frameLayout("layoutCenterOfMass", parent = parentLayout, label = "4. " + CenterOfMass.CenterOfMass.title, collapsable = True, backgroundColor = Settings.frames1Color, marginWidth = Settings.margin, marginHeight = Settings.margin) - CenterOfMass.CenterOfMass().UICreate(self.frameCenterOfMass) + CenterOfMass.CenterOfMass(self).UICreate(self.frameCenterOfMass) def LayoutExperimental(self, parentLayout): self.frameExperimental = cmds.frameLayout("layoutExperimental", parent = parentLayout, label = "5. " + "EXPERIMENTAL", collapsable = True, backgroundColor = Settings.frames1Color, marginWidth = Settings.margin, marginHeight = Settings.margin) cmds.popupMenu() diff --git a/GETOOLS_SOURCE/modules/Overlappy.py b/GETOOLS_SOURCE/modules/Overlappy.py index 2db9b56..72d7183 100644 --- a/GETOOLS_SOURCE/modules/Overlappy.py +++ b/GETOOLS_SOURCE/modules/Overlappy.py @@ -132,7 +132,7 @@ class Overlappy: # HACK use only for code editor # TODO try to find better way to get access to other classes with cross import # from ..modules import GeneralWindow # def __init__(self, generalInstance: GeneralWindow.GeneralWindow): - def __init__(self): + def __init__(self, generalInstance): self.generalInstance = generalInstance # VALUES From 8900bc985025afea4f41ed70282d8bb123f2a164 Mon Sep 17 00:00:00 2001 From: Eugene Date: Tue, 6 Aug 2024 09:30:25 -0700 Subject: [PATCH 15/16] Update changelog.txt --- changelog.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/changelog.txt b/changelog.txt index 116fb5b..75c5060 100644 --- a/changelog.txt +++ b/changelog.txt @@ -2,11 +2,11 @@ GETools changelog v1.2.3 - [OVERLAPPY] Added confirm dialog for zero particle offset. -- [UTILS] Added annotation creation draft logic. +- [UTILS] Added draft annotation creation logic. - [UI] Replaced button icon change approach, now simply use Help/Change Icon for toggling icons. - [UI] Added "Options" menu with euler filter checkbox. - [UI] Moved "To Shelf" menu to the new "Options" menu. -- [UI] Changed the color of the black panel to a lighter color. +- [UI] Changed the color of the black panel to a lighter color (0.00 => 0.13). - Added connection between base class instance and sub classes. - Improved euler filter method for using after animation baking. From 21f9fc13d0b59a4fdbc6972034d949bd65fcd155 Mon Sep 17 00:00:00 2001 From: Eugene Date: Tue, 6 Aug 2024 09:39:20 -0700 Subject: [PATCH 16/16] Update changelog.txt --- changelog.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changelog.txt b/changelog.txt index 75c5060..c70a7e0 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,6 +1,6 @@ GETools changelog -v1.2.3 +v1.2.5 - [OVERLAPPY] Added confirm dialog for zero particle offset. - [UTILS] Added draft annotation creation logic. - [UI] Replaced button icon change approach, now simply use Help/Change Icon for toggling icons.