diff options
author | Julien Duroure <julien.duroure@gmail.com> | 2020-07-21 21:14:06 +0300 |
---|---|---|
committer | Julien Duroure <julien.duroure@gmail.com> | 2020-07-21 21:14:06 +0300 |
commit | 63dd8498ac106b5645822a124aa0edb0d917d5a8 (patch) | |
tree | fe890d51836f813a75303bbc3dee83dc6a0b2326 /io_scene_gltf2/blender/exp/gltf2_blender_gather_animation_sampler_keyframes.py | |
parent | 40db41a902be5dfd8305ea389aa5e8eec1aa74d6 (diff) |
glTF exporter: Add support for use_inherit_rotation and inherit_scale.
Thanks Skywolf285!
Diffstat (limited to 'io_scene_gltf2/blender/exp/gltf2_blender_gather_animation_sampler_keyframes.py')
-rwxr-xr-x | io_scene_gltf2/blender/exp/gltf2_blender_gather_animation_sampler_keyframes.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/io_scene_gltf2/blender/exp/gltf2_blender_gather_animation_sampler_keyframes.py b/io_scene_gltf2/blender/exp/gltf2_blender_gather_animation_sampler_keyframes.py index 822aa6a1..f8ab333e 100755 --- a/io_scene_gltf2/blender/exp/gltf2_blender_gather_animation_sampler_keyframes.py +++ b/io_scene_gltf2/blender/exp/gltf2_blender_gather_animation_sampler_keyframes.py @@ -161,8 +161,14 @@ def get_bone_matrix(blender_object_if_armature: typing.Optional[bpy.types.Object if bake_bone is None: matrix = pbone.matrix_basis.copy() else: - matrix = pbone.matrix - matrix = blender_object_if_armature.convert_space(pose_bone=pbone, matrix=matrix, from_space='POSE', to_space='LOCAL') + if (pbone.bone.use_inherit_rotation == False or pbone.bone.inherit_scale != "FULL") and pbone.parent != None: + rest_mat = (pbone.parent.bone.matrix_local.inverted_safe() @ pbone.bone.matrix_local) + matrix = (rest_mat.inverted_safe() @ pbone.parent.matrix.inverted_safe() @ pbone.matrix) + else: + matrix = pbone.matrix + matrix = blender_object_if_armature.convert_space(pose_bone=pbone, matrix=matrix, from_space='POSE', to_space='LOCAL') + + data[frame][pbone.name] = matrix |