diff options
Diffstat (limited to 'io_scene_gltf2/blender/imp/gltf2_blender_animation_node.py')
-rwxr-xr-x | io_scene_gltf2/blender/imp/gltf2_blender_animation_node.py | 13 |
1 files changed, 7 insertions, 6 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 d8aa33a7..0be98a06 100755 --- a/io_scene_gltf2/blender/imp/gltf2_blender_animation_node.py +++ b/io_scene_gltf2/blender/imp/gltf2_blender_animation_node.py @@ -140,12 +140,13 @@ class BlenderNodeAnim(): for idx, key in enumerate(keys): for sk in range(nb_targets): - obj.data.shape_keys.key_blocks[sk + 1].value = values[idx * nb_targets + sk][0] - obj.data.shape_keys.key_blocks[sk + 1].keyframe_insert( - "value", - frame=key[0] * fps, - group='ShapeKeys' - ) + 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]].keyframe_insert( + "value", + frame=key[0] * fps, + group='ShapeKeys' + ) if action.name not in gltf.current_animation_names.keys(): gltf.current_animation_names[name] = action.name |