Skip to content

Commit

Permalink
Merge pull request #46 from GenEugene/develop
Browse files Browse the repository at this point in the history
Complete version 0.0.11
  • Loading branch information
GenEugene authored Dec 9, 2023
2 parents 20fa781 + 3d7d356 commit 7498bcf
Show file tree
Hide file tree
Showing 17 changed files with 445 additions and 1,282 deletions.
2 changes: 1 addition & 1 deletion DRAG_AND_DROP_INSTALL.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

from GETOOLS_SOURCE.values import Icons

from GETOOLS_SOURCE.utils import Shelf
from GETOOLS_SOURCE.utils import Install
from GETOOLS_SOURCE.utils import Shelf


# Get script directory path
Expand Down
1,094 changes: 0 additions & 1,094 deletions GETOOLS_SOURCE/_deprecated/OVERLAPPY.py

This file was deleted.

14 changes: 6 additions & 8 deletions GETOOLS_SOURCE/modules/CenterOfMass.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,33 +73,32 @@ def __init__(self):
self.layoutSetup = None
self.layoutWeights = None
self.layoutBaking = None

def UICreate(self, layoutMain):
windowWidthMargin = Settings.windowWidthMargin
lineHeight = Settings.lineHeight

self.UILayoutSetup(layoutMain, windowWidthMargin, lineHeight)
self.UILayoutWeights(layoutMain, windowWidthMargin, lineHeight)
self.UILayoutBaking(layoutMain, windowWidthMargin, lineHeight)

def UILayoutSetup(self, layoutMain, windowWidthMargin, lineHeight):
self.layoutSetup = cmds.frameLayout(parent = layoutMain, label = "SETUP", collapsable = True) # , backgroundColor = Colors.blackWhite10
layoutColumn = cmds.columnLayout(parent = self.layoutSetup, adjustableColumn = True)
#
COMButtons1 = 4
cmds.gridLayout(parent = self.layoutSetup, numberOfColumns = COMButtons1, cellWidth = windowWidthMargin / COMButtons1, cellHeight = lineHeight)
cmds.gridLayout(parent = layoutColumn, numberOfColumns = COMButtons1, cellWidth = windowWidthMargin / COMButtons1, cellHeight = lineHeight)
cmds.button(label = "CREATE", command = self.COMCreate, backgroundColor = Colors.green50, annotation = CenterOfMassAnnotations.create)
cmds.button(label = "ACTIVATE", command = self.COMActivate, backgroundColor = Colors.yellow50, annotation = CenterOfMassAnnotations.activate)
cmds.button(label = "SELECT", command = self.COMSelect, backgroundColor = Colors.lightBlue50, annotation = CenterOfMassAnnotations.select)
cmds.button(label = "CLEAN", command = self.COMClean, backgroundColor = Colors.red50, annotation = CenterOfMassAnnotations.clean)
#
COMButtons2 = 3
cmds.gridLayout(parent = self.layoutSetup, numberOfColumns = COMButtons2, cellWidth = windowWidthMargin / COMButtons2, cellHeight = lineHeight)
cmds.gridLayout(parent = layoutColumn, numberOfColumns = COMButtons2, cellWidth = windowWidthMargin / COMButtons2, cellHeight = lineHeight)
cmds.button(label = "PROJECTOR YZ", command = partial(self.COMFloorProjection, "x"), backgroundColor = Colors.red10, annotation = CenterOfMassAnnotations.projectorYZ)
cmds.button(label = "PROJECTOR XZ", command = partial(self.COMFloorProjection, "y"), backgroundColor = Colors.green10, annotation = CenterOfMassAnnotations.projectorXZ)
cmds.button(label = "PROJECTOR XY", command = partial(self.COMFloorProjection, "z"), backgroundColor = Colors.blue10, annotation = CenterOfMassAnnotations.projectorXY)

def UILayoutWeights(self, layoutMain, windowWidthMargin, lineHeight):
self.layoutWeights = cmds.frameLayout(parent = layoutMain, label = "WEIGHTS", collapsable = True)
layoutColumn = cmds.columnLayout(parent = self.layoutWeights, adjustableColumn = True)

