Last active
September 14, 2022 20:38
-
-
Save Ryhon0/0249570b45df7c297cb4e99c95e2da14 to your computer and use it in GitHub Desktop.
Blender batch animation exporter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import bpy | |
import os | |
path = bpy.path.abspath('//') #path of .blend | |
objname = bpy.context.active_object.name #select rig | |
if not os.path.exists(path + "/animations"): | |
os.makedirs(path + "/animations") | |
filename = bpy.data.filepath.split("\\")[-1] | |
filename = filename[0:len(filename)-6] | |
for action in bpy.data.actions: | |
name = action.name | |
name = name.split(":")[0] | |
if name.endswith("_A"): | |
name = name[0:len(name)-2] | |
if name.startswith("reference"): | |
continue | |
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/" + filename + "@" + name + '.fbx'), global_scale = 0.3937, 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