| __author__ = 'thoth'
#
# http://blender.stackexchange.com/questions/31698/script-that-exports-keyframes-as-baked-meshes
#
import bpy
def find_modifier_of_type(obj, type):
    for mod in obj.modifiers:
        if mod.type==type:
            return mod
    return None
def duplicate_and_apply_armature(scn, src):
    scn.objects.active = src
    print(scn.objects.active)
    for obj in scn.objects:
        obj.select = ( obj==src)
    bpy.ops.object.duplicate(linked=False)
    print(scn.objects.active)
    dup_obj = bpy.context.active_object
    dup_obj.name = "duplicate for %d"%scn.frame_current
    mod = find_modifier_of_type(dup_obj, 'ARMATURE')
    bpy.ops.object.modifier_apply(modifier=mod.name)
    return dup_obj
def find_pose_frames(obj):
    frames = set()
    mod = find_modifier_of_type(obj, 'ARMATURE')
    if mod is None:
        raise BaseException("active object does not have an ARMATURE modifier")
    arm = mod.object
    action = arm.animation_data.action
    for fc in action.fcurves:
        if fc.data_path[:10] != "pose.bones":
            # don't care about whatever this is
            continue
        for kp in fc.keyframe_points:
            frames.add(kp.co.x)
    return sorted(frames)
def mission1(scn, obj):
    export_pattern = "/tmp/cube-%d.fbx"
    for fr in find_pose_frames(obj):
        scn.frame_set(fr)
        dup_obj = duplicate_and_apply_armature(scn, obj)
        # this function has a LOT of flags, and I don't know what they all do.
        bpy.ops.export_scene.fbx(filepath=(export_pattern %scn.frame_current),  use_selection=True)
        scn.objects.unlink(dup_obj)
    scn.objects.active = obj
scn = bpy.context.scene
mission1(scn, bpy.context.active_object)
 | 
Blender python API quick-start
Syntax highlighting by Pygments.