I am writing an exporter for a custom format, and I would like it to export each action as a separate animation. Based on what I've learned so far, I think the exporter would have to look something like this:
export_rest_pose(armature_object.data.bones) for action in bpy.data.actions: # TODO: set 'action' as the current action, somehow frame_begin, frame_end = [int(x) for x in action.frame_range] for frame in range(frame_begin, frame_end): bpy.context.scene.frame_set(frame) export_pose(armature_object.pose.bones)
First, does this look about right, or is there a better way of doing it? In particular, is there a way to get the pose of an armature at a specific frame without changing the whole scene to that frame?
Second, assuming that is the correct way to do it, how do I set the current action?