diff --git a/src/io_scene_vrm/exporter/abstract_base_vrm_exporter.py b/src/io_scene_vrm/exporter/abstract_base_vrm_exporter.py index 8ed2d8330..04d394c05 100644 --- a/src/io_scene_vrm/exporter/abstract_base_vrm_exporter.py +++ b/src/io_scene_vrm/exporter/abstract_base_vrm_exporter.py @@ -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,