Skip to content

Commit

Permalink
fix: clear expression preview on export
Browse files Browse the repository at this point in the history
  • Loading branch information
saturday06 committed Jun 3, 2024
1 parent 7f29f31 commit 850bf7b
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions src/io_scene_vrm/exporter/abstract_base_vrm_exporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,18 +167,36 @@ def clear_blend_shape_proxy_previews(
self, armature_data: Armature
) -> Iterator[None]:
ext = armature_data.vrm_addon_extension
saved_previews = []

saved_vrm0_previews: list[float] = []
for blend_shape_group in ext.vrm0.blend_shape_master.blend_shape_groups:
saved_previews.append(blend_shape_group.preview)
saved_vrm0_previews.append(blend_shape_group.preview)
blend_shape_group.preview = 0

saved_vrm1_previews: dict[str, float] = {}
for (
name,
expression,
) in ext.vrm1.expressions.all_name_to_expression_dict().items():
saved_vrm1_previews[name] = expression.preview
expression.preview = 0

try:
yield
finally:
for blend_shape_group, blend_shape_preview in zip(
ext.vrm0.blend_shape_master.blend_shape_groups, saved_previews
ext.vrm0.blend_shape_master.blend_shape_groups, saved_vrm0_previews
):
blend_shape_group.preview = blend_shape_preview

for (
name,
expression,
) in ext.vrm1.expressions.all_name_to_expression_dict().items():
expression_preview = saved_vrm1_previews.get(name)
if expression_preview is not None:
expression.preview = expression_preview

@staticmethod
def enter_hide_mtoon1_outline_geometry_nodes(
context: Context,
Expand Down

0 comments on commit 850bf7b

Please sign in to comment.