This is a great start - will defiantly be using this to get closer to the desired end result :)
Thanks so much Manuel for your help!
I'm trying to find a way to export moving camera data (rotation and position) from cinema 4d to a csv file.
I have found a python script on how to get this on ONE single frame. I'll insert the code I found bellow.
This code outputs position (x, y and z) and rotation degrees (x, y and z) on one row in different columns, which is perfect.
My question is how to expand the code to make the script look through each frame in the timeline and not only one frame,
giving each frame it's own row in the csv doc.
My lack of python knowledge hinders me from getting closer to my goals. All help is appreciated!
#Welcome to the world of Python
if not obj: return
while obj.GetUp() and not obj.GetNext():
obj = obj.GetUp()
file = c4d.storage.SaveDialog(c4d.FILESELECTTYPE_ANYTHING, title='Save csv file as', force_suffix='csv')
csv_file = open(file, 'w')
obj = doc.GetFirstObject()
if obj.GetType() == 5103:
name = obj.GetName()
obj_matrix = obj.GetMg()
position = obj_matrix.off
rotation_rad = c4d.utils.MatrixToHPB(obj_matrix,c4d.ROTATIONORDER_XYZGLOBAL)
rotation_deg = c4d.Vector(c4d.utils.Deg(rotation_rad.x), c4d.utils.Deg(rotation_rad.y), c4d.utils.Deg(rotation_rad.z))
line = '%s, %s, %s, %s, %s, %s'%(position.x,
csv_file.write(line + '\n')
obj = Walker(obj)