[Bf-extensions-cvs] [5fdd91c0] master: glTF importer: Fix handle tangent when BEZIER interpolation
Julien Duroure
noreply at git.blender.org
Sun Apr 14 08:41:56 CEST 2019
Commit: 5fdd91c09edf7c5a4794a3de4fbb1a7603d609f0
Author: Julien Duroure
Date: Sun Apr 14 08:40:31 2019 +0200
Branches: master
https://developer.blender.org/rBA5fdd91c09edf7c5a4794a3de4fbb1a7603d609f0
glTF importer: Fix handle tangent when BEZIER interpolation
Note that tangents are not managed from gltf file yet, but now handle AUTO are correct
===================================================================
M io_scene_gltf2/blender/imp/gltf2_blender_animation_bone.py
M io_scene_gltf2/blender/imp/gltf2_blender_animation_node.py
===================================================================
diff --git a/io_scene_gltf2/blender/imp/gltf2_blender_animation_bone.py b/io_scene_gltf2/blender/imp/gltf2_blender_animation_bone.py
index c568db22..f5fbd7b9 100755
--- a/io_scene_gltf2/blender/imp/gltf2_blender_animation_bone.py
+++ b/io_scene_gltf2/blender/imp/gltf2_blender_animation_bone.py
@@ -34,6 +34,8 @@ class BlenderBoneAnim():
kf.interpolation = 'CONSTANT'
elif interpolation == "CUBICSPLINE":
kf.interpolation = 'BEZIER'
+ kf.handle_right_type = 'AUTO'
+ kf.handle_left_type = 'AUTO'
else:
kf.interpolation = 'LINEAR'
@@ -205,6 +207,7 @@ class BlenderBoneAnim():
# Setting interpolation
for kf in fcurve.keyframe_points:
BlenderBoneAnim.set_interpolation(interpolation, kf)
+ fcurve.update() # force updating tangents (this may change when tangent will be managed)
@staticmethod
def anim(gltf, anim_idx, node_idx):
diff --git a/io_scene_gltf2/blender/imp/gltf2_blender_animation_node.py b/io_scene_gltf2/blender/imp/gltf2_blender_animation_node.py
index 0be98a06..4cb66299 100755
--- a/io_scene_gltf2/blender/imp/gltf2_blender_animation_node.py
+++ b/io_scene_gltf2/blender/imp/gltf2_blender_animation_node.py
@@ -34,6 +34,8 @@ class BlenderNodeAnim():
kf.interpolation = 'CONSTANT'
elif interpolation == "CUBICSPLINE":
kf.interpolation = 'BEZIER'
+ kf.handle_right_type = 'AUTO'
+ kf.handle_left_type = 'AUTO'
else:
kf.interpolation = 'LINEAR'
@@ -128,6 +130,7 @@ class BlenderNodeAnim():
# Setting interpolation
for kf in fcurve.keyframe_points:
BlenderNodeAnim.set_interpolation(animation.samplers[channel.sampler].interpolation, kf)
+ fcurve.update() # force updating tangents (this may change when tangent will be managed)
elif channel.target.path == 'weights':
More information about the Bf-extensions-cvs
mailing list