Hi, I am not sure if I pose the question well. I have an animated object (i.e. Cube) and I want to write (export) to a file its location for each frame in a CSV - like format (even a plain text separated with spaces or a special characters would be great too). Any suggestions ?
Thanks in advance!
Ok I thin that I found what I was looking for ( i still missing the last part - writing the data to a file, but i assume that this will be easier) . It was realy that simple :
import bpy
#get my animated object
obj = bpy.context.object
#set the range in frames
for f in range(0,100):
bpy.context.scene.frame_set(f)
#print object's location for each frame
print(obj.location)
This is how I ended up with this script (it works fine for me to export data to VVVV):
import bpy
scn = bpy.context.scene
obj = bpy.context.object
locations =[]
for f in range(scn.frame_start,scn.frame_end):
bpy.context.scene.frame_set(f)
locations.append(str(obj.location))
outfile = open('C:/myFile.txt','w')
outfile.writelines('
'.join(locations))
outfile.close()