Created
December 14, 2015 12:11
-
-
Save csaez/781616dc1ec136a86d27 to your computer and use it in GitHub Desktop.
MAYA: save/load transforms
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
import maya.cmds as mc | |
if not hasattr(mc, "CLIPBOARD"): | |
mc.CLIPBOARD = dict() | |
def saveTransforms(nodes=None): | |
nodes = nodes or mc.ls(sl=True, l=True) | |
for longName in nodes: | |
matrix = mc.xform(longName, q=True, m=True) | |
mc.CLIPBOARD[longName] = matrix | |
def loadTransforms(nodes=None): | |
nodes = nodes or mc.CLIPBOARD.keys() | |
for longName in nodes: | |
matrix = mc.CLIPBOARD.get(longName) | |
if not matrix: | |
continue | |
mc.xform(longName, m=matrix) | |
saveTransforms() | |
loadTransforms() | |
print(mc.CLIPBOARD) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment