From 4baba0ffda2757d11b9c449e67a5c750b060df6e Mon Sep 17 00:00:00 2001 From: Eugene Date: Wed, 4 Dec 2024 18:00:56 -0800 Subject: [PATCH 1/8] init transformation panel, remove panels numbers --- GETOOLS_SOURCE/modules/GeneralWindow.py | 18 ++- GETOOLS_SOURCE/modules/Transformations.py | 132 ++++++++++++++++++++++ 2 files changed, 145 insertions(+), 5 deletions(-) create mode 100644 GETOOLS_SOURCE/modules/Transformations.py diff --git a/GETOOLS_SOURCE/modules/GeneralWindow.py b/GETOOLS_SOURCE/modules/GeneralWindow.py index 6b28aab..af6e300 100644 --- a/GETOOLS_SOURCE/modules/GeneralWindow.py +++ b/GETOOLS_SOURCE/modules/GeneralWindow.py @@ -26,6 +26,7 @@ from .. import Settings from ..modules import Options +from ..modules import Transformations from ..modules import Tools from ..modules import Rigging from ..modules import Overlappy @@ -57,6 +58,7 @@ def __init__(self): self.optionsPlugin = Options.PluginVariables() self.optionsPlugin.titleGeneral = GeneralWindow._title + self.frameTransformations = None self.frameTools = None self.frameRigging = None self.frameOverlappy = None @@ -74,6 +76,7 @@ def CreateUI(self): layoutScroll = cmds.scrollLayout(parent = generalWindow, width = Settings.windowWidthOffset) + self.LayoutTransformations(parentLayout = layoutScroll) self.LayoutTools(parentLayout = layoutScroll) self.LayoutRigging(parentLayout = layoutScroll) self.LayoutOverlappy(parentLayout = layoutScroll) @@ -432,24 +435,27 @@ def LayoutMenuOptions(self): cmds.menuItem(label = "Delete", command = partial(Install.ToShelf_MotionTrailDelete, self.optionsPlugin.directory), image = Icons.minus) cmds.setParent('..', menu = True) + def LayoutTransformations(self, parentLayout): + self.frameTransformations = cmds.frameLayout(parent = parentLayout, label = Transformations.Transformations._title, collapsable = True, backgroundColor = Settings.frames1Color, width = Settings.windowWidth, marginWidth = Settings.marginWidth, marginHeight = Settings.marginHeight) + Transformations.Transformations(self.optionsPlugin).UICreate(self.frameTransformations) def LayoutTools(self, parentLayout): - self.frameTools = cmds.frameLayout(parent = parentLayout, label = "1. " + Tools.Tools._title, collapsable = True, backgroundColor = Settings.frames1Color, width = Settings.windowWidth, marginWidth = Settings.marginWidth, marginHeight = Settings.marginHeight) + self.frameTools = cmds.frameLayout(parent = parentLayout, label = Tools.Tools._title, collapsable = True, backgroundColor = Settings.frames1Color, width = Settings.windowWidth, marginWidth = Settings.marginWidth, marginHeight = Settings.marginHeight) Tools.Tools(self.optionsPlugin).UICreate(self.frameTools) def LayoutRigging(self, parentLayout): - self.frameRigging = cmds.frameLayout(parent = parentLayout, label = "2. " + Rigging.Rigging._title, collapsable = True, backgroundColor = Settings.frames1Color, width = Settings.windowWidth, marginWidth = Settings.marginWidth, marginHeight = Settings.marginHeight) + self.frameRigging = cmds.frameLayout(parent = parentLayout, label = Rigging.Rigging._title, collapsable = True, backgroundColor = Settings.frames1Color, width = Settings.windowWidth, marginWidth = Settings.marginWidth, marginHeight = Settings.marginHeight) Rigging.Rigging(self.optionsPlugin).UICreate(self.frameRigging) def LayoutOverlappy(self, parentLayout): - self.frameOverlappy = cmds.frameLayout(parent = parentLayout, label = "3. " + Overlappy.Overlappy._title, collapsable = True, backgroundColor = Settings.frames1Color, width = Settings.windowWidth, marginWidth = Settings.marginWidth, marginHeight = Settings.marginHeight) + self.frameOverlappy = cmds.frameLayout(parent = parentLayout, label = Overlappy.Overlappy._title, collapsable = True, backgroundColor = Settings.frames1Color, width = Settings.windowWidth, marginWidth = Settings.marginWidth, marginHeight = Settings.marginHeight) Overlappy.Overlappy(self.optionsPlugin).UICreate(self.frameOverlappy) def LayoutCenterOfMass(self, parentLayout): - self.frameCenterOfMass = cmds.frameLayout(parent = parentLayout, label = "4. " + CenterOfMass.CenterOfMass._title, collapsable = True, backgroundColor = Settings.frames1Color, width = Settings.windowWidth, marginWidth = Settings.marginWidth, marginHeight = Settings.marginHeight) + self.frameCenterOfMass = cmds.frameLayout(parent = parentLayout, label = CenterOfMass.CenterOfMass._title, collapsable = True, backgroundColor = Settings.frames1Color, width = Settings.windowWidth, marginWidth = Settings.marginWidth, marginHeight = Settings.marginHeight) CenterOfMass.CenterOfMass(self.optionsPlugin).UICreate(self.frameCenterOfMass) def LayoutMotionTrail(self, parentLayout): versionMT = "v1.0" # TODO move to Motion Trail class when possible nameMT = "MOTION TRAIL" titleMT = nameMT + " " + versionMT - self.frameMotionTrail = cmds.frameLayout(parent = parentLayout, label = "5. " + titleMT, collapsable = True, backgroundColor = Settings.frames1Color, width = Settings.windowWidth, marginWidth = Settings.marginWidth, marginHeight = Settings.marginHeight) + self.frameMotionTrail = cmds.frameLayout(parent = parentLayout, label = titleMT, collapsable = True, backgroundColor = Settings.frames1Color, width = Settings.windowWidth, marginWidth = Settings.marginWidth, marginHeight = Settings.marginHeight) countOffsets = 3 cmds.gridLayout(parent = self.frameMotionTrail, numberOfColumns = countOffsets, cellWidth = Settings.windowWidthMargin / countOffsets, cellHeight = Settings.lineHeight) @@ -486,6 +492,8 @@ def WindowDelete(self, *args): else: print("No Window") def FramesCollapse(self, value, *args): # TODO collapse function for sub frames + if self.frameTransformations is not None: + cmds.frameLayout(self.frameTransformations, edit = True, collapse = value) if self.frameTools is not None: cmds.frameLayout(self.frameTools, edit = True, collapse = value) if self.frameRigging is not None: diff --git a/GETOOLS_SOURCE/modules/Transformations.py b/GETOOLS_SOURCE/modules/Transformations.py new file mode 100644 index 0000000..b7e7db9 --- /dev/null +++ b/GETOOLS_SOURCE/modules/Transformations.py @@ -0,0 +1,132 @@ +# 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 https://discord.gg/heMxJhTqCz +# Source code: https://github.com/GenEugene/GETools or https://app.gumroad.com/geneugene + +import maya.cmds as cmds +# from functools import partial + +from .. import Settings +# from ..utils import Animation +# from ..utils import Baker +# from ..utils import ChainDistributionRig +from ..utils import Colors +# from ..utils import Locators +# from ..utils import Selector +# from ..utils import Timeline +# from ..values import Enums + + +class TransformationsAnnotations: + annotation = "xxxxxxxxxxxxxxxxxxx" + +class TransformationsSettings: + value = 0 + +class Transformations: + _version = "v0.0" + _name = "TRANSFORMATIONS" + _title = _name + " " + _version + + def __init__(self, options): + self.optionsPlugin = options + ### Check Maya version to avoid cycle import, Maya 2020 and older can't use cycle import + if cmds.about(version = True) in ["2022", "2023", "2024", "2025"]: + from . import Options + if isinstance(options, Options.PluginVariables): + self.optionsPlugin = options + + ### + # self.aimSpaceFloatField = None + # self.aimSpaceRadioButtons = [None, None, None] + # self.aimSpaceCheckbox = None + + def UICreate(self, layoutMain): + self.UILayoutLocators(layoutMain) + cmds.separator(parent = layoutMain, height = Settings.separatorHeight, style = "none") + + def UILayoutLocators(self, layoutMain): + cmds.frameLayout(parent = layoutMain, label = Settings.frames2Prefix + "MOVE", collapsable = True, backgroundColor = Settings.frames2Color, highlightColor = Colors.green100, marginWidth = 0, marginHeight = 0, borderVisible = True) + layoutColumn = cmds.columnLayout(adjustableColumn = True) # , rowSpacing = Settings.columnLayoutRowSpacing + + cmds.radioButtonGrp(parent = layoutColumn, label = "Space: ", labelArray3 = ["World", "Local", "Object"], numberOfRadioButtons = 3, columnWidth4 = [60, 60, 60, 60], columnAlign = [(1, "right"), (2, "center"), (3, "center"), (4, "center")], height = Settings.lineHeight) + + rowLayout = cmds.rowLayout(adjustableColumn = 2, numberOfColumns = 2, columnWidth2 = (220, 30), columnAlign = [(1, "right"), (2, "center")], columnAttach = [(1, "both", 0), (2, "both", 0)], height = Settings.lineHeight) + cmds.floatFieldGrp(parent = rowLayout, label = "Direction: ", numberOfFields = 3, columnWidth4 = [60, 50, 50, 50], value = (0, 0, 0, 0), columnAlign = [(1, "right"), (2, "center"), (3, "center"), (4, "center")]) + cmds.popupMenu() + cmds.menuItem(label = "X = 1") + cmds.menuItem(label = "Y = 1") + cmds.menuItem(label = "Z = 1") + cmds.menuItem(divider = True) + cmds.menuItem(label = "1, 0, 0") + cmds.menuItem(label = "0, 1, 0") + cmds.menuItem(label = "0, 0, 1") + cmds.menuItem(divider = True) + cmds.menuItem(label = "-1, 0, 0") + cmds.menuItem(label = "0, -1, 0") + cmds.menuItem(label = "0, 0, -1") + cmds.button(parent = rowLayout, label = "Zero") + + cmds.rowLayout(parent = layoutColumn, numberOfColumns = 3, columnWidth3 = (60, 70, 110), columnAlign = [(1, "right"), (2, "center"), (3, "center")], columnAttach = [(1, "both", 0), (2, "both", 0), (3, "both", 0)], height = Settings.lineHeight) + cmds.text(label = "Multiplier: ") + cmds.floatField(value = 1, precision = 3, minValue = 0) + cmds.popupMenu() + cmds.menuItem(label = "0.01") + cmds.menuItem(label = "0.1") + cmds.menuItem(label = "0.5") + cmds.menuItem(divider = True) + cmds.menuItem(label = "1") + cmds.menuItem(label = "2") + cmds.menuItem(label = "5") + cmds.menuItem(divider = True) + cmds.menuItem(label = "10") + cmds.menuItem(label = "100") + cmds.menuItem(label = "1000") + cmds.checkBox(label = "Reverse Direction", value = False) + + cmds.rowLayout(parent = layoutColumn, numberOfColumns = 3, columnWidth3 = (140, 50, 80), columnAlign = [(1, "center"), (2, "center"), (3, "center")], columnAttach = [(1, "both", 0), (2, "both", 0), (3, "both", 0)], height = Settings.lineHeight) + cmds.checkBox(label = "Preserve Child Position", value = False) + cmds.checkBox(label = "Pivot", value = False) + cmds.button(label = "Show Pivot") + + cmds.rowLayout(parent = layoutColumn, numberOfColumns = 4, columnWidth4 = (60, 60, 60, 60), columnAlign = [(1, "right"), (2, "center"), (3, "center"), (4, "center")], columnAttach = [(1, "both", 0), (2, "both", 0), (3, "both", 0), (4, "both", 0)], height = Settings.lineHeight) + cmds.text(label = "Move: ") + cmds.button(label = "X", backgroundColor = Colors.red10) + cmds.button(label = "Y", backgroundColor = Colors.green10) + cmds.button(label = "Z", backgroundColor = Colors.blue10) + + + def MoveSelected(self, *args): # TODO + vector = (0, 1, 0) + selected = cmds.ls(selection = True) + + cmds.move(vector[0], vector[1], vector[2], selected, worldSpace = True, objectSpace = True, localSpace = True, relative = True) + + # preserveChildPosition + + # cmds.setAttr(item + "." + Enums.Attributes.rotatePivotX, channelBox = on) + # cmds.setAttr(item + "." + Enums.Attributes.rotatePivotY, channelBox = on) + # cmds.setAttr(item + "." + Enums.Attributes.rotatePivotZ, channelBox = on) + + # cmds.setAttr(item + "." + Enums.Attributes.scalePivotX, channelBox = on) + # cmds.setAttr(item + "." + Enums.Attributes.scalePivotX, channelBox = on) + # cmds.setAttr(item + "." + Enums.Attributes.scalePivotX, channelBox = on) + From 2f55c6793241a9f06cff2a285b9dcfe4a1ae3c9f Mon Sep 17 00:00:00 2001 From: Eugene Date: Thu, 5 Dec 2024 09:51:51 -0800 Subject: [PATCH 2/8] revert panels label numbers --- GETOOLS_SOURCE/modules/GeneralWindow.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/GETOOLS_SOURCE/modules/GeneralWindow.py b/GETOOLS_SOURCE/modules/GeneralWindow.py index af6e300..5d27be3 100644 --- a/GETOOLS_SOURCE/modules/GeneralWindow.py +++ b/GETOOLS_SOURCE/modules/GeneralWindow.py @@ -436,26 +436,26 @@ def LayoutMenuOptions(self): cmds.setParent('..', menu = True) def LayoutTransformations(self, parentLayout): - self.frameTransformations = cmds.frameLayout(parent = parentLayout, label = Transformations.Transformations._title, collapsable = True, backgroundColor = Settings.frames1Color, width = Settings.windowWidth, marginWidth = Settings.marginWidth, marginHeight = Settings.marginHeight) + self.frameTransformations = cmds.frameLayout(parent = parentLayout, label = "1. " + Transformations.Transformations._title, collapsable = True, backgroundColor = Settings.frames1Color, width = Settings.windowWidth, marginWidth = Settings.marginWidth, marginHeight = Settings.marginHeight) Transformations.Transformations(self.optionsPlugin).UICreate(self.frameTransformations) def LayoutTools(self, parentLayout): - self.frameTools = cmds.frameLayout(parent = parentLayout, label = Tools.Tools._title, collapsable = True, backgroundColor = Settings.frames1Color, width = Settings.windowWidth, marginWidth = Settings.marginWidth, marginHeight = Settings.marginHeight) + self.frameTools = cmds.frameLayout(parent = parentLayout, label = "2. " + Tools.Tools._title, collapsable = True, backgroundColor = Settings.frames1Color, width = Settings.windowWidth, marginWidth = Settings.marginWidth, marginHeight = Settings.marginHeight) Tools.Tools(self.optionsPlugin).UICreate(self.frameTools) def LayoutRigging(self, parentLayout): - self.frameRigging = cmds.frameLayout(parent = parentLayout, label = Rigging.Rigging._title, collapsable = True, backgroundColor = Settings.frames1Color, width = Settings.windowWidth, marginWidth = Settings.marginWidth, marginHeight = Settings.marginHeight) + self.frameRigging = cmds.frameLayout(parent = parentLayout, label = "3. " + Rigging.Rigging._title, collapsable = True, backgroundColor = Settings.frames1Color, width = Settings.windowWidth, marginWidth = Settings.marginWidth, marginHeight = Settings.marginHeight) Rigging.Rigging(self.optionsPlugin).UICreate(self.frameRigging) def LayoutOverlappy(self, parentLayout): - self.frameOverlappy = cmds.frameLayout(parent = parentLayout, label = Overlappy.Overlappy._title, collapsable = True, backgroundColor = Settings.frames1Color, width = Settings.windowWidth, marginWidth = Settings.marginWidth, marginHeight = Settings.marginHeight) + self.frameOverlappy = cmds.frameLayout(parent = parentLayout, label = "4. " + Overlappy.Overlappy._title, collapsable = True, backgroundColor = Settings.frames1Color, width = Settings.windowWidth, marginWidth = Settings.marginWidth, marginHeight = Settings.marginHeight) Overlappy.Overlappy(self.optionsPlugin).UICreate(self.frameOverlappy) def LayoutCenterOfMass(self, parentLayout): - self.frameCenterOfMass = cmds.frameLayout(parent = parentLayout, label = CenterOfMass.CenterOfMass._title, collapsable = True, backgroundColor = Settings.frames1Color, width = Settings.windowWidth, marginWidth = Settings.marginWidth, marginHeight = Settings.marginHeight) + self.frameCenterOfMass = cmds.frameLayout(parent = parentLayout, label = "5. " + CenterOfMass.CenterOfMass._title, collapsable = True, backgroundColor = Settings.frames1Color, width = Settings.windowWidth, marginWidth = Settings.marginWidth, marginHeight = Settings.marginHeight) CenterOfMass.CenterOfMass(self.optionsPlugin).UICreate(self.frameCenterOfMass) def LayoutMotionTrail(self, parentLayout): versionMT = "v1.0" # TODO move to Motion Trail class when possible nameMT = "MOTION TRAIL" titleMT = nameMT + " " + versionMT - self.frameMotionTrail = cmds.frameLayout(parent = parentLayout, label = titleMT, collapsable = True, backgroundColor = Settings.frames1Color, width = Settings.windowWidth, marginWidth = Settings.marginWidth, marginHeight = Settings.marginHeight) + self.frameMotionTrail = cmds.frameLayout(parent = parentLayout, label = "6. " + titleMT, collapsable = True, backgroundColor = Settings.frames1Color, width = Settings.windowWidth, marginWidth = Settings.marginWidth, marginHeight = Settings.marginHeight) countOffsets = 3 cmds.gridLayout(parent = self.frameMotionTrail, numberOfColumns = countOffsets, cellWidth = Settings.windowWidthMargin / countOffsets, cellHeight = Settings.lineHeight) From 50c1b73d0b094dfab85f92a324d97a9a7890bd06 Mon Sep 17 00:00:00 2001 From: Eugene Date: Thu, 5 Dec 2024 17:33:17 -0800 Subject: [PATCH 3/8] update move logic --- GETOOLS_SOURCE/modules/Transformations.py | 172 +++++++++++++++------- 1 file changed, 116 insertions(+), 56 deletions(-) diff --git a/GETOOLS_SOURCE/modules/Transformations.py b/GETOOLS_SOURCE/modules/Transformations.py index b7e7db9..9f9a4a7 100644 --- a/GETOOLS_SOURCE/modules/Transformations.py +++ b/GETOOLS_SOURCE/modules/Transformations.py @@ -22,16 +22,11 @@ # Source code: https://github.com/GenEugene/GETools or https://app.gumroad.com/geneugene import maya.cmds as cmds -# from functools import partial +from functools import partial from .. import Settings -# from ..utils import Animation -# from ..utils import Baker -# from ..utils import ChainDistributionRig from ..utils import Colors -# from ..utils import Locators # from ..utils import Selector -# from ..utils import Timeline # from ..values import Enums @@ -54,10 +49,14 @@ def __init__(self, options): if isinstance(options, Options.PluginVariables): self.optionsPlugin = options - ### - # self.aimSpaceFloatField = None - # self.aimSpaceRadioButtons = [None, None, None] - # self.aimSpaceCheckbox = None + ### UI elements with values + self.radioButtonGrpSpace = None + self.checkBoxRelative = None + self.checkBoxPreserveChildPosition = None + self.checkBoxPivot = None + self.floatFieldMultiplier = None + self.floatFieldGrpDirection = None + self.floatFieldDistance = None def UICreate(self, layoutMain): self.UILayoutLocators(layoutMain) @@ -65,63 +64,124 @@ def UICreate(self, layoutMain): def UILayoutLocators(self, layoutMain): cmds.frameLayout(parent = layoutMain, label = Settings.frames2Prefix + "MOVE", collapsable = True, backgroundColor = Settings.frames2Color, highlightColor = Colors.green100, marginWidth = 0, marginHeight = 0, borderVisible = True) - layoutColumn = cmds.columnLayout(adjustableColumn = True) # , rowSpacing = Settings.columnLayoutRowSpacing + layoutColumn = cmds.columnLayout(adjustableColumn = True) - cmds.radioButtonGrp(parent = layoutColumn, label = "Space: ", labelArray3 = ["World", "Local", "Object"], numberOfRadioButtons = 3, columnWidth4 = [60, 60, 60, 60], columnAlign = [(1, "right"), (2, "center"), (3, "center"), (4, "center")], height = Settings.lineHeight) - - rowLayout = cmds.rowLayout(adjustableColumn = 2, numberOfColumns = 2, columnWidth2 = (220, 30), columnAlign = [(1, "right"), (2, "center")], columnAttach = [(1, "both", 0), (2, "both", 0)], height = Settings.lineHeight) - cmds.floatFieldGrp(parent = rowLayout, label = "Direction: ", numberOfFields = 3, columnWidth4 = [60, 50, 50, 50], value = (0, 0, 0, 0), columnAlign = [(1, "right"), (2, "center"), (3, "center"), (4, "center")]) + self.radioButtonGrpSpace = cmds.radioButtonGrp(parent = layoutColumn, label = "Space: ", labelArray3 = ["World", "Local", "Object"], select = 1, numberOfRadioButtons = 3, columnWidth4 = (60, 50, 50, 50), columnAlign = [(1, "right"), (2, "center"), (3, "center"), (4, "center")], height = Settings.lineHeight) + self.radioButtonGrpSpace = self.radioButtonGrpSpace.replace(Settings.windowName + "|", "") # HACK fix for docked window only. Don't know how to avoid issue + + cmds.rowLayout(parent = layoutColumn, numberOfColumns = 3, columnWidth3 = (70, 150, 50), columnAlign = [(1, "center"), (2, "center"), (3, "center")], columnAttach = [(1, "both", 0), (2, "both", 0), (3, "both", 0)], height = Settings.lineHeight) + self.checkBoxRelative = cmds.checkBox(label = "Relative", value = True) + self.checkBoxPreserveChildPosition = cmds.checkBox(label = "Preserve Child Position", value = False) + self.checkBoxPivot = cmds.checkBox(label = "Pivot", value = False) + + cmds.rowLayout(parent = layoutColumn, numberOfColumns = 4, columnWidth4 = (60, 70, 60, 90), columnAlign = [(1, "right"), (2, "center"), (3, "center"), (4, "center")], columnAttach = [(1, "both", 0), (2, "both", 0), (3, "both", 0), (4, "both", 0)], height = Settings.lineHeight) + cmds.text(label = "Multiplier: ") + self.floatFieldMultiplier = cmds.floatField(value = 1, precision = 3) cmds.popupMenu() - cmds.menuItem(label = "X = 1") - cmds.menuItem(label = "Y = 1") - cmds.menuItem(label = "Z = 1") + cmds.menuItem(label = "0.001", command = partial(self.SetMultiplier, 0.001)) + cmds.menuItem(label = "0.01", command = partial(self.SetMultiplier, 0.01)) + cmds.menuItem(label = "0.1", command = partial(self.SetMultiplier, 0.1)) + cmds.menuItem(label = "0.2", command = partial(self.SetMultiplier, 0.1)) + cmds.menuItem(label = "0.5", command = partial(self.SetMultiplier, 0.5)) cmds.menuItem(divider = True) - cmds.menuItem(label = "1, 0, 0") - cmds.menuItem(label = "0, 1, 0") - cmds.menuItem(label = "0, 0, 1") + cmds.menuItem(label = "1", command = partial(self.SetMultiplier, 1)) cmds.menuItem(divider = True) - cmds.menuItem(label = "-1, 0, 0") - cmds.menuItem(label = "0, -1, 0") - cmds.menuItem(label = "0, 0, -1") - cmds.button(parent = rowLayout, label = "Zero") - - cmds.rowLayout(parent = layoutColumn, numberOfColumns = 3, columnWidth3 = (60, 70, 110), columnAlign = [(1, "right"), (2, "center"), (3, "center")], columnAttach = [(1, "both", 0), (2, "both", 0), (3, "both", 0)], height = Settings.lineHeight) - cmds.text(label = "Multiplier: ") - cmds.floatField(value = 1, precision = 3, minValue = 0) + cmds.menuItem(label = "1.05", command = partial(self.SetMultiplier, 1.05)) + cmds.menuItem(label = "1.1", command = partial(self.SetMultiplier, 1.1)) + cmds.menuItem(label = "1.5", command = partial(self.SetMultiplier, 1.5)) + cmds.menuItem(divider = True) + cmds.menuItem(label = "2", command = partial(self.SetMultiplier, 2)) + cmds.menuItem(label = "3", command = partial(self.SetMultiplier, 3)) + cmds.menuItem(label = "4", command = partial(self.SetMultiplier, 4)) + cmds.menuItem(label = "5", command = partial(self.SetMultiplier, 5)) + cmds.menuItem(divider = True) + cmds.menuItem(label = "10", command = partial(self.SetMultiplier, 10)) + cmds.menuItem(label = "100", command = partial(self.SetMultiplier, 100)) + cmds.menuItem(label = "1000", command = partial(self.SetMultiplier, 1000)) + # TODO fill space with 1-2 elements + + rowLayoutDirection = cmds.rowLayout(parent = layoutColumn, adjustableColumn = 2, numberOfColumns = 2, columnWidth2 = (188, 60), columnAlign = [(1, "right"), (2, "center")], columnAttach = [(1, "both", 0), (2, "both", 0)], height = Settings.lineHeight) + self.floatFieldGrpDirection = cmds.floatFieldGrp(parent = rowLayoutDirection, label = "Direction: ", numberOfFields = 3, columnWidth4 = (60, 40, 40, 40), value = [0, 0, 0, 0], columnAlign = [(1, "right"), (2, "center"), (3, "center"), (4, "center")]) + self.floatFieldGrpDirection = self.floatFieldGrpDirection.replace(Settings.windowName + "|", "") # HACK fix for docked window only. Don't know how to avoid issue cmds.popupMenu() - cmds.menuItem(label = "0.01") - cmds.menuItem(label = "0.1") - cmds.menuItem(label = "0.5") + cmds.menuItem(label = "0, 0, 0", command = partial(self.SetDirection, [0, 0, 0])) cmds.menuItem(divider = True) - cmds.menuItem(label = "1") - cmds.menuItem(label = "2") - cmds.menuItem(label = "5") + cmds.menuItem(label = "1, 0, 0", command = partial(self.SetDirection, [1, 0, 0])) + cmds.menuItem(label = "0, 1, 0", command = partial(self.SetDirection, [0, 1, 0])) + cmds.menuItem(label = "0, 0, 1", command = partial(self.SetDirection, [0, 0, 1])) + cmds.gridLayout(parent = rowLayoutDirection, numberOfColumns = 2, cellWidth = 44, cellHeight = Settings.lineHeight) + cmds.button(label = "-XYZ", command = partial(self.MoveSelected, 0, True), backgroundColor = Colors.orange10) + cmds.button(label = "+XYZ", command = partial(self.MoveSelected, 0, False), backgroundColor = Colors.orange50) + + cmds.rowLayout(parent = layoutColumn, adjustableColumn = 2, numberOfColumns = 3, columnWidth3 = (60, 50, 156), columnAlign = [(1, "right"), (2, "center"), (3, "center")], columnAttach = [(1, "both", 0), (2, "both", 0), (3, "both", 0)], height = Settings.lineHeight) + cmds.text(label = "Distance: ") + self.floatFieldDistance = cmds.floatField(value = 1, precision = 3) + cmds.popupMenu() + cmds.menuItem(label = "0", command = partial(self.SetDistance, 0)) cmds.menuItem(divider = True) - cmds.menuItem(label = "10") - cmds.menuItem(label = "100") - cmds.menuItem(label = "1000") - cmds.checkBox(label = "Reverse Direction", value = False) - - cmds.rowLayout(parent = layoutColumn, numberOfColumns = 3, columnWidth3 = (140, 50, 80), columnAlign = [(1, "center"), (2, "center"), (3, "center")], columnAttach = [(1, "both", 0), (2, "both", 0), (3, "both", 0)], height = Settings.lineHeight) - cmds.checkBox(label = "Preserve Child Position", value = False) - cmds.checkBox(label = "Pivot", value = False) - cmds.button(label = "Show Pivot") - - cmds.rowLayout(parent = layoutColumn, numberOfColumns = 4, columnWidth4 = (60, 60, 60, 60), columnAlign = [(1, "right"), (2, "center"), (3, "center"), (4, "center")], columnAttach = [(1, "both", 0), (2, "both", 0), (3, "both", 0), (4, "both", 0)], height = Settings.lineHeight) - cmds.text(label = "Move: ") - cmds.button(label = "X", backgroundColor = Colors.red10) - cmds.button(label = "Y", backgroundColor = Colors.green10) - cmds.button(label = "Z", backgroundColor = Colors.blue10) - + cmds.menuItem(label = "0.01", command = partial(self.SetDistance, 0.01)) + cmds.menuItem(label = "0.1", command = partial(self.SetDistance, 0.1)) + cmds.menuItem(label = "0.5", command = partial(self.SetDistance, 0.5)) + cmds.menuItem(divider = True) + cmds.menuItem(label = "1", command = partial(self.SetDistance, 1)) + cmds.menuItem(label = "2", command = partial(self.SetDistance, 2)) + cmds.menuItem(label = "3", command = partial(self.SetDistance, 3)) + cmds.menuItem(label = "5", command = partial(self.SetDistance, 5)) + cmds.menuItem(divider = True) + cmds.menuItem(label = "10", command = partial(self.SetDistance, 10)) + cmds.menuItem(label = "100", command = partial(self.SetDistance, 100)) + cmds.menuItem(label = "1000", command = partial(self.SetDistance, 1000)) + cmds.gridLayout(numberOfColumns = 6, cellWidth = 26, cellHeight = Settings.lineHeight) + cmds.button(label = "-X", command = partial(self.MoveSelected, 1, True), backgroundColor = Colors.red10) + cmds.button(label = "+X", command = partial(self.MoveSelected, 1, False), backgroundColor = Colors.red50) + cmds.button(label = "-Y", command = partial(self.MoveSelected, 2, True), backgroundColor = Colors.green10) + cmds.button(label = "+Y", command = partial(self.MoveSelected, 2, False), backgroundColor = Colors.green50) + cmds.button(label = "-Z", command = partial(self.MoveSelected, 3, True), backgroundColor = Colors.blue10) + cmds.button(label = "+Z", command = partial(self.MoveSelected, 3, False), backgroundColor = Colors.blue50) + + + def SetMultiplier(self, value, *args): + cmds.floatField(self.floatFieldMultiplier, edit = True, value = value) + + def SetDirection(self, value, *args): + cmds.floatFieldGrp(self.floatFieldGrpDirection, edit = True, value = [value[0], value[1], value[2], 0]) + + def SetDistance(self, value, *args): + cmds.floatField(self.floatFieldDistance, edit = True, value = value) + + def MoveSelected(self, axis, reverse=False, *args): + space = cmds.radioButtonGrp(self.radioButtonGrpSpace, query = True, select = True) + isWorldSpace = space == 1 + isLocalSpace = space == 2 + isObjectSpace = space == 3 + + relative = cmds.checkBox(self.checkBoxRelative, query = True, value = True) + preserveChildPosition = cmds.checkBox(self.checkBoxPreserveChildPosition, query = True, value = True) + pivot = cmds.checkBox(self.checkBoxPivot, query = True, value = True) # TODO + + direction = [0, 0, 0] + if axis == 0: + direction = cmds.floatFieldGrp(self.floatFieldGrpDirection, query = True, value = True) + else: + distance = cmds.floatField(self.floatFieldDistance, query = True, value = True) + if axis == 1: + direction = [distance, 0, 0] + if axis == 2: + direction = [0, distance, 0] + if axis == 3: + direction = [0, 0, distance] + + multiplier = cmds.floatField(self.floatFieldMultiplier, query = True, value = True) + multiplier = multiplier * (-1 if reverse else 1) + direction[0] = direction[0] * multiplier + direction[1] = direction[1] * multiplier + direction[2] = direction[2] * multiplier - def MoveSelected(self, *args): # TODO - vector = (0, 1, 0) selected = cmds.ls(selection = True) - cmds.move(vector[0], vector[1], vector[2], selected, worldSpace = True, objectSpace = True, localSpace = True, relative = True) - - # preserveChildPosition + cmds.move(direction[0], direction[1], direction[2], selected, worldSpace = isWorldSpace, objectSpace = isObjectSpace, localSpace = isLocalSpace, relative = relative, preserveChildPosition = preserveChildPosition) + # TODO # cmds.setAttr(item + "." + Enums.Attributes.rotatePivotX, channelBox = on) # cmds.setAttr(item + "." + Enums.Attributes.rotatePivotY, channelBox = on) # cmds.setAttr(item + "." + Enums.Attributes.rotatePivotZ, channelBox = on) From bd483b6617c964edee934ad9a04e65ed6c234f65 Mon Sep 17 00:00:00 2001 From: Eugene Date: Thu, 5 Dec 2024 22:01:05 -0800 Subject: [PATCH 4/8] add pivot manipulations --- GETOOLS_SOURCE/modules/Transformations.py | 40 +++++++++++++---------- 1 file changed, 22 insertions(+), 18 deletions(-) diff --git a/GETOOLS_SOURCE/modules/Transformations.py b/GETOOLS_SOURCE/modules/Transformations.py index 9f9a4a7..c5a8a0e 100644 --- a/GETOOLS_SOURCE/modules/Transformations.py +++ b/GETOOLS_SOURCE/modules/Transformations.py @@ -57,11 +57,9 @@ def __init__(self, options): self.floatFieldMultiplier = None self.floatFieldGrpDirection = None self.floatFieldDistance = None - def UICreate(self, layoutMain): self.UILayoutLocators(layoutMain) cmds.separator(parent = layoutMain, height = Settings.separatorHeight, style = "none") - def UILayoutLocators(self, layoutMain): cmds.frameLayout(parent = layoutMain, label = Settings.frames2Prefix + "MOVE", collapsable = True, backgroundColor = Settings.frames2Color, highlightColor = Colors.green100, marginWidth = 0, marginHeight = 0, borderVisible = True) layoutColumn = cmds.columnLayout(adjustableColumn = True) @@ -74,7 +72,7 @@ def UILayoutLocators(self, layoutMain): self.checkBoxPreserveChildPosition = cmds.checkBox(label = "Preserve Child Position", value = False) self.checkBoxPivot = cmds.checkBox(label = "Pivot", value = False) - cmds.rowLayout(parent = layoutColumn, numberOfColumns = 4, columnWidth4 = (60, 70, 60, 90), columnAlign = [(1, "right"), (2, "center"), (3, "center"), (4, "center")], columnAttach = [(1, "both", 0), (2, "both", 0), (3, "both", 0), (4, "both", 0)], height = Settings.lineHeight) + cmds.rowLayout(parent = layoutColumn, adjustableColumn = 2, numberOfColumns = 5, columnWidth5 = (60, 50, 60, 50, 50), columnAlign = [(1, "right"), (2, "center"), (3, "center"), (4, "center"), (5, "center")], columnAttach = [(1, "both", 0), (2, "both", 0), (3, "both", 0), (4, "both", 0), (5, "both", 0)], height = Settings.lineHeight) cmds.text(label = "Multiplier: ") self.floatFieldMultiplier = cmds.floatField(value = 1, precision = 3) cmds.popupMenu() @@ -98,7 +96,9 @@ def UILayoutLocators(self, layoutMain): cmds.menuItem(label = "10", command = partial(self.SetMultiplier, 10)) cmds.menuItem(label = "100", command = partial(self.SetMultiplier, 100)) cmds.menuItem(label = "1000", command = partial(self.SetMultiplier, 1000)) - # TODO fill space with 1-2 elements + cmds.button(label = "Edit Pivot", command = cmds.EnterEditModePress, backgroundColor = Colors.yellow10) + cmds.button(label = "Pivot On", command = partial(self.SetPivotAttributes, True), backgroundColor = Colors.blackWhite80) + cmds.button(label = "Pivot Off", command = partial(self.SetPivotAttributes, False), backgroundColor = Colors.blackWhite80) rowLayoutDirection = cmds.rowLayout(parent = layoutColumn, adjustableColumn = 2, numberOfColumns = 2, columnWidth2 = (188, 60), columnAlign = [(1, "right"), (2, "center")], columnAttach = [(1, "both", 0), (2, "both", 0)], height = Settings.lineHeight) self.floatFieldGrpDirection = cmds.floatFieldGrp(parent = rowLayoutDirection, label = "Direction: ", numberOfFields = 3, columnWidth4 = (60, 40, 40, 40), value = [0, 0, 0, 0], columnAlign = [(1, "right"), (2, "center"), (3, "center"), (4, "center")]) @@ -139,15 +139,21 @@ def UILayoutLocators(self, layoutMain): cmds.button(label = "-Z", command = partial(self.MoveSelected, 3, True), backgroundColor = Colors.blue10) cmds.button(label = "+Z", command = partial(self.MoveSelected, 3, False), backgroundColor = Colors.blue50) - def SetMultiplier(self, value, *args): cmds.floatField(self.floatFieldMultiplier, edit = True, value = value) - def SetDirection(self, value, *args): cmds.floatFieldGrp(self.floatFieldGrpDirection, edit = True, value = [value[0], value[1], value[2], 0]) - def SetDistance(self, value, *args): cmds.floatField(self.floatFieldDistance, edit = True, value = value) + def SetPivotAttributes(self, value, *args): + selected = cmds.ls(selection = True) + for i in range(len(selected)): + cmds.setAttr(selected[i] + ".rotatePivotX", channelBox = value) + cmds.setAttr(selected[i] + ".rotatePivotY", channelBox = value) + cmds.setAttr(selected[i] + ".rotatePivotZ", channelBox = value) + cmds.setAttr(selected[i] + ".scalePivotX", channelBox = value) + cmds.setAttr(selected[i] + ".scalePivotY", channelBox = value) + cmds.setAttr(selected[i] + ".scalePivotZ", channelBox = value) def MoveSelected(self, axis, reverse=False, *args): space = cmds.radioButtonGrp(self.radioButtonGrpSpace, query = True, select = True) @@ -157,7 +163,7 @@ def MoveSelected(self, axis, reverse=False, *args): relative = cmds.checkBox(self.checkBoxRelative, query = True, value = True) preserveChildPosition = cmds.checkBox(self.checkBoxPreserveChildPosition, query = True, value = True) - pivot = cmds.checkBox(self.checkBoxPivot, query = True, value = True) # TODO + pivot = cmds.checkBox(self.checkBoxPivot, query = True, value = True) direction = [0, 0, 0] if axis == 0: @@ -178,15 +184,13 @@ def MoveSelected(self, axis, reverse=False, *args): direction[2] = direction[2] * multiplier selected = cmds.ls(selection = True) + selectedFinal = [] + if (pivot): + for i in range (len(selected)): + selectedFinal.append(selected[i] + ".scalePivot") + selectedFinal.append(selected[i] + ".rotatePivot") + else: + selectedFinal = selected; - cmds.move(direction[0], direction[1], direction[2], selected, worldSpace = isWorldSpace, objectSpace = isObjectSpace, localSpace = isLocalSpace, relative = relative, preserveChildPosition = preserveChildPosition) - - # TODO - # cmds.setAttr(item + "." + Enums.Attributes.rotatePivotX, channelBox = on) - # cmds.setAttr(item + "." + Enums.Attributes.rotatePivotY, channelBox = on) - # cmds.setAttr(item + "." + Enums.Attributes.rotatePivotZ, channelBox = on) - - # cmds.setAttr(item + "." + Enums.Attributes.scalePivotX, channelBox = on) - # cmds.setAttr(item + "." + Enums.Attributes.scalePivotX, channelBox = on) - # cmds.setAttr(item + "." + Enums.Attributes.scalePivotX, channelBox = on) + cmds.move(direction[0], direction[1], direction[2], selectedFinal, worldSpace = isWorldSpace, objectSpace = isObjectSpace, localSpace = isLocalSpace, relative = relative, preserveChildPosition = preserveChildPosition) From 5550bd271a5aa6318085cde8ba94caa3ce539d78 Mon Sep 17 00:00:00 2001 From: Eugene Date: Thu, 5 Dec 2024 22:24:10 -0800 Subject: [PATCH 5/8] add annotations --- GETOOLS_SOURCE/modules/Transformations.py | 60 ++++++++++++++--------- 1 file changed, 36 insertions(+), 24 deletions(-) diff --git a/GETOOLS_SOURCE/modules/Transformations.py b/GETOOLS_SOURCE/modules/Transformations.py index c5a8a0e..ac25d0d 100644 --- a/GETOOLS_SOURCE/modules/Transformations.py +++ b/GETOOLS_SOURCE/modules/Transformations.py @@ -31,13 +31,25 @@ class TransformationsAnnotations: - annotation = "xxxxxxxxxxxxxxxxxxx" + space = "WORLD SPACE uses global axes orientations.\nLOCAL SPACE uses parent space, useful when selected object is a child of other object.\nOBJECT SPACE uses selected objects' axes and move accordingly arrows." + relative = "Current position used as a start point resulting move addition each step.\nDeactivate to use absolute mode to set specific coordinates." + preserveChildPosition = "Child object will stay on the same position while selected object will be moved.\nVery useful when you need to tweak object's position in the middle of hierarchy." + pivot = "Move pivot of selected objects instead of moving objects transform nodes" + multiplier = "Extra multiplier for DIRECTION and DISTANCE values." -class TransformationsSettings: - value = 0 + editPivot = "Toggle pivot editing for selected objects.\nThe same action as 'D' hotkey on keyboard." + pivotOn = "Show pivot attributes in channel box" + pivotOff = "Hide pivot attributes in channel box" + + direction = "XYZ values for directional movement" + moveDirectionNegative = "Apply directional movement with reverse direction values" + moveDirectionPositive = "Apply directional movement with original direction values" + + distance = "Distance value for separate axes movement" + moveDistance = "Apply movement to current axis.\n-+ symbols mean negative and positive directinos." class Transformations: - _version = "v0.0" + _version = "v0.1" _name = "TRANSFORMATIONS" _title = _name + " " + _version @@ -64,17 +76,17 @@ def UILayoutLocators(self, layoutMain): cmds.frameLayout(parent = layoutMain, label = Settings.frames2Prefix + "MOVE", collapsable = True, backgroundColor = Settings.frames2Color, highlightColor = Colors.green100, marginWidth = 0, marginHeight = 0, borderVisible = True) layoutColumn = cmds.columnLayout(adjustableColumn = True) - self.radioButtonGrpSpace = cmds.radioButtonGrp(parent = layoutColumn, label = "Space: ", labelArray3 = ["World", "Local", "Object"], select = 1, numberOfRadioButtons = 3, columnWidth4 = (60, 50, 50, 50), columnAlign = [(1, "right"), (2, "center"), (3, "center"), (4, "center")], height = Settings.lineHeight) + self.radioButtonGrpSpace = cmds.radioButtonGrp(parent = layoutColumn, label = "Space: ", labelArray3 = ["World", "Local", "Object"], select = 1, numberOfRadioButtons = 3, columnWidth4 = (60, 50, 50, 50), columnAlign = [(1, "right"), (2, "center"), (3, "center"), (4, "center")], height = Settings.lineHeight, annotation = TransformationsAnnotations.space) self.radioButtonGrpSpace = self.radioButtonGrpSpace.replace(Settings.windowName + "|", "") # HACK fix for docked window only. Don't know how to avoid issue cmds.rowLayout(parent = layoutColumn, numberOfColumns = 3, columnWidth3 = (70, 150, 50), columnAlign = [(1, "center"), (2, "center"), (3, "center")], columnAttach = [(1, "both", 0), (2, "both", 0), (3, "both", 0)], height = Settings.lineHeight) - self.checkBoxRelative = cmds.checkBox(label = "Relative", value = True) - self.checkBoxPreserveChildPosition = cmds.checkBox(label = "Preserve Child Position", value = False) - self.checkBoxPivot = cmds.checkBox(label = "Pivot", value = False) + self.checkBoxRelative = cmds.checkBox(label = "Relative", value = True, annotation = TransformationsAnnotations.relative) + self.checkBoxPreserveChildPosition = cmds.checkBox(label = "Preserve Child Position", value = False, annotation = TransformationsAnnotations.preserveChildPosition) + self.checkBoxPivot = cmds.checkBox(label = "Pivot", value = False, annotation = TransformationsAnnotations.pivot) cmds.rowLayout(parent = layoutColumn, adjustableColumn = 2, numberOfColumns = 5, columnWidth5 = (60, 50, 60, 50, 50), columnAlign = [(1, "right"), (2, "center"), (3, "center"), (4, "center"), (5, "center")], columnAttach = [(1, "both", 0), (2, "both", 0), (3, "both", 0), (4, "both", 0), (5, "both", 0)], height = Settings.lineHeight) - cmds.text(label = "Multiplier: ") - self.floatFieldMultiplier = cmds.floatField(value = 1, precision = 3) + cmds.text(label = "Multiplier: ", annotation = TransformationsAnnotations.multiplier) + self.floatFieldMultiplier = cmds.floatField(value = 1, precision = 3, annotation = TransformationsAnnotations.multiplier) cmds.popupMenu() cmds.menuItem(label = "0.001", command = partial(self.SetMultiplier, 0.001)) cmds.menuItem(label = "0.01", command = partial(self.SetMultiplier, 0.01)) @@ -96,12 +108,12 @@ def UILayoutLocators(self, layoutMain): cmds.menuItem(label = "10", command = partial(self.SetMultiplier, 10)) cmds.menuItem(label = "100", command = partial(self.SetMultiplier, 100)) cmds.menuItem(label = "1000", command = partial(self.SetMultiplier, 1000)) - cmds.button(label = "Edit Pivot", command = cmds.EnterEditModePress, backgroundColor = Colors.yellow10) - cmds.button(label = "Pivot On", command = partial(self.SetPivotAttributes, True), backgroundColor = Colors.blackWhite80) - cmds.button(label = "Pivot Off", command = partial(self.SetPivotAttributes, False), backgroundColor = Colors.blackWhite80) + cmds.button(label = "Edit Pivot", command = cmds.EnterEditModePress, backgroundColor = Colors.yellow10, annotation = TransformationsAnnotations.editPivot) + cmds.button(label = "Pivot On", command = partial(self.SetPivotAttributes, True), backgroundColor = Colors.blackWhite80, annotation = TransformationsAnnotations.pivotOn) + cmds.button(label = "Pivot Off", command = partial(self.SetPivotAttributes, False), backgroundColor = Colors.blackWhite80, annotation = TransformationsAnnotations.pivotOff) rowLayoutDirection = cmds.rowLayout(parent = layoutColumn, adjustableColumn = 2, numberOfColumns = 2, columnWidth2 = (188, 60), columnAlign = [(1, "right"), (2, "center")], columnAttach = [(1, "both", 0), (2, "both", 0)], height = Settings.lineHeight) - self.floatFieldGrpDirection = cmds.floatFieldGrp(parent = rowLayoutDirection, label = "Direction: ", numberOfFields = 3, columnWidth4 = (60, 40, 40, 40), value = [0, 0, 0, 0], columnAlign = [(1, "right"), (2, "center"), (3, "center"), (4, "center")]) + self.floatFieldGrpDirection = cmds.floatFieldGrp(parent = rowLayoutDirection, label = "Direction: ", numberOfFields = 3, columnWidth4 = (60, 40, 40, 40), value = [0, 0, 0, 0], columnAlign = [(1, "right"), (2, "center"), (3, "center"), (4, "center")], annotation = TransformationsAnnotations.direction) self.floatFieldGrpDirection = self.floatFieldGrpDirection.replace(Settings.windowName + "|", "") # HACK fix for docked window only. Don't know how to avoid issue cmds.popupMenu() cmds.menuItem(label = "0, 0, 0", command = partial(self.SetDirection, [0, 0, 0])) @@ -110,12 +122,12 @@ def UILayoutLocators(self, layoutMain): cmds.menuItem(label = "0, 1, 0", command = partial(self.SetDirection, [0, 1, 0])) cmds.menuItem(label = "0, 0, 1", command = partial(self.SetDirection, [0, 0, 1])) cmds.gridLayout(parent = rowLayoutDirection, numberOfColumns = 2, cellWidth = 44, cellHeight = Settings.lineHeight) - cmds.button(label = "-XYZ", command = partial(self.MoveSelected, 0, True), backgroundColor = Colors.orange10) - cmds.button(label = "+XYZ", command = partial(self.MoveSelected, 0, False), backgroundColor = Colors.orange50) + cmds.button(label = "-XYZ", command = partial(self.MoveSelected, 0, True), backgroundColor = Colors.orange10, annotation = TransformationsAnnotations.moveDirectionNegative) + cmds.button(label = "+XYZ", command = partial(self.MoveSelected, 0, False), backgroundColor = Colors.orange50, annotation = TransformationsAnnotations.moveDirectionPositive) cmds.rowLayout(parent = layoutColumn, adjustableColumn = 2, numberOfColumns = 3, columnWidth3 = (60, 50, 156), columnAlign = [(1, "right"), (2, "center"), (3, "center")], columnAttach = [(1, "both", 0), (2, "both", 0), (3, "both", 0)], height = Settings.lineHeight) - cmds.text(label = "Distance: ") - self.floatFieldDistance = cmds.floatField(value = 1, precision = 3) + cmds.text(label = "Distance: ", annotation = TransformationsAnnotations.distance) + self.floatFieldDistance = cmds.floatField(value = 1, precision = 3, annotation = TransformationsAnnotations.distance) cmds.popupMenu() cmds.menuItem(label = "0", command = partial(self.SetDistance, 0)) cmds.menuItem(divider = True) @@ -132,12 +144,12 @@ def UILayoutLocators(self, layoutMain): cmds.menuItem(label = "100", command = partial(self.SetDistance, 100)) cmds.menuItem(label = "1000", command = partial(self.SetDistance, 1000)) cmds.gridLayout(numberOfColumns = 6, cellWidth = 26, cellHeight = Settings.lineHeight) - cmds.button(label = "-X", command = partial(self.MoveSelected, 1, True), backgroundColor = Colors.red10) - cmds.button(label = "+X", command = partial(self.MoveSelected, 1, False), backgroundColor = Colors.red50) - cmds.button(label = "-Y", command = partial(self.MoveSelected, 2, True), backgroundColor = Colors.green10) - cmds.button(label = "+Y", command = partial(self.MoveSelected, 2, False), backgroundColor = Colors.green50) - cmds.button(label = "-Z", command = partial(self.MoveSelected, 3, True), backgroundColor = Colors.blue10) - cmds.button(label = "+Z", command = partial(self.MoveSelected, 3, False), backgroundColor = Colors.blue50) + cmds.button(label = "-X", command = partial(self.MoveSelected, 1, True), backgroundColor = Colors.red10, annotation = TransformationsAnnotations.moveDistance) + cmds.button(label = "+X", command = partial(self.MoveSelected, 1, False), backgroundColor = Colors.red50, annotation = TransformationsAnnotations.moveDistance) + cmds.button(label = "-Y", command = partial(self.MoveSelected, 2, True), backgroundColor = Colors.green10, annotation = TransformationsAnnotations.moveDistance) + cmds.button(label = "+Y", command = partial(self.MoveSelected, 2, False), backgroundColor = Colors.green50, annotation = TransformationsAnnotations.moveDistance) + cmds.button(label = "-Z", command = partial(self.MoveSelected, 3, True), backgroundColor = Colors.blue10, annotation = TransformationsAnnotations.moveDistance) + cmds.button(label = "+Z", command = partial(self.MoveSelected, 3, False), backgroundColor = Colors.blue50, annotation = TransformationsAnnotations.moveDistance) def SetMultiplier(self, value, *args): cmds.floatField(self.floatFieldMultiplier, edit = True, value = value) From 532a4447c04240a8273efaede2de73f04d1029b0 Mon Sep 17 00:00:00 2001 From: Eugene Date: Fri, 6 Dec 2024 23:47:42 -0800 Subject: [PATCH 6/8] Update Transformations.py --- GETOOLS_SOURCE/modules/Transformations.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/GETOOLS_SOURCE/modules/Transformations.py b/GETOOLS_SOURCE/modules/Transformations.py index ac25d0d..3614eb6 100644 --- a/GETOOLS_SOURCE/modules/Transformations.py +++ b/GETOOLS_SOURCE/modules/Transformations.py @@ -41,12 +41,11 @@ class TransformationsAnnotations: pivotOn = "Show pivot attributes in channel box" pivotOff = "Hide pivot attributes in channel box" + _negativePositive = "-+ symbols mean negative and positive directions" direction = "XYZ values for directional movement" - moveDirectionNegative = "Apply directional movement with reverse direction values" - moveDirectionPositive = "Apply directional movement with original direction values" - + moveDirection = "Apply XYZ movement with direction values.\n{0}.".format(_negativePositive) distance = "Distance value for separate axes movement" - moveDistance = "Apply movement to current axis.\n-+ symbols mean negative and positive directinos." + moveDistance = "Apply axis movement using distance.\n{0}.".format(_negativePositive) class Transformations: _version = "v0.1" @@ -122,7 +121,7 @@ def UILayoutLocators(self, layoutMain): cmds.menuItem(label = "0, 1, 0", command = partial(self.SetDirection, [0, 1, 0])) cmds.menuItem(label = "0, 0, 1", command = partial(self.SetDirection, [0, 0, 1])) cmds.gridLayout(parent = rowLayoutDirection, numberOfColumns = 2, cellWidth = 44, cellHeight = Settings.lineHeight) - cmds.button(label = "-XYZ", command = partial(self.MoveSelected, 0, True), backgroundColor = Colors.orange10, annotation = TransformationsAnnotations.moveDirectionNegative) + cmds.button(label = "-XYZ", command = partial(self.MoveSelected, 0, True), backgroundColor = Colors.orange10, annotation = TransformationsAnnotations.moveDirection) cmds.button(label = "+XYZ", command = partial(self.MoveSelected, 0, False), backgroundColor = Colors.orange50, annotation = TransformationsAnnotations.moveDirectionPositive) cmds.rowLayout(parent = layoutColumn, adjustableColumn = 2, numberOfColumns = 3, columnWidth3 = (60, 50, 156), columnAlign = [(1, "right"), (2, "center"), (3, "center")], columnAttach = [(1, "both", 0), (2, "both", 0), (3, "both", 0)], height = Settings.lineHeight) From aea22f38e78de90372919ca1a9dc84999fb3e42a Mon Sep 17 00:00:00 2001 From: Eugene Date: Fri, 6 Dec 2024 23:48:21 -0800 Subject: [PATCH 7/8] Update Transformations.py --- GETOOLS_SOURCE/modules/Transformations.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GETOOLS_SOURCE/modules/Transformations.py b/GETOOLS_SOURCE/modules/Transformations.py index 3614eb6..afafd84 100644 --- a/GETOOLS_SOURCE/modules/Transformations.py +++ b/GETOOLS_SOURCE/modules/Transformations.py @@ -122,7 +122,7 @@ def UILayoutLocators(self, layoutMain): cmds.menuItem(label = "0, 0, 1", command = partial(self.SetDirection, [0, 0, 1])) cmds.gridLayout(parent = rowLayoutDirection, numberOfColumns = 2, cellWidth = 44, cellHeight = Settings.lineHeight) cmds.button(label = "-XYZ", command = partial(self.MoveSelected, 0, True), backgroundColor = Colors.orange10, annotation = TransformationsAnnotations.moveDirection) - cmds.button(label = "+XYZ", command = partial(self.MoveSelected, 0, False), backgroundColor = Colors.orange50, annotation = TransformationsAnnotations.moveDirectionPositive) + cmds.button(label = "+XYZ", command = partial(self.MoveSelected, 0, False), backgroundColor = Colors.orange50, annotation = TransformationsAnnotations.moveDirection) cmds.rowLayout(parent = layoutColumn, adjustableColumn = 2, numberOfColumns = 3, columnWidth3 = (60, 50, 156), columnAlign = [(1, "right"), (2, "center"), (3, "center")], columnAttach = [(1, "both", 0), (2, "both", 0), (3, "both", 0)], height = Settings.lineHeight) cmds.text(label = "Distance: ", annotation = TransformationsAnnotations.distance) From b328a2970b3756e72075424a309438b46be5f97c Mon Sep 17 00:00:00 2001 From: Eugene Date: Sun, 8 Dec 2024 20:25:05 -0800 Subject: [PATCH 8/8] prepare for release --- GETOOLS_SOURCE/modules/GeneralWindow.py | 2 +- GETOOLS_SOURCE/modules/Transformations.py | 2 +- changelog.txt | 8 ++++++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/GETOOLS_SOURCE/modules/GeneralWindow.py b/GETOOLS_SOURCE/modules/GeneralWindow.py index 5d27be3..3b21832 100644 --- a/GETOOLS_SOURCE/modules/GeneralWindow.py +++ b/GETOOLS_SOURCE/modules/GeneralWindow.py @@ -50,7 +50,7 @@ class GeneralWindow: - _version = "v1.5.2" + _version = "v1.6.0" _name = "GETools" _title = _name + " " + _version diff --git a/GETOOLS_SOURCE/modules/Transformations.py b/GETOOLS_SOURCE/modules/Transformations.py index afafd84..efc54ea 100644 --- a/GETOOLS_SOURCE/modules/Transformations.py +++ b/GETOOLS_SOURCE/modules/Transformations.py @@ -48,7 +48,7 @@ class TransformationsAnnotations: moveDistance = "Apply axis movement using distance.\n{0}.".format(_negativePositive) class Transformations: - _version = "v0.1" + _version = "v1.0" _name = "TRANSFORMATIONS" _title = _name + " " + _version diff --git a/changelog.txt b/changelog.txt index bf2a3f8..a812c82 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,8 +1,12 @@ GETools changelog +v1.6.0 | 09.12.2024 +- [TRANSFORMATIONS] added new tool to move objects. +- [UI] changed list order numbers for main panels. TRANSFORMATION tools now stays in 1 position. + v1.5.2 | 05.12.2024 -- added dates to changelog and bring changelog from legacy Overlappy repository -- added fresh PNG demo collage with all GETools panels +- added dates to changelog and bring changelog from legacy Overlappy repository. +- added fresh PNG demo collage with all GETools panels. v1.5.1 | 03.12.2024 - [UI] added visual separation with borders to panels.