From 32db18448007c0484474d8d2b670dbb47356959f Mon Sep 17 00:00:00 2001 From: Psycrow Date: Sat, 16 Oct 2021 15:14:06 +0300 Subject: [PATCH] Fixed import of skeletal animation from file without mesh data --- src/importer.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/importer.py b/src/importer.py index 5f3e0fd..8c9d67c 100644 --- a/src/importer.py +++ b/src/importer.py @@ -301,11 +301,12 @@ def import_model(model, options): armature_object.animation_data_create() - for obj in armature_object.children: - obj.shape_key_add(name="neutral_pose", from_mix=False) - # we'll animate using mesh.shape_keys.eval_time - mesh.shape_keys.animation_data_create() - mesh.shape_keys.use_relative = False + if options.should_import_vertex_animations: + for obj in armature_object.children: + obj.shape_key_add(name="neutral_pose", from_mix=False) + # we'll animate using mesh.shape_keys.eval_time + mesh.shape_keys.animation_data_create() + mesh.shape_keys.use_relative = False actions = [] md_actions = [] @@ -411,8 +412,9 @@ def recursively_apply_transform(nodes, node_index, pose_bones, parent_matrix): md_actions.append(md_action) # Add our actions to animation data - armature_object.animation_data.action = actions[0] - if options.should_import_vertex_animations: + if actions: + armature_object.animation_data.action = actions[0] + if md_actions: mesh.shape_keys.animation_data.action = md_actions[0] ''' Vertex Animations '''