[Bf-extensions-cvs] [2f94a95d] master: glTF importer: fix morph anim import when bezier interpolation
Julien Duroure
noreply at git.blender.org
Sun Jun 2 04:20:07 CEST 2019
Commit: 2f94a95d8775ca3950b026feed0015503d511e38
Author: Julien Duroure
Date: Sun Jun 2 03:28:25 2019 +0200
Branches: master
https://developer.blender.org/rBA2f94a95d8775ca3950b026feed0015503d511e38
glTF importer: fix morph anim import when bezier interpolation
===================================================================
M io_scene_gltf2/__init__.py
M io_scene_gltf2/blender/imp/gltf2_blender_animation_node.py
===================================================================
diff --git a/io_scene_gltf2/__init__.py b/io_scene_gltf2/__init__.py
index fdf25c39..3800c7ab 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, 19),
+ "version": (0, 9, 20),
'blender': (2, 80, 0),
'location': 'File > Import-Export',
'description': 'Import-Export as glTF 2.0',
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 a1a23cca..5cdfe6c2 100755
--- a/io_scene_gltf2/blender/imp/gltf2_blender_animation_node.py
+++ b/io_scene_gltf2/blender/imp/gltf2_blender_animation_node.py
@@ -172,10 +172,17 @@ class BlenderNodeAnim():
if len(prim.targets) > nb_targets:
nb_targets = len(prim.targets)
+ if animation.samplers[channel.sampler].interpolation == "CUBICSPLINE":
+ factor = 3
+ delta = len(keys)
+ else:
+ factor = 1
+ delta = 0
+
for idx, key in enumerate(keys):
for sk in range(nb_targets):
if gltf.shapekeys[sk] is not None: # Do not animate shapekeys not created
- obj.data.shape_keys.key_blocks[gltf.shapekeys[sk]].value = values[idx * nb_targets + sk][0]
+ obj.data.shape_keys.key_blocks[gltf.shapekeys[sk]].value = values[factor * idx * nb_targets + delta + sk][0]
obj.data.shape_keys.key_blocks[gltf.shapekeys[sk]].keyframe_insert(
"value",
frame=key[0] * fps,
More information about the Bf-extensions-cvs
mailing list