Skip to content

Instantly share code, notes, and snippets.

@JustinPedersen
Created November 14, 2022 11:42
Show Gist options
  • Save JustinPedersen/d8136e89223519af3c0ae068341d7ad8 to your computer and use it in GitHub Desktop.
Save JustinPedersen/d8136e89223519af3c0ae068341d7ad8 to your computer and use it in GitHub Desktop.
Unfreeze Transforms in on Maya objects
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