Skip to content

Commit

Permalink
save:
Browse files Browse the repository at this point in the history
- add chain distribution button install
- added full parameters names to installed buttons
  • Loading branch information
GenEugene committed Nov 20, 2024
1 parent b9e2f37 commit fe37176
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 27 deletions.
5 changes: 5 additions & 0 deletions GETOOLS_SOURCE/modules/GeneralWindow.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,11 @@ def LayoutMenuOptions(self):
cmds.menuItem(label = "Without Reverse Constraint", command = partial(Install.ToShelf_LocatorsRelativeWithoutReverse, self.optionsPlugin.directory))
cmds.setParent('..', menu = True)
#
cmds.menuItem(subMenu = True, label = "Chain Distribution", tearOff = True, image = Icons.pinInvert)
cmds.menuItem(label = "Default Mode", command = partial(Install.ToShelf_LocatorsChainDistribution1, self.optionsPlugin.directory))
cmds.menuItem(label = "Alternative Mode", command = partial(Install.ToShelf_LocatorsChainDistribution2, self.optionsPlugin.directory))
cmds.setParent('..', menu = True)
#
cmds.menuItem(subMenu = True, label = "Aim", tearOff = True, image = Icons.pin)
minus = "-"
plus = "+"
Expand Down
4 changes: 2 additions & 2 deletions GETOOLS_SOURCE/modules/Tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -405,9 +405,9 @@ def LocatorsBakeAim(self, rotateOnly=False, *args):
### CHAIN DISTRIBUTION RIG
def CreateChainDistributionRig(self, mode=1, *args):
if mode is 1:
ChainDistributionRig.CreateRigVariant1(controlSize = self.GetFloatLocatorSize())
ChainDistributionRig.CreateRigVariant1(locatorSize = self.GetFloatLocatorSize())
if mode is 2:
ChainDistributionRig.CreateRigVariant2(controlSize = self.GetFloatLocatorSize())
ChainDistributionRig.CreateRigVariant2(locatorSize = self.GetFloatLocatorSize())


### BAKING
Expand Down
18 changes: 9 additions & 9 deletions GETOOLS_SOURCE/utils/ChainDistributionRig.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@
from ..utils import Text


_controlSize = 100
_locatorSize = 100
_nameGroupMain = "grpChain_"
_nameLocatorPrefix = "loc_"


def CreateRigVariant1(controlSize=_controlSize, *args):
def CreateRigVariant1(locatorSize=_locatorSize, *args):
# Check selected objects
selectedList = Selector.MultipleObjects(minimalCount = 1)
if (selectedList == None):
Expand Down Expand Up @@ -61,9 +61,9 @@ def CreateRigVariant1(controlSize=_controlSize, *args):
### Create locator # TODO nurbs circle as control instead of locator (optional)
locator = cmds.spaceLocator(name = Text.SetUniqueFromText(_nameLocatorPrefix + selected[i]))[0]
locators.append(locator)
cmds.setAttr(locator + "Shape.localScaleX", controlSize)
cmds.setAttr(locator + "Shape.localScaleY", controlSize)
cmds.setAttr(locator + "Shape.localScaleZ", controlSize)
cmds.setAttr(locator + "Shape.localScaleX", locatorSize)
cmds.setAttr(locator + "Shape.localScaleY", locatorSize)
cmds.setAttr(locator + "Shape.localScaleZ", locatorSize)

### Parent locator to group
cmds.parent(locator, mainGroup)
Expand Down Expand Up @@ -92,7 +92,7 @@ def CreateRigVariant1(controlSize=_controlSize, *args):
cmds.select(locators[-1], replace = True)
cmds.currentTime(timeCurrent, edit = True, update = True)

def CreateRigVariant2(controlSize=_controlSize, *args):
def CreateRigVariant2(locatorSize=_locatorSize, *args):
# Check selected objects
selectedList = Selector.MultipleObjects(minimalCount = 1)
if (selectedList == None):
Expand Down Expand Up @@ -135,9 +135,9 @@ def CreateRigVariant2(controlSize=_controlSize, *args):
### Create locator # TODO use nurbs circle [circle -c 0 0 0 -nr 0 1 0 -sw 360 -r 1 -d 3 -ut 0 -tol 1e-05 -s 8 -ch 1; objectMoveCommand;]
locator = cmds.spaceLocator(name = Text.SetUniqueFromText(_nameLocatorPrefix + selected[i]))[0]
locators.append(locator)
cmds.setAttr(locator + "Shape.localScaleX", controlSize)
cmds.setAttr(locator + "Shape.localScaleY", controlSize)
cmds.setAttr(locator + "Shape.localScaleZ", controlSize)
cmds.setAttr(locator + "Shape.localScaleX", locatorSize)
cmds.setAttr(locator + "Shape.localScaleY", locatorSize)
cmds.setAttr(locator + "Shape.localScaleZ", locatorSize)

