Created
November 14, 2022 11:42
-
-
Save JustinPedersen/d8136e89223519af3c0ae068341d7ad8 to your computer and use it in GitHub Desktop.
Unfreeze Transforms in on Maya objects
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from maya import cmds | |
# Get the user selection and iterate through it | |
for item in cmds.ls(selection=True): | |
# Get the current world space location of the item. This is not the same | |
# as the values in the channel box, but the true world space location | |
world_space = cmds.xform(item, scalePivot=True, query=True, worldSpace=True) | |
# Move the object to the world center | |
cmds.move(0,0,0,item, rotatePivotRelative = True) | |
# Freeze its transforms here at 000 | |
cmds.makeIdentity(apply=True, translate=True) | |
# Apply the previous world space values back onto the object | |
cmds.xform(item, translation=world_space) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment