[Bf-extensions-cvs] [8adb0dce] master: glTF exporter: Inverse matrix only when there is a parent

Julien Duroure noreply at git.blender.org
Thu Feb 25 19:15:22 CET 2021


Commit: 8adb0dce852d84bfe1f9e81399681fa615b5aa8e
Author: Julien Duroure
Date:   Thu Feb 25 19:14:46 2021 +0100
Branches: master
https://developer.blender.org/rBA8adb0dce852d84bfe1f9e81399681fa615b5aa8e

glTF exporter: Inverse matrix only when there is a parent

===================================================================

M	io_scene_gltf2/__init__.py
M	io_scene_gltf2/blender/exp/gltf2_blender_gather_animation_samplers.py

===================================================================

diff --git a/io_scene_gltf2/__init__.py b/io_scene_gltf2/__init__.py
index 838dab78..e4605e31 100755
--- a/io_scene_gltf2/__init__.py
+++ b/io_scene_gltf2/__init__.py
@@ -15,7 +15,7 @@
 bl_info = {
     'name': 'glTF 2.0 format',
     'author': 'Julien Duroure, Scurest, Norbert Nopper, Urs Hanselmann, Moritz Becher, Benjamin Schmithüsen, Jim Eckerlein, and many external contributors',
-    "version": (1, 6, 6),
+    "version": (1, 6, 7),
     'blender': (2, 91, 0),
     'location': 'File > Import-Export',
     'description': 'Import-Export as glTF 2.0',
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,



More information about the Bf-extensions-cvs mailing list