Advertisement
Guest User

Untitled

a guest
Sep 27th, 2016
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.37 KB | None | 0 0
  1. # -*- coding: cp932 -*-
  2. import pymel.core as pm
  3. import pymel.tools.mel2py as mel2py
  4.  
  5. melCmd = """
  6.  
  7.  
  8. global proc string getPcUserName()
  9. {
  10. string $output="";
  11. string $AppDir = `internalVar -userAppDir`;
  12. print ("$AppDir="+$AppDir+"\n");
  13. string $AppDirArr[];
  14. tokenize $AppDir "/" $AppDirArr;
  15. $output=$AppDirArr[2];
  16. print("---getPcUserName()-----------"+$output+"\n");
  17. return $output;
  18. }
  19.  
  20. getPcUserName();
  21.  
  22.  
  23. """
  24.  
  25. print "------------------------------------------------"
  26. melCmd = melCmd.replace('+"\n"', '')
  27. melCmd = melCmd.replace('\n', '')
  28. print("melCmd="+melCmd)
  29. print "------------------------------------------------"
  30.  
  31. pyCmd = mel2py.mel2pyStr(melCmd,pymelNamespace='pm')
  32. pyFixed_Dest = ""
  33. pyFixed_Dest = pyFixed_Dest + "# -*- coding: cp932 -*- \n"
  34. pyFixed_Dest = pyFixed_Dest + "from maya import cmds \n"
  35. pyFixed = pyCmd.replace("pymel.all","pymel.core")
  36. pyFixed = pyFixed.replace("pm.pm.cmds","cmds")
  37. pyFixed_Dest = pyFixed_Dest + pyFixed+"\n"
  38. print "------------------------------------------------"
  39. pyFixed_Dest = pyFixed_Dest.replace('pm.file', 'cmds.file')
  40. pyFixed_Dest = pyFixed_Dest.replace('pm.ls', 'cmds.ls')
  41. pyFixed_Dest = pyFixed_Dest.replace('pm.select', 'cmds.select')
  42. pyFixed_Dest = pyFixed_Dest.replace('pm.internalVar', 'cmds.internalVar')
  43. pyFixed_Dest = pyFixed_Dest.replace('pm.keyframe', 'cmds.keyframe')
  44.  
  45. print "------------------------------------------------"
  46. print pyFixed_Dest
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement