I have a scene - which I have not created - in which the camera and the light set move with every frame (9 in total).

I would like to print out the camera and lights position for every frame using python, ideally in batch mode (so avoiding screen operators).

Right now I manage to get that printed out a million times using a handler like explained here or here but is there a way to do that that works without actually goig through the animations?

  • $\begingroup$ Does this answer your question? $\endgroup$
    – scurest
    Mar 9, 2023 at 8:19

1 Answer 1


You could evaluate fcurves for needed frames so you wouldn't need to change frames and update everything in the scene:

import bpy 

C = bpy.context
sel = C.selected_objects

for frame in range(C.scene.frame_start, C.scene.frame_end+1):
    print("Frame: " + str(frame)) 
    for o in sel: 
        position = []
        for curve in o.animation_data.action.fcurves:
            if curve.data_path == 'location':
        print(o.name + ": " + str(position)[1:-1])

This prints location for all scene frames for all selected objects:

enter image description here

  • 1
    $\begingroup$ This will work in simple cases. But note that in general the position may be affected by constraints, parenting, NLA tracks, drivers, etc. If you want to handle these, there's not really any alternative to actually going to the frame in question. $\endgroup$
    – scurest
    Mar 9, 2023 at 15:38
  • $\begingroup$ That's true. I don't do much animation so I did not think about that. Might be worth to go through frames in a lot of situations. Anyway, that's one way if only keyframe animation is used. $\endgroup$ Mar 9, 2023 at 16:09

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .