Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@cyaoeu
Created August 29, 2017 17:57
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cyaoeu/8ca94319a23d5d3233c5c1792cb8ad99 to your computer and use it in GitHub Desktop.
Save cyaoeu/8ca94319a23d5d3233c5c1792cb8ad99 to your computer and use it in GitHub Desktop.
Blender script: batch export anims
import bpy
path = bpy.path.abspath('//') #path of .blend
objname = bpy.context.active_object.name #select rig
singleanim = True
if singleanim == True:
action = bpy.context.active_object.animation_data.action
bpy.ops.screen.frame_jump()
bpy.data.scenes[0].frame_end = action.frame_range[1]
bpy.ops.export_scene.fbx(filepath=str(path + "/animations/" + "AS_" + action.name + '.fbx'), use_selection = True, object_types={'ARMATURE'}, bake_anim = True, bake_anim_use_nla_strips=False, bake_anim_use_all_actions=False , add_leaf_bones=False, bake_anim_use_all_bones=True, use_armature_deform_only = True)
#batchanims
if singleanim == False:
for action in bpy.data.actions:
bpy.context.active_object.animation_data.action = action
bpy.data.scenes[0].frame_end = action.frame_range[1]
bpy.ops.export_scene.fbx(filepath=str(path + "/animations/" + "AS_" + action.name + '.fbx'), use_selection = True, object_types={'ARMATURE'}, bake_anim = True, bake_anim_use_nla_strips=False, bake_anim_use_all_actions=False , add_leaf_bones=False, bake_anim_use_all_bones=True, use_armature_deform_only = True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment