Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # first hacky attempt at getting camera / object animations into AE from Houdini.
- # Stick this on a tool button on a shelf. Note the hard-coding below (!)
- # 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
- import hou
- h = hou.node("/obj/geo1")
- filename = "testfile.txt"
- startFrame = 0
- endFrame = 300
- scale = 100.0
- with open(filename,"w") as ff:
- ff.write("Adobe After Effects 8.0 Keyframe Data\n\n")
- ff.write("\tUnits Per Second\t25\n")
- ff.write("\tSource Width\t1920\n")
- ff.write("\tSource Height\t804\n")
- ff.write("\tSource Pixel Aspect Ratio\t1\n")
- ff.write("\tComp Pixel Aspect Ratio\t1\n")
- # do the orientation:
- ff.write("\nTransform\tOrientation\n")
- ff.write("\tFrame\tX degrees\t\n")
- for theFrame in range (startFrame,endFrame):
- x = h.worldTransformAtTime(hou.frameToTime(theFrame))
- xform = x.extractRotates('srt','zyx',hou.Vector3())
- ff.write("\t"+str(theFrame)+"\t"+str(xform[0])+"\t"+str(-xform[1])+"\t"+str(-xform[2])+"\n")
- # do the positions:
- ff.write("\nTransform\tPosition\n")
- ff.write("\tFrame\tX pixels\tY pixels\tZ pixels\n")
- for theFrame in range (startFrame,endFrame):
- x = h.worldTransformAtTime(hou.frameToTime(theFrame))
- xform = x.extractTranslates('srt')
- ff.write("\t"+str(theFrame)+"\t"+str(xform[0]*scale)+"\t"+str(-xform[1]*scale)+"\t"+str(-xform[2]*scale)+"\n")
- ff.write("\nEnd of Keyframe Data\n")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement