update scene animation data

Hi guys
I’m trying to run an empty down a path, and I need to check it’s position at each frame via script. It is no problem checking it’s global position on the frame I’m at, but when I execute a script that jumps to another frame, no animation data is updated.
Thanks to BA, I know how to update an f-curve, but the path animation doesn’t seem to be an action.
I tried scene.update(), I tried update_ID_tag for both object and scene, nothing seems to work.

So in short:
Is there a way to make an object follow a path and check it’s global position on several frames using script?

dunno how you change the frame, but don’t use frame_current = …

use frame_set(…) instead or animation data won’t update

you may also be interested into app handlers (frame_change_*):

I’m about to be doing some fiddling with getting the current frame from the timeline as well. Could you please explain the difference between frame_current (which I’m assuming implies a specific method/function) and frame_set()?

The assumption I’m making, going by the name, is that frame_set() will make a specific frame current rather than returning the current frame.

I actually did try the scene.frame_set() don’t know why it didn’t work then.
now it does, thanks CoDEmax

One more thing: I am trying to clear the parent of a specific object.
I don’t want to use
bpy.ops.clear_parent() because I might have several objects selected. So I tried
bpy.ops.outliner.clear_parent(“ObjectName”, ‘CLEAR’)
I always get the error: ValueError: 1-3 args execution context is supported. The “ObjectName” must be a simple string, right? Not an actual object. Tried the other as well, btw. same error.

frame_current is only a property, you can safely read the current frame# from it. But although setting a frame appears to work, it won’t update animation data, it only changes the frame#. Use the function (Scene method?) frame_set(), it will make Blender update all properties which are animation related like matrices.

Be careful with operator parameters, positional arguments are possible but will be used for context overriding and that kind of stuff. You always need to use keyword arguments for the operator parameters:

bpy.ops.outliner.clear_parent(dragged_obj=“ObjectName”, type=‘CLEAR’)

But I wouldn’t ever use operators if there’s also a low-level approach, 'cause operators rely on context. In case of the clear_parent() function, you would have to execute this from space-bar menu over outliner or overwrite the context (which isn’t always easy, you may even crash Blender).

Simply do:

ob = bpy.data.objects.get("ObjectName")
if ob:
    ob.parent = None