diff options
author | Julien Duroure <julien.duroure@gmail.com> | 2021-02-25 21:14:46 +0300 |
---|---|---|
committer | Julien Duroure <julien.duroure@gmail.com> | 2021-02-25 21:14:46 +0300 |
commit | 8adb0dce852d84bfe1f9e81399681fa615b5aa8e (patch) | |
tree | 75f48c3bd212918a5ff7231a5c78ba00289ec78b /io_scene_gltf2/blender/exp/gltf2_blender_gather_animation_samplers.py | |
parent | 55ec46913b99253348d00360f8238aeca3c14825 (diff) |
glTF exporter: Inverse matrix only when there is a parent
Diffstat (limited to 'io_scene_gltf2/blender/exp/gltf2_blender_gather_animation_samplers.py')
-rwxr-xr-x | io_scene_gltf2/blender/exp/gltf2_blender_gather_animation_samplers.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/io_scene_gltf2/blender/exp/gltf2_blender_gather_animation_samplers.py b/io_scene_gltf2/blender/exp/gltf2_blender_gather_animation_samplers.py index f6e0b727..362e5b69 100755 --- a/io_scene_gltf2/blender/exp/gltf2_blender_gather_animation_samplers.py +++ b/io_scene_gltf2/blender/exp/gltf2_blender_gather_animation_samplers.py @@ -56,7 +56,10 @@ def gather_animation_sampler(channels: typing.Tuple[bpy.types.FCurve], bake_channel, driver_obj, export_settings) - + if blender_object.parent is not None: + matrix_parent_inverse = blender_object.matrix_parent_inverse.copy().freeze() + else: + matrix_parent_inverse = mathutils.Matrix.Identity(4).freeze() sampler = gltf2_io.AnimationSampler( extensions=__gather_extensions(channels, blender_object_if_armature, export_settings, bake_bone, bake_channel), @@ -64,7 +67,8 @@ def gather_animation_sampler(channels: typing.Tuple[bpy.types.FCurve], input=__gather_input(channels, blender_object_if_armature, non_keyed_values, bake_bone, bake_channel, bake_range_start, bake_range_end, action_name, driver_obj, export_settings), interpolation=__gather_interpolation(channels, blender_object_if_armature, export_settings, bake_bone, bake_channel), - output=__gather_output(channels, blender_object.matrix_parent_inverse.copy().freeze(), + output=__gather_output(channels, + matrix_parent_inverse, blender_object_if_armature, non_keyed_values, bake_bone, |