SHARE
TWEET

Untitled

a guest Nov 8th, 2019 90 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #import os
  2. import json
  3. import maya.cmds as cmds
  4.  
  5. myPath = "E:/animationclub_schcool/programmaya/lecture3/h_a/myJsonScript/kandela_w3_project/testSphere.json"
  6.  
  7. #myPath = path.replace('\\','/')
  8. #myPath = os.path.normpath(path)
  9. #myPath = os.path.normcase(path)
  10.  
  11. sph = cmds.ls(sl=1,  l=1)[0]
  12.  
  13. tx = round(cmds.getAttr(sph + ".tx"), 3)
  14. ty = round(cmds.getAttr(sph + ".ty"), 3)
  15. tz = round(cmds.getAttr(sph + ".tz"), 3)
  16. rx = round(cmds.getAttr(sph + ".rx"), 3)
  17. ry = round(cmds.getAttr(sph + ".ry"), 3)
  18. rz = round(cmds.getAttr(sph + ".rz"), 3)
  19.  
  20. a = {}
  21.  
  22.  
  23. a[sph] = {"tx" : tx, "ty" : ty, "tz" : tz,"rx" : rx,"ry" : ry,"rz" : rz}
  24.  
  25. with open(myPath, "w") as jFile:
  26.     json.dump(a, jFile, ident = 4)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top