Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using shape_keys only when importing vertex animation #29

Merged
merged 1 commit into from
Nov 15, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions src/importer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = []
Expand Down Expand Up @@ -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 '''
Expand Down