Reading location and rotation frame by frame

I was wondering how to loop through all frames and print out an objects location and position.

I was playing around in the console and got hung up figuring out how to loop thought the frames.

Then I started thinking I could use “evaluate Fcurve” but I’ve had no luck getting it to work.

Any suggestions?

B = bpy.data.scene[0].start_frame // Defaults to 1
N = bpy.data.scene[0].end_frame // Defaults to 250

for i in range(B,N):
   print(i)     /// Even this basic code to loop through the frame numbers froze the console..

.

Hi there!

Dunno about 2.5x but in 2.4x this works pretty well:

sce = Scene.GetCurrent()
context = sce.getRenderingContext()
B = context.sFrame = 1
N = context.eFrame = 250

for i in range(B,N):
    print(i)  # In 2.46 this basic loop does NOT freeze in the console...

Regards,


scene = bpy.context.scene
for i in range(scene.frame_start, scene.frame_end):
    scene.objects['Cube'].animation_data.action.fcurves[0].evaluate(i)