diff options
author | Julien Duroure <julien.duroure@gmail.com> | 2019-10-12 18:05:38 +0300 |
---|---|---|
committer | Julien Duroure <julien.duroure@gmail.com> | 2019-10-12 18:05:38 +0300 |
commit | b9b1814a4c26f73aae7f306c9ff2e21b7b7bdcee (patch) | |
tree | e31ef1b44456b78f815fe722c59314b1bf86ecd7 /io_scene_gltf2/blender/exp/gltf2_blender_gather_animation_channels.py | |
parent | 67e42c79e5c3f2724d33b7dc2f0fb4ab84d10e7f (diff) |
glTF exporter: option to export only deformation bones
Diffstat (limited to 'io_scene_gltf2/blender/exp/gltf2_blender_gather_animation_channels.py')
-rwxr-xr-x | io_scene_gltf2/blender/exp/gltf2_blender_gather_animation_channels.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/io_scene_gltf2/blender/exp/gltf2_blender_gather_animation_channels.py b/io_scene_gltf2/blender/exp/gltf2_blender_gather_animation_channels.py index edee0971..611cd74a 100755 --- a/io_scene_gltf2/blender/exp/gltf2_blender_gather_animation_channels.py +++ b/io_scene_gltf2/blender/exp/gltf2_blender_gather_animation_channels.py @@ -22,6 +22,7 @@ from io_scene_gltf2.blender.exp.gltf2_blender_gather_cache import cached from io_scene_gltf2.blender.exp import gltf2_blender_gather_animation_samplers from io_scene_gltf2.blender.exp import gltf2_blender_gather_animation_channel_target from io_scene_gltf2.blender.exp import gltf2_blender_get +from io_scene_gltf2.blender.exp import gltf2_blender_gather_skins @cached @@ -58,7 +59,14 @@ def gather_animation_channels(blender_action: bpy.types.Action, return [] # Then bake all bones - for bone in blender_object.data.bones: + bones_to_be_animated = [] + if export_settings["gltf_def_bones"] is False: + bones_to_be_animated = blender_object.data.bones + else: + bones_to_be_animated, _, _ = gltf2_blender_gather_skins.get_bone_tree(None, blender_object) + bones_to_be_animated = [blender_object.pose.bones[b.name] for b in bones_to_be_animated] + + for bone in bones_to_be_animated: for p in ["location", "rotation_quaternion", "scale"]: channel = __gather_animation_channel( (), |