Skip to content

Commit

Permalink
Sad hack to fix exporting strangely neutral posed models
Browse files Browse the repository at this point in the history
  • Loading branch information
Five-Damned-Dollarz committed Mar 25, 2021
1 parent f69461c commit e316b93
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,8 @@ def from_armature(armature_object):

dependency_graph = bpy.context.evaluated_depsgraph_get()

modifiers[0].show_viewport = False # this is necessary to keep the mesh in neutral pose while we get the vertex movements; I hope there's a better way I haven't found yet

# 0 or 1 shape keys means there is no vertex animation to export, skip it!
if mesh.shape_keys and len(mesh.shape_keys.key_blocks) > 1:
for animation in model.animations:
Expand Down Expand Up @@ -398,6 +400,8 @@ def from_armature(armature_object):

animation.vertex_deformations[node].extend(raw_vertices)

modifiers[0].show_viewport = True # re-enable the modifier

for node in model.nodes:
# remove dupes, and count final
node.md_vert_list = list(dict.fromkeys(node.md_vert_list))
Expand Down

0 comments on commit e316b93

Please sign in to comment.