Skip to content

Commit 183fba1

Browse files
committed
draft pin scale constraint logic
1 parent f3660fe commit 183fba1

2 files changed

Lines changed: 9 additions & 8 deletions

File tree

GETOOLS_SOURCE/modules/Tools.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -198,18 +198,19 @@ def UILayoutLocators(self, layoutMain):
198198
# cmds.setParent("..")
199199

200200
### LOCATORS ROW 1
201-
countCells2 = 6
201+
countCells2 = 7
202202
cmds.gridLayout(parent = layoutColumn, numberOfColumns = countCells2, cellWidth = Settings.windowWidthMargin / countCells2, cellHeight = Settings.lineHeight)
203203
cmds.button(label = "Locator", command = self.Locator, backgroundColor = Colors.green10, annotation = ToolsAnnotations.locator)
204204
cmds.button(label = "Match", command = self.LocatorsMatch, backgroundColor = Colors.green10, annotation = ToolsAnnotations.locatorMatch)
205205
cmds.button(label = "Parent", command = self.LocatorsParent, backgroundColor = Colors.green10, annotation = ToolsAnnotations.locatorParent)
206-
cmds.button(label = "Pin", command = partial(self.LocatorsBakeReverse, True, True), backgroundColor = Colors.yellow50, annotation = ToolsAnnotations.locatorsBakeReverse)
206+
cmds.button(label = "Pin", command = partial(self.LocatorsBakeReverse, True, True, True), backgroundColor = Colors.yellow50, annotation = ToolsAnnotations.locatorsBakeReverse)
207207
cmds.popupMenu()
208208
cmds.menuItem(label = "Without Reverse Constraint", command = self.LocatorsBake)
209-
cmds.button(label = "P-POS", command = partial(self.LocatorsBakeReverse, True, False), backgroundColor = Colors.yellow50, annotation = ToolsAnnotations.locatorsBakeReversePos)
210-
cmds.button(label = "P-ROT", command = partial(self.LocatorsBakeReverse, False, True), backgroundColor = Colors.yellow50, annotation = ToolsAnnotations.locatorsBakeReverseRot)
209+
cmds.button(label = "P-POS", command = partial(self.LocatorsBakeReverse, True, False, False), backgroundColor = Colors.yellow50, annotation = ToolsAnnotations.locatorsBakeReversePos)
210+
cmds.button(label = "P-ROT", command = partial(self.LocatorsBakeReverse, False, True, False), backgroundColor = Colors.yellow50, annotation = ToolsAnnotations.locatorsBakeReverseRot)
211+
cmds.button(label = "P-SCL", command = partial(self.LocatorsBakeReverse, False, False, True), backgroundColor = Colors.yellow50, annotation = "TODO") # TODO
211212
# cmds.setParent("..")
212-
213+
213214
### LOCATORS ROW 2
214215
cmds.rowLayout(parent = layoutColumn, adjustableColumn = 1, numberOfColumns = 2, columnWidth2 = (50, 150), columnAlign = [(1, "center"), (2, "center")], columnAttach = [(1, "both", 0), (2, "both", 0)])
215216
cmds.button(label = "Relative", command = self.LocatorsRelativeReverse, backgroundColor = Colors.orange10, annotation = ToolsAnnotations.locatorsRelativeReverse)
@@ -378,7 +379,7 @@ def LocatorsParent(self, *args):
378379

379380
def LocatorsBake(self, *args):
380381
Locators.CreateOnSelected(scale = self.GetFloatLocatorSize(), hideParent = self.GetCheckboxLocatorHideParent(), subLocator = self.GetCheckboxLocatorSubLocator(), constraint = True, bake = True)
381-
def LocatorsBakeReverse(self, translate=True, rotate=True, *args): # TODO , channelBox = False
382+
def LocatorsBakeReverse(self, translate=True, rotate=True, scale=True, *args): # TODO , channelBox = False
382383
Locators.CreateOnSelected(scale = self.GetFloatLocatorSize(), hideParent = self.GetCheckboxLocatorHideParent(), subLocator = self.GetCheckboxLocatorSubLocator(), constraint = True, bake = True, constrainReverse = True, constrainTranslate = translate, constrainRotate = rotate)
383384

384385
def LocatorsRelative(self, *args):

GETOOLS_SOURCE/utils/Locators.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ def Create(name=_nameBase, scale=_scale, hideParent=False, subLocator=False):
105105
return locatorCurrent, subLocator
106106
else:
107107
return locatorCurrent
108-
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):
108+
def CreateOnSelected(name=_nameBase, scale=_scale, minSelectedCount=_minSelectedCount, hideParent=False, subLocator=False, constraint=False, bake=False, parentToLastSelected=False, constrainReverse=False, constrainTranslate=True, constrainRotate=True, constrainScale=True, euler=False): # TODO change scale to False after tests if needed
109109
# Check selected objects
110110
selectedList = Selector.MultipleObjects(minSelectedCount)
111111
if (selectedList == None):
@@ -153,7 +153,7 @@ def CreateOnSelected(name=_nameBase, scale=_scale, minSelectedCount=_minSelected
153153
firstObject = sublocatorsList[i]
154154
else:
155155
firstObject = locatorsList[i]
156-
Constraints.ConstrainSecondToFirstObject(firstObject, selectedList[i], maintainOffset = False, parent = constrainTranslate and constrainRotate, point = constrainTranslate, orient = constrainRotate)
156+
Constraints.ConstrainSecondToFirstObject(firstObject, selectedList[i], maintainOffset = False, parent = constrainTranslate and constrainRotate, point = constrainTranslate, orient = constrainRotate, scale = constrainScale)
157157

158158
# Select objects and return
159159
if subLocator:

0 commit comments

Comments
 (0)