diff options
author | Julien Duroure <julien.duroure@gmail.com> | 2019-06-02 04:28:25 +0300 |
---|---|---|
committer | Julien Duroure <julien.duroure@gmail.com> | 2019-06-02 04:28:25 +0300 |
commit | 2f94a95d8775ca3950b026feed0015503d511e38 (patch) | |
tree | 908bb65dc533ecb652f05367f5c5f99656021327 /io_scene_gltf2/blender | |
parent | e2cfe666ad05e9d08d1a24e27d558c9a5a96749d (diff) |
glTF importer: fix morph anim import when bezier interpolation
Diffstat (limited to 'io_scene_gltf2/blender')
-rwxr-xr-x | io_scene_gltf2/blender/imp/gltf2_blender_animation_node.py | 9 |
1 files changed, 8 insertions, 1 deletions
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, |