Created
October 14, 2022 22:17
-
-
Save JustinPedersen/94bc09582edba17afbd31c2bfa9354b8 to your computer and use it in GitHub Desktop.
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 | |
# Iterate through everything in the user's selection | |
for item in cmds.ls(selection=True): | |
# Store the current position | |
orig_pos = cmds.xform(item, query=True, worldSpace=True, translation=True) | |
# Move the item to the origin. This will move where ever it's current | |
# pivot point is set to | |
cmds.move(0,0,0,item, rotatePivotRelative = True) | |
# You would perform the export here | |
print('Do Export') | |
# Now we can move the item back where we found it. Comment this line | |
# out to check the items are going to the origin as you'd expect. | |
cmds.xform(item, worldSpace=True, translation=orig_pos) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment