Advertisement
Guest User

Untitled

a guest
Jul 27th, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.52 KB | None | 0 0
  1. # first hacky attempt at getting camera / object animations into AE from Houdini.
  2. # Stick this on a tool button on a shelf. Note the hard-coding below (!)
  3. # A file will be created in your home folder; open it, copy to the clipboard, then go to AE and paste onto the cam/null of your choice
  4.  
  5.  
  6. import hou
  7.  
  8. h = hou.node("/obj/geo1")
  9. filename = "testfile.txt"
  10. startFrame = 0
  11. endFrame = 300
  12. scale = 100.0
  13.  
  14.  
  15. with open(filename,"w") as ff:
  16. ff.write("Adobe After Effects 8.0 Keyframe Data\n\n")
  17. ff.write("\tUnits Per Second\t25\n")
  18. ff.write("\tSource Width\t1920\n")
  19. ff.write("\tSource Height\t804\n")
  20. ff.write("\tSource Pixel Aspect Ratio\t1\n")
  21. ff.write("\tComp Pixel Aspect Ratio\t1\n")
  22.  
  23. # do the orientation:
  24.  
  25. ff.write("\nTransform\tOrientation\n")
  26. ff.write("\tFrame\tX degrees\t\n")
  27.  
  28. for theFrame in range (startFrame,endFrame):
  29. x = h.worldTransformAtTime(hou.frameToTime(theFrame))
  30. xform = x.extractRotates('srt','zyx',hou.Vector3())
  31. ff.write("\t"+str(theFrame)+"\t"+str(xform[0])+"\t"+str(-xform[1])+"\t"+str(-xform[2])+"\n")
  32.  
  33.  
  34. # do the positions:
  35.  
  36. ff.write("\nTransform\tPosition\n")
  37. ff.write("\tFrame\tX pixels\tY pixels\tZ pixels\n")
  38.  
  39. for theFrame in range (startFrame,endFrame):
  40. x = h.worldTransformAtTime(hou.frameToTime(theFrame))
  41. xform = x.extractTranslates('srt')
  42. ff.write("\t"+str(theFrame)+"\t"+str(xform[0]*scale)+"\t"+str(-xform[1]*scale)+"\t"+str(-xform[2]*scale)+"\n")
  43.  
  44. ff.write("\nEnd of Keyframe Data\n")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement