Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulien Duroure <julien.duroure@gmail.com>2019-08-03 10:02:27 +0300
committerJulien Duroure <julien.duroure@gmail.com>2019-08-03 10:02:27 +0300
commit0f85dace7664738c931b2329355308fab4917f28 (patch)
treec7d7f65f953bfa938882119218e38eccd0390ba7 /io_scene_gltf2/blender/exp/gltf2_blender_gather_animation_sampler_keyframes.py
parent1e20236039c8929406cf3d86bddcbfd2df5d9a17 (diff)
glTF exporter: Fix first and last tangent data for bezier interpolation
Diffstat (limited to 'io_scene_gltf2/blender/exp/gltf2_blender_gather_animation_sampler_keyframes.py')
-rwxr-xr-xio_scene_gltf2/blender/exp/gltf2_blender_gather_animation_sampler_keyframes.py10
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 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