Skip to content

Commit

Permalink
fix simple rig position pop when edit pivot. Also added undo chunk
Browse files Browse the repository at this point in the history
  • Loading branch information
miquelcampos committed Mar 11, 2024
1 parent f75c33a commit 09dba59
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion release/scripts/mgear/simpleRig/simpleRigTool.py
Original file line number Diff line number Diff line change
Expand Up @@ -1105,6 +1105,7 @@ def _parent_pivot(pivot, parent):
"valid simple rig ctl.".format(parent.name()))


@utils.one_undo
def _edit_pivot_position(ctl):
"""Edit control pivot
Expand Down Expand Up @@ -1139,6 +1140,7 @@ def _edit_pivot_position(ctl):
return


@utils.one_undo
def _consolidate_pivot_position(ctl):
"""Consolidate the pivot position after editing
Expand All @@ -1154,7 +1156,10 @@ def _consolidate_pivot_position(ctl):
npo = ctl.getParent()
attribute.unlockAttribute(npo)
children = npo.listRelatives(type="transform")
pm.parent(children, rig)
if children:
for ch in children:
attribute.unlockAttribute(ch)
pm.parent(children, rig)
# filter out the ctl
children = [c for c in children if c != ctl]
# set the npo to his position
Expand All @@ -1163,6 +1168,8 @@ def _consolidate_pivot_position(ctl):
# reparent childrens
if children:
pm.parent(children, ctl)
for ch in children:
attribute.lockAttribute(ch)
# re-connect/update driven elements
_update_driven(ctl)
ctl.attr("edit_mode").set(False)
Expand Down

0 comments on commit 09dba59

Please sign in to comment.