### Parent locator to group
cmds.parent(locator, groupDistributed)
Expand Down
37 changes: 21 additions & 16 deletions GETOOLS_SOURCE/utils/Install.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,13 +129,13 @@ def ToShelf_ToggleTextures(path, *args): MoveToShelf(path, ReadFunctionAsString(

# LOCATORS
def ToShelf_LocatorsSizeScale50(path, *args):
MoveToShelf(path, ReadFunctionAsString(CodeSamples.LocatorsSizeScale) + "(0.5)", "LocatorsSizeScale50", "L50%")
MoveToShelf(path, ReadFunctionAsString(CodeSamples.LocatorsSizeScale) + "(value = 0.5)", "LocatorsSizeScale50", "L50%")
def ToShelf_LocatorsSizeScale90(path, *args):
MoveToShelf(path, ReadFunctionAsString(CodeSamples.LocatorsSizeScale) + "(0.9)", "LocatorsSizeScale90", "L90%")
MoveToShelf(path, ReadFunctionAsString(CodeSamples.LocatorsSizeScale) + "(value = 0.9)", "LocatorsSizeScale90", "L90%")
def ToShelf_LocatorsSizeScale110(path, *args):
MoveToShelf(path, ReadFunctionAsString(CodeSamples.LocatorsSizeScale) + "(1.1)", "LocatorsSizeScale110", "L110%")
MoveToShelf(path, ReadFunctionAsString(CodeSamples.LocatorsSizeScale) + "(value = 1.1)", "LocatorsSizeScale110", "L110%")
def ToShelf_LocatorsSizeScale200(path, *args):
MoveToShelf(path, ReadFunctionAsString(CodeSamples.LocatorsSizeScale) + "(2.0)", "LocatorsSizeScale200", "L200%")
MoveToShelf(path, ReadFunctionAsString(CodeSamples.LocatorsSizeScale) + "(value = 2.0)", "LocatorsSizeScale200", "L200%")

def ToShelf_LocatorCreate(path, *args):
MoveToShelf(path, ReadFunctionAsString(CodeSamples.LocatorCreate), "LocatorCreate", "Loc")
Expand All @@ -160,6 +160,11 @@ def ToShelf_LocatorsRelativeSkipLast(path, *args):
def ToShelf_LocatorsRelativeWithoutReverse(path, *args):
MoveToShelf(path, ReadFunctionAsString(CodeSamples.LocatorsRelativeWithoutReverse), "RelativeWithoutReverse", "Rel-")

def ToShelf_LocatorsChainDistribution1(path, *args):
MoveToShelf(path, ReadFunctionAsString(CodeSamples.LocatorsChainDistribution1), "LocatorsChainDistribution1", "CDistr1")
def ToShelf_LocatorsChainDistribution2(path, *args):
MoveToShelf(path, ReadFunctionAsString(CodeSamples.LocatorsChainDistribution2), "LocatorsChainDistribution2", "CDistr2")

def ToShelf_LocatorsAim(path, name, rotateOnly, aimVector, *args):
parameters = "(rotateOnly = {0}, vectorAim = {1}, reverse = True)".format(rotateOnly, aimVector)
MoveToShelf(path, ReadFunctionAsString(CodeSamples.LocatorsAim) + parameters, "LocatorsAim{0}".format(name), "Aim {0}".format(name))
Expand Down Expand Up @@ -203,7 +208,7 @@ def ToShelf_BakeByWorld(path, translate, rotate, *args):

# ANIMATION
def ToShelf_AnimOffsetSelected(path, direction, time, *args):
MoveToShelf(path, ReadFunctionAsString(CodeSamples.AnimOffsetSelected) + "({0}, {1})".format(direction, time), "AnimOffset_{0}_{1}".format(direction, time), "AO{0}_{1}".format(direction, time))
MoveToShelf(path, ReadFunctionAsString(CodeSamples.AnimOffsetSelected) + "(direction = {0}, step = {1})".format(direction, time), "AnimOffset_{0}_{1}".format(direction, time), "AO{0}_{1}".format(direction, time))

def ToShelf_DeleteKeys(path, *args):
MoveToShelf(path, ReadFunctionAsString(CodeSamples.DeleteKeys), "DeleteKeys", "DKeys")
Expand All @@ -215,23 +220,23 @@ def ToShelf_DeleteStatic(path, *args):
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))
MoveToShelf(path, ReadFunctionAsString(CodeSamples.SetInfinity) + "(mode = {0})".format(mode), "SetInfinity{0}".format(mode), "Inf{0}".format(mode))

