cwisbg

maya_TimeLaps_v1

Dec 9th, 2012
305
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.13 KB | None | 0 0
  1. # Time laps
  2. from pymel.core import *
  3. import shutil as s
  4. import time
  5. global onOff
  6. onOff = 0
  7. def takePicture(fileName):
  8. tmpDirectory = (os.path.expanduser("~/Documents/maya/projects/default/images/tmp/timeLaps.iff"))
  9. filePath = (os.path.expanduser("~/Desktop/"+fileName+".iff"))
  10. hwRender(cam="camera1", cf=1, fnp = 1)
  11. s.copy2(tmpDirectory, filePath)
  12. def startTimeLaps(*args):
  13. global onOff
  14. onOff = 1
  15. print "Start Time Laps"
  16. start = time.clock()
  17. i = 0
  18. while onOff:
  19. refresh(cw=1)
  20. elapsed = (time.clock() - start)
  21. #print elapsed
  22. if elapsed > 1:
  23. rotate("camera_grp", 0,1,0,os=1,r=1)
  24. takePicture("hellsheYeat_{0}".format(i))
  25. start = time.clock()
  26. i += 1
  27. print "takingPiutre", i
  28. def endTimeLaps(*args):
  29. global onOff
  30. onOff = 0
  31. print "Time Laps Stopped"
  32. window = window(t="Time Laps")
  33. layout = frameLayout(l = "Time Laps")
  34. startTLbtn = button(l = "Start")
  35. stopTLbtn = button(l = "Stop")
  36. startTLbtn.setCommand(startTimeLaps)
  37. stopTLbtn.setCommand(endTimeLaps)
  38. showWindow( window )
Advertisement
Add Comment
Please, Sign In to add comment