Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #import os
- import json
- import maya.cmds as cmds
- myPath = "E:/animationclub_schcool/programmaya/lecture3/h_a/myJsonScript/kandela_w3_project/testSphere.json"
- #myPath = path.replace('\\','/')
- #myPath = os.path.normpath(path)
- #myPath = os.path.normcase(path)
- sph = cmds.ls(sl=1, l=1)[0]
- tx = round(cmds.getAttr(sph + ".tx"), 3)
- ty = round(cmds.getAttr(sph + ".ty"), 3)
- tz = round(cmds.getAttr(sph + ".tz"), 3)
- rx = round(cmds.getAttr(sph + ".rx"), 3)
- ry = round(cmds.getAttr(sph + ".ry"), 3)
- rz = round(cmds.getAttr(sph + ".rz"), 3)
- a = {}
- a[sph] = {"tx" : tx, "ty" : ty, "tz" : tz,"rx" : rx,"ry" : ry,"rz" : rz}
- with open(myPath, "w") as jFile:
- json.dump(a, jFile, ident = 4)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement