1
$\begingroup$

Can you obtain data from multiple frames without using bpy.context.scene.frame_set()? The above command takes too long on my scene, and I also have too many frames, but I only need to grab one numerical data from each frame.

Is there a way to do this without going to each frame or iteration? I'm specifically interested in grabbing Shape Key value from each frame.

$\endgroup$
2
$\begingroup$

You can read the keyframe points of F-Curves directly, which doesn't require frame changes. Instead, the x-coordinate of a point is the time / keyframe, the y-coordinate is the value.

To find the right F-Curves, iterate over Object.animation_data.action.fcurves and check their data_path and array_index properties.

Related: http://www.blender.org/documentation/blender_python_api_2_71_release/info_quickstart.html#animation (See the low level example)

$\endgroup$
  • $\begingroup$ Thank you for the answer! I was able to figure out where they are stored using your description and the link. For my Shape Key in particular, the data were in 'D.actions[action_num].fcurves[shape_key_num].keyframe_points[frame_num].co[1]' $\endgroup$ – Efreeto Sep 5 '14 at 1:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.