[Bf-extensions-cvs] [0f85dace] master: glTF exporter: Fix first and last tangent data for bezier interpolation

Julien Duroure noreply at git.blender.org
Sat Aug 3 09:02:52 CEST 2019


Commit: 0f85dace7664738c931b2329355308fab4917f28
Author: Julien Duroure
Date:   Sat Aug 3 09:02:27 2019 +0200
Branches: master
https://developer.blender.org/rBA0f85dace7664738c931b2329355308fab4917f28

glTF exporter: Fix first and last tangent data for bezier interpolation

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

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

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

diff --git a/io_scene_gltf2/__init__.py b/io_scene_gltf2/__init__.py
index 8d849b63..321d7a69 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, Norbert Nopper, Urs Hanselmann, Moritz Becher, Benjamin Schmithüsen, Jim Eckerlein, and many external contributors',
-    "version": (0, 9, 38),
+    "version": (0, 9, 39),
     'blender': (2, 80, 0),
     'location': 'File > Import-Export',
     'description': 'Import-Export as glTF 2.0',
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 32656936..a24b2298 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
@@ -80,6 +80,12 @@ class Keyframe:
     def set_value_index(self, idx, val):
         self.__value[idx] = val
 
+    def set_first_tangent(self):
+        self.__in_tangent = self.__value
+
+    def set_last_tangent(self):
+        self.__out_tangent = self.__value
+
     @property
     def value(self) -> typing.Union[mathutils.Vector, mathutils.Euler, mathutils.Quaternion, typing.List[float]]:
         return self.__value
@@ -188,7 +194,7 @@ def gather_keyframes(blender_object_if_armature: typing.Optional[bpy.types.Objec
                 # Construct the in tangent
                 if frame == frames[0]:
                     # start in-tangent should become all zero
-                    key.in_tangent = key.value
+                    key.set_first_tangent()
                 else:
                     # otherwise construct an in tangent coordinate from the keyframes control points. We intermediately
                     # use a point at t-1 to define the tangent. This allows the tangent control point to be transformed
@@ -201,7 +207,7 @@ def gather_keyframes(blender_object_if_armature: typing.Optional[bpy.types.Objec
                 # Construct the out tangent
                 if frame == frames[-1]:
                     # end out-tangent should become all zero
-                    key.out_tangent = key.value
+                    key.set_last_tangent()
                 else:
                     # otherwise construct an in tangent coordinate from the keyframes control points. We intermediately
                     # use a point at t+1 to define the tangent. This allows the tangent control point to be transformed



More information about the Bf-extensions-cvs mailing list