diff --git a/blender/avatar_main_output.py b/blender/avatar_main_output.py index 89a12af..51192b9 100644 --- a/blender/avatar_main_output.py +++ b/blender/avatar_main_output.py @@ -70,6 +70,6 @@ class AvatarMainOutput(blender_node.ObjectOps): ) import global_bpy - global_bpy.reset_bpy() + global_bpy.set_should_reset_scene(True) return {"ui": {"gltfFilename": {filepath.replace(f"{self.output_dir}/", "")}, "SHAPE_FLOW": {SHAPE_FLOW}, "auto_save": {'true' if auto_save else 'false'},}} diff --git a/global_bpy.py b/global_bpy.py index b24cd60..0723120 100644 --- a/global_bpy.py +++ b/global_bpy.py @@ -1,9 +1,19 @@ import bpy + global_bpy = bpy +should_reset_scene = True + + +def set_should_reset_scene(value): + global should_reset_scene + should_reset_scene = value def get_bpy(): - global global_bpy + global global_bpy, should_reset_scene + if should_reset_scene: + reset_bpy() + should_reset_scene = False return global_bpy