def PartButton(partInfo = ("", 0), minMaxValue = CenterOfMassSettings.weightMinMax, onlyValue = False, annotation = ""):
value = partInfo[1]
Expand All @@ -110,7 +109,7 @@ def PartButton(partInfo = ("", 0), minMaxValue = CenterOfMassSettings.weightMinM

# WEIGHTS PALETTE
count = 14
cmds.gridLayout(parent = self.layoutWeights, numberOfColumns = count, cellWidth = windowWidthMargin / count, cellHeight = lineHeight)
cmds.gridLayout(parent = layoutColumn, numberOfColumns = count, cellWidth = windowWidthMargin / count, cellHeight = lineHeight)

def CustomButton(value): PartButton(("", value), onlyValue = True, annotation = CenterOfMassAnnotations.weightsCustom)
CustomButton(0)
Expand All @@ -130,7 +129,7 @@ def CustomButton(value): PartButton(("", value), onlyValue = True, annotation =

# BODYPARTS
count = 3
layoutBodyGrid = cmds.gridLayout(parent = self.layoutWeights, numberOfColumns = count, cellWidth = windowWidthMargin / count, cellHeight = 70) # 23.5 per 1 button
layoutBodyGrid = cmds.gridLayout(parent = layoutColumn, numberOfColumns = count, cellWidth = windowWidthMargin / count, cellHeight = 70) # 23.5 per 1 button

cmds.columnLayout(parent = layoutBodyGrid, adjustableColumn = True)
PartButton(CenterOfMassSettings.partHead, minMaxValue = (CenterOfMassSettings.partHand[1], CenterOfMassSettings.partChest[1]), annotation = CenterOfMassAnnotations.weightHead)
Expand All @@ -146,7 +145,6 @@ def CustomButton(value): PartButton(("", value), onlyValue = True, annotation =
PartButton(CenterOfMassSettings.partThigh, minMaxValue = (CenterOfMassSettings.partHand[1], CenterOfMassSettings.partChest[1]), annotation = CenterOfMassAnnotations.weightThigh)
PartButton(CenterOfMassSettings.partKnee, minMaxValue = (CenterOfMassSettings.partHand[1], CenterOfMassSettings.partChest[1]), annotation = CenterOfMassAnnotations.weightKnee)
PartButton(CenterOfMassSettings.partFoot, minMaxValue = (CenterOfMassSettings.partHand[1], CenterOfMassSettings.partChest[1]), annotation = CenterOfMassAnnotations.weightFoot)

def UILayoutBaking(self, layoutMain, windowWidthMargin, lineHeight):
self.layoutBaking = cmds.frameLayout(parent = layoutMain, label = "BAKING", collapsable = True)

Expand Down
29 changes: 20 additions & 9 deletions GETOOLS_SOURCE/modules/GeneralWindow.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
from GETOOLS_SOURCE.utils import Colors
from GETOOLS_SOURCE.utils import Install
from GETOOLS_SOURCE.utils import Layers
from GETOOLS_SOURCE.utils import MotionTrail
from GETOOLS_SOURCE.utils import MayaSettings
from GETOOLS_SOURCE.utils import MotionTrail
from GETOOLS_SOURCE.utils import Scene
from GETOOLS_SOURCE.utils import Selector

Expand All @@ -18,7 +18,7 @@
from GETOOLS_SOURCE.modules import Tools as tls

class GeneralWindow:
version = "v0.0.10"
version = "v0.0.11"
name = "GETools"
title = name + " " + version

Expand Down Expand Up @@ -54,7 +54,7 @@ def LayoutMenuBar(self, parentLayout):
cmds.menuItem(label = "Reload Scene (force)", command = Scene.Reload)
cmds.menuItem(label = "Exit Maya (force)", command = Scene.ExitMaya)
cmds.menuItem(divider = True)
cmds.menuItem(label = "Restart GETools", command = self.RUN_DOCKED)
cmds.menuItem(label = "Restart GETools", command = partial(self.RUN_DOCKED, "", True))
cmds.menuItem(label = "Close GETools", command = self.DockDelete)

# cmds.menu(label = "Edit", tearOff = True)
Expand All @@ -70,8 +70,14 @@ def LayoutMenuBar(self, parentLayout):
cmds.menuItem(label = "Dock Right", command = partial(self.DockToSide, Settings.dockAllowedAreas[1]))
cmds.menuItem(label = "Undock", command = self.DockOff)

def ColorsPalette(*args):
colorCalibration = Colors.ColorsPalette()
colorCalibration.CreateUI()
cmds.menu(label = "Utils", tearOff = True)
cmds.menuItem(label = "Select Transform Hiererchy", command = Selector.SelectTransformHierarchy)
cmds.menuItem(label = "Print selected objects to console", command = Selector.PrintSelected)
cmds.menuItem(divider = True)
cmds.menuItem(label = "Open Colors Palette", command = ColorsPalette)

cmds.menu(label = "Help", tearOff = True) # , helpMenu = True
def LinkVersionHistory(self): cmds.showHelp("https://github.com/GenEugene/GETools/blob/master/changelog.txt", absolute = True)
Expand Down Expand Up @@ -127,7 +133,6 @@ def LayerMove(*args):
cmds.menuItem(label = "Layer Move", command = LayerMove)
cmds.menuItem(dividerLabel = "Install to shelf", divider = True)
cmds.menuItem(label = "Install Select Hierarchy", command = partial(Install.ToShelf_SelectHierarchy, self.directory))

def LayoutTools(self, parentLayout):
self.frameTools = cmds.frameLayout("layoutTools", parent = parentLayout, label = tls.Tools.title, collapsable = True, backgroundColor = Colors.blackWhite10, marginWidth = Settings.margin, marginHeight = Settings.margin)
tls.Tools().UICreate(self.frameTools)
Expand Down Expand Up @@ -195,9 +200,10 @@ def DockCheck(self, *args):
def DockDelete(self, *args):
if self.DockCheck():
cmds.deleteUI(Settings.dockName, control = True)
print("Dock Control deleted")
else:
print("No Dock")
# print("Dock Control deleted")
# else:
# print("No Dock")
pass
def DockOff(self, *args):
if self.DockCheck():
cmds.dockControl(Settings.dockName, edit = True, floating = True, height = Settings.windowHeight)
Expand All @@ -209,15 +215,20 @@ def DockToSide(self, areaSide, *args):
cmds.dockControl(Settings.dockName, edit = True, floating = False, area = areaSide)
else:
cmds.dockControl(Settings.dockName, label = GeneralWindow.title, content = Settings.windowName, area = areaSide, allowedArea = Settings.dockAllowedAreas) # , backgroundColor = Colors.lightBlue10
print("{0} docked {1}".format(GeneralWindow.title, areaSide))
print("{0} docked to {1}".format(GeneralWindow.title, areaSide))

# EXECUTION
def WindowCreate(self, *args):
self.CreateUI()
self.FramesCollapse(True)
def RUN_DOCKED(self, path = "", *args):
def RUN_DOCKED(self, path = "", forced = False, *args):
self.directory = path

if (forced == False and self.DockCheck()): # for script toggling. Comment these 3 lines if you need to deactivate toggling
self.DockDelete()
print("{0} closed".format(GeneralWindow.title))
return

self.DockDelete()
self.WindowCreate()
self.DockToSide(Settings.dockStartArea)
Expand Down
36 changes: 20 additions & 16 deletions GETOOLS_SOURCE/modules/Overlappy.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
from math import pow, sqrt
from functools import partial

from GETOOLS_SOURCE.utils import Animation
from GETOOLS_SOURCE.utils import Baker
from GETOOLS_SOURCE.utils import Colors
from GETOOLS_SOURCE.utils import Layers
from GETOOLS_SOURCE.utils import MayaSettings
from GETOOLS_SOURCE.utils import Other
from GETOOLS_SOURCE.utils import Selector
from GETOOLS_SOURCE.utils import Text
from GETOOLS_SOURCE.utils import Timeline
Expand Down Expand Up @@ -179,17 +179,18 @@ def UILayoutMenuBar(self, layoutMain, windowWidthMargin):
def UILayoutButtons(self, layoutMain, windowWidthMargin, lineHeight):
# SETUP
self.layoutButtons = cmds.frameLayout("layoutButtons", label = "BUTTONS", parent = layoutMain, collapsable = True)
layoutColumn = cmds.columnLayout(parent = self.layoutButtons, adjustableColumn = True)

count = 2
cmds.gridLayout(parent = self.layoutButtons, numberOfColumns = count, cellWidth = windowWidthMargin / count, cellHeight = lineHeight)
cmds.gridLayout(parent = layoutColumn, numberOfColumns = count, cellWidth = windowWidthMargin / count, cellHeight = lineHeight)
#
cmds.button(label = "SETUP", command = self._SetupInit, backgroundColor = Colors.green10, annotation = OverlappyAnnotations.setup)
# cmds.button(label = "Scan setup into scene", command = self._SetupScan, backgroundColor = Colors.green10)
cmds.button(label = "DELETE", command = self._SetupDelete, backgroundColor = Colors.green10, annotation = OverlappyAnnotations.setupDelete)

# BAKING
count = 3
cmds.gridLayout(parent = self.layoutButtons, numberOfColumns = count, cellWidth = windowWidthMargin / count, cellHeight = lineHeight)
cmds.gridLayout(parent = layoutColumn, numberOfColumns = count, cellWidth = windowWidthMargin / count, cellHeight = lineHeight)
#
cmds.button(label = "TRANSLATION", command = partial(self._BakeVariants, 1), backgroundColor = Colors.orange10, annotation = OverlappyAnnotations.translation)
cmds.popupMenu()
Expand All @@ -205,13 +206,14 @@ def UILayoutButtons(self, layoutMain, windowWidthMargin, lineHeight):
pass
def UILayoutLayers(self, layoutMain, windowWidthMargin, lineHeight):
self.layoutLayers = cmds.frameLayout("layoutLayers", label = "LAYERS", parent = layoutMain, collapsable = True)
layoutColumn = cmds.columnLayout(parent = self.layoutLayers, adjustableColumn = True)

count = 1
cmds.gridLayout(parent = self.layoutLayers, numberOfColumns = count, cellWidth = windowWidthMargin / count, cellHeight = lineHeight)
cmds.gridLayout(parent = layoutColumn, numberOfColumns = count, cellWidth = windowWidthMargin / count, cellHeight = lineHeight)
cmds.button(label = "Delete BaseAnimation layer", command = partial(Layers.Delete, "BaseAnimation"), backgroundColor = Colors.red50, annotation = OverlappyAnnotations.layerDeleteBase)

count = 2
cmds.gridLayout(parent = self.layoutLayers, numberOfColumns = count, cellWidth = windowWidthMargin / count, cellHeight = lineHeight)
cmds.gridLayout(parent = layoutColumn, numberOfColumns = count, cellWidth = windowWidthMargin / count, cellHeight = lineHeight)
cmds.button(label = "Delete Temp layer", command = partial(Layers.Delete, OverlappySettings.nameLayers[0]), backgroundColor = Colors.red10, annotation = OverlappyAnnotations.layerDeleteTemp)
cmds.button(label = "Move to Safe layer", command = partial(self._LayerMoveToSafeOrTemp, True), backgroundColor = Colors.blue10, annotation = OverlappyAnnotations.layerMoveTemp)

Expand All @@ -225,18 +227,19 @@ def UILayoutOptions(self, layoutMain, windowWidthMargin, lineHeight):

# _optionsResetAll = self._ResetOptions # , commandResetAll = _optionsResetAll

self.checkboxHierarchy = UI.Checkbox(label = "Hierarchy", value = OverlappySettings.checkboxesOptions[0], menuReset = True, annotation = OverlappyAnnotations.checkboxHierarchy)
self.checkboxLayer = UI.Checkbox(label = "Layer", value = OverlappySettings.checkboxesOptions[1], menuReset = True, annotation = OverlappyAnnotations.checkboxLayer)
self.checkboxLoop = UI.Checkbox(label = "Loop", value = OverlappySettings.checkboxesOptions[2], menuReset = True, annotation = OverlappyAnnotations.checkboxLoop) # FIXME make cycle infinity before bake
self.checkboxClean = UI.Checkbox(label = "Clean", value = OverlappySettings.checkboxesOptions[3], menuReset = True, annotation = OverlappyAnnotations.checkboxClean)
self.checkboxHierarchy = UI.Checkbox(label = "Hierarchy", value = OverlappySettings.checkboxesOptions[0], annotation = OverlappyAnnotations.checkboxHierarchy)
self.checkboxLayer = UI.Checkbox(label = "Layer", value = OverlappySettings.checkboxesOptions[1], annotation = OverlappyAnnotations.checkboxLayer)
self.checkboxLoop = UI.Checkbox(label = "Loop", value = OverlappySettings.checkboxesOptions[2], annotation = OverlappyAnnotations.checkboxLoop) # FIXME make cycle infinity before bake
self.checkboxClean = UI.Checkbox(label = "Clean", value = OverlappySettings.checkboxesOptions[3], annotation = OverlappyAnnotations.checkboxClean)
def UILayoutParticleAttributes(self, layoutMain, windowWidthMargin, lineHeight, sliderWidth, sliderWidthMarker):
self.layoutSimulation = cmds.frameLayout("layoutParticleSliders", label = "PARTICLE ATTRIBUTES", parent = layoutMain, collapsable = True)
layoutColumn = cmds.columnLayout(parent = self.layoutSimulation, adjustableColumn = True)
# cmds.popupMenu()
# cmds.menuItem(label = "Right-Click") # TODO add reset all function

commandDefault = self._UpdateParticleAttributes

layoutSliders1 = cmds.gridLayout(parent = self.layoutSimulation, numberOfColumns = 1, cellWidth = windowWidthMargin, cellHeight = lineHeight)
layoutSliders1 = cmds.gridLayout(parent = layoutColumn, numberOfColumns = 1, cellWidth = windowWidthMargin, cellHeight = lineHeight)
self.sliderPRadius = UI.Slider(
parent = layoutSliders1,
widthWindow = windowWidthMargin,
Expand All @@ -251,9 +254,9 @@ def UILayoutParticleAttributes(self, layoutMain, windowWidthMargin, lineHeight,
)

# cmds.separator(parent = self.layoutSimulation, style = "in", height = 1)
cmds.separator(parent = self.layoutSimulation, style = "in")
cmds.separator(parent = layoutColumn, style = "in")

layoutSliders2 = cmds.gridLayout(parent = self.layoutSimulation, numberOfColumns = 1, cellWidth = windowWidthMargin, cellHeight = lineHeight)
layoutSliders2 = cmds.gridLayout(parent = layoutColumn, numberOfColumns = 1, cellWidth = windowWidthMargin, cellHeight = lineHeight)
self.sliderPConserve = UI.Slider(
parent = layoutSliders2,
widthWindow = windowWidthMargin,
Expand Down Expand Up @@ -333,19 +336,20 @@ def UILayoutParticleAttributes(self, layoutMain, windowWidthMargin, lineHeight,
)
def UILayoutParticleOffset(self, layoutMain, windowWidthMargin, lineHeight, sliderWidth, sliderWidthMarker):
self.layoutOffset = cmds.frameLayout("layoutParticleOffset", label = "PARTICLE OFFSET - use for baking rotation", parent = layoutMain, collapsable = True)
layoutColumn = cmds.columnLayout(parent = self.layoutOffset, adjustableColumn = True)
# cmds.popupMenu()
# cmds.menuItem(label = "Right-Click") # TODO add reset all function

count = 3
cmds.gridLayout(parent = self.layoutOffset, numberOfColumns = count, cellWidth = windowWidthMargin / count, cellHeight = lineHeight)
cmds.gridLayout(parent = layoutColumn, numberOfColumns = count, cellWidth = windowWidthMargin / count, cellHeight = lineHeight)
# cmds.separator()
# , commandResetAll = self._ResetOffsets
self.checkboxMirrorX = UI.Checkbox(label = "Mirror X", command = partial(self._OffsetsUpdate, True), annotation = OverlappyAnnotations.offsetMirrorX)
self.checkboxMirrorY = UI.Checkbox(label = "Mirror Y", command = partial(self._OffsetsUpdate, True), annotation = OverlappyAnnotations.offsetMirrorY)
self.checkboxMirrorZ = UI.Checkbox(label = "Mirror Z", command = partial(self._OffsetsUpdate, True), annotation = OverlappyAnnotations.offsetMirrorZ)


layoutSliders = cmds.gridLayout(parent = self.layoutOffset, numberOfColumns = 1, cellWidth = windowWidthMargin, cellHeight = lineHeight)
layoutSliders = cmds.gridLayout(parent = layoutColumn, numberOfColumns = 1, cellWidth = windowWidthMargin, cellHeight = lineHeight)

commandDefault = self._OffsetsUpdate

Expand Down Expand Up @@ -909,9 +913,9 @@ def _BakeLogic(self, parent, zeroOffsets = False, translation = True, deleteSetu
_startTime = self.time.values[2]
cmds.setAttr(self.nucleus + ".startFrame", _startTime)
self.time.Reset()
Other.SetInfinityCycle(_item)
Animation.SetInfinityCycle(_item)
else:
Other.SetInfinityConstant(_item)
Animation.SetInfinityConstant(_item)

# Delete setup
if (self.checkboxClean.Get()):
Expand Down
Loading

0 comments on commit 7498bcf

Please sign in to comment.