# TIMELINE
def ToShelf_SetTimelineMinOut(path, *args):
MoveToShelf(path, ReadFunctionAsString(CodeSamples.SetTimeline) + "(3)", "SetTimelineMinOut", "<<")
MoveToShelf(path, ReadFunctionAsString(CodeSamples.SetTimeline) + "(mode = 3)", "SetTimelineMinOut", "<<")
def ToShelf_SetTimelineMinIn(path, *args):
MoveToShelf(path, ReadFunctionAsString(CodeSamples.SetTimeline) + "(1)", "SetTimelineMinIn", "<-")
MoveToShelf(path, ReadFunctionAsString(CodeSamples.SetTimeline) + "(mode = 1)", "SetTimelineMinIn", "<-")
def ToShelf_SetTimelineMaxIn(path, *args):
MoveToShelf(path, ReadFunctionAsString(CodeSamples.SetTimeline) + "(2)", "SetTimelineMaxIn", "->")
MoveToShelf(path, ReadFunctionAsString(CodeSamples.SetTimeline) + "(mode = 2)", "SetTimelineMaxIn", "->")
def ToShelf_SetTimelineMaxOut(path, *args):
MoveToShelf(path, ReadFunctionAsString(CodeSamples.SetTimeline) + "(4)", "SetTimelineMaxOut", ">>")
MoveToShelf(path, ReadFunctionAsString(CodeSamples.SetTimeline) + "(mode = 4)", "SetTimelineMaxOut", ">>")
def ToShelf_SetTimelineFocusOut(path, *args):
MoveToShelf(path, ReadFunctionAsString(CodeSamples.SetTimeline) + "(5)", "SetTimelineFocusOut", "<->")
MoveToShelf(path, ReadFunctionAsString(CodeSamples.SetTimeline) + "(mode = 5)", "SetTimelineFocusOut", "<->")
def ToShelf_SetTimelineFocusIn(path, *args):
MoveToShelf(path, ReadFunctionAsString(CodeSamples.SetTimeline) + "(6)", "SetTimelineFocusIn", ">-<")
MoveToShelf(path, ReadFunctionAsString(CodeSamples.SetTimeline) + "(mode = 6)", "SetTimelineFocusIn", ">-<")
def ToShelf_SetTimelineSet(path, *args):
MoveToShelf(path, ReadFunctionAsString(CodeSamples.SetTimeline) + "(7)", "SetTimelineSet", "|<->|")
MoveToShelf(path, ReadFunctionAsString(CodeSamples.SetTimeline) + "(mode = 7)", "SetTimelineSet", "|<->|")

# RIGGING
def ToShelf_Constraint(path, maintainOffset, parent, point, orient, scale, *args):
Expand All @@ -258,11 +263,11 @@ def ToShelf_DisconnectTargets(path, *args):
MoveToShelf(path, ReadFunctionAsString(CodeSamples.DisconnectTargets), "DisconnectTargets", "Disconnect")

def ToShelf_RotateOrder(path, mode, *args):
MoveToShelf(path, ReadFunctionAsString(CodeSamples.RotateOrder) + "({0})".format(mode), "RotateOrder{0}".format(mode), "RO{0}".format(mode))
MoveToShelf(path, ReadFunctionAsString(CodeSamples.RotateOrder) + "(on = {0})".format(mode), "RotateOrder{0}".format(mode), "RO{0}".format(mode))
def ToShelf_SegmentScaleCompensate(path, mode, *args):
MoveToShelf(path, ReadFunctionAsString(CodeSamples.SegmentScaleCompensate) + "({0})".format(mode), "SegmentScaleCompensate{0}".format(mode), "SSC{0}".format(mode))
MoveToShelf(path, ReadFunctionAsString(CodeSamples.SegmentScaleCompensate) + "(value = {0})".format(mode), "SegmentScaleCompensate{0}".format(mode), "SSC{0}".format(mode))
def ToShelf_JointDrawStyle(path, mode, *args):
MoveToShelf(path, ReadFunctionAsString(CodeSamples.JointDrawStyle) + "({0})".format(mode), "JointDrawStyle{0}".format(mode), "J{0}".format(mode))
MoveToShelf(path, ReadFunctionAsString(CodeSamples.JointDrawStyle) + "(mode = {0})".format(mode), "JointDrawStyle{0}".format(mode), "J{0}".format(mode))

def ToShelf_CopySkin(path, *args):
MoveToShelf(path, ReadFunctionAsString(CodeSamples.CopySkin), "CopySkin", "CopySkin")
Expand Down
8 changes: 8 additions & 0 deletions GETOOLS_SOURCE/values/CodeSamples.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,14 @@ def LocatorsRelativeWithoutReverse():
import GETOOLS_SOURCE.utils.Locators as Locators
Locators.CreateAndBakeAsChildrenFromLastSelected()

def LocatorsChainDistribution1():
import GETOOLS_SOURCE.utils.ChainDistributionRig as ChainDistributionRig
ChainDistributionRig.CreateRigVariant1(locatorSize = 10)

def LocatorsChainDistribution2():
import GETOOLS_SOURCE.utils.ChainDistributionRig as ChainDistributionRig
ChainDistributionRig.CreateRigVariant2(locatorSize = 10)

def LocatorsAim(): # brackets added when method used
import GETOOLS_SOURCE.utils.Locators as Locators
Locators.CreateOnSelectedAim
Expand Down
1 change: 1 addition & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ GETools changelog
v1.5.0
- [TOOLS] added "Chain Distribution" button to create distributed rotatio rig over selected objects. Use last locator to control animation.
- [OVERLAPPY] removed set timeline to minimum frame on plugin start.
- added full parameters names to installed buttons

v1.4.4
- added Maya version check to avoid compatibility issues with Maya 2020 and older.
Expand Down

0 comments on commit fe37176

Please sign in to comment.