Force internal data update - why does scene.update() not work?

Hi there,

After searching for several hours on that topic now it seems to me like this is a known but unsolved problem. Hoping i’m wrong here comes the description:

I’m working on a script where i animated an object based on input data frame by frame, now i want to have frame-dependent access to the objects’ data from a script.

You can simulate this setting with very little effort by just animating an empty over a few frames (and maybe bake it to have the same setup, see image).


Now consider the following script:


import bpy

ob = bpy.data.object[0] # the object we have animated

# lets say the animation went from frame 1 to 41
for i in range(1,42):
    print("Frame "+i)
    
    # set frame to i
    bpy.context.scene.frame_current = i
    
    # updating the scene 
    bpy.context.scene.update()

    print(ob.location)

So here comes the Problem:

Why does scene.update() not really update the scene?

I know there are reasons to not update anything after every little change because of reasons, but i thought (and read*) that scene.update() would to such an update.

I expected to get the location per frame, but the printed locations are all the same.

Any help, hint or link welcomed!

PS: I was trying several combinations of update_tag() but none of them helped.

According to the link tagged data is being updated, maybe im just missing this part?

As i wrote, i expected scene.update() to do a full update. I fixed the problem now by using the scene.frame_set() which makes a lot of sense if you think about it. This function causes a scene update as expected.