From 734714be09fc645af1c41e665869426faad5b9d2 Mon Sep 17 00:00:00 2001 From: pullusb Date: Wed, 4 Sep 2024 17:38:00 +0200 Subject: [PATCH] add a no_popup arg in check layer for autobuild background mode --- OP_auto_build.py | 2 +- OP_setup_layers.py | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/OP_auto_build.py b/OP_auto_build.py index b6c6444..206e0e0 100644 --- a/OP_auto_build.py +++ b/OP_auto_build.py @@ -255,7 +255,7 @@ class GPEXP_OT_render_auto_build(bpy.types.Operator): ## Reset layer states -> 100% opacity (except mask layer 'MA' by default), remove use light, set default blend mode, hide material named "invisible". if self.reset_layers_state: - bpy.ops.gp.layers_state('EXEC_DEFAULT') + bpy.ops.gp.layers_state('EXEC_DEFAULT', no_popup=True) ## Set GP object data to single user (Individual viewlayers) if self.make_gp_single_user: diff --git a/OP_setup_layers.py b/OP_setup_layers.py index 20a7b2e..2b190cc 100644 --- a/OP_setup_layers.py +++ b/OP_setup_layers.py @@ -171,6 +171,9 @@ class GPEXP_OT_layers_state(bpy.types.Operator): # description="Delete view layer that aren't used in the nodetree anymore", # default=True) + no_popup : BoolProperty(name='No Popup', + default=False, description='To use for call in CLI or from other operators', options={'SKIP_SAVE'}) + all_objects : BoolProperty(name='On All Object', default=True, description='On All object, else use selected objects') # , options={'SKIP_SAVE'} @@ -200,13 +203,13 @@ class GPEXP_OT_layers_state(bpy.types.Operator): # return context.object def invoke(self, context, event): - ## if no existing infos.json generated, call ops l_infos = Path(bpy.data.filepath).parent / 'render' / 'infos.json' if not l_infos.exists(): # only if infos not created bpy.ops.gp.export_infos_for_compo('INVOKE_DEFAULT') - # return self.execute(context) + if self.no_popup: + return self.execute(context) return context.window_manager.invoke_props_dialog(self) def draw(self, context): @@ -327,7 +330,8 @@ class GPEXP_OT_layers_state(bpy.types.Operator): m.grease_pencil.hide = True changes.append(f'{m.name} material hidden') - fn.show_message_box(_message=changes, _title="Layers Check Report", _icon='INFO') + if not self.no_popup: + fn.show_message_box(_message=changes, _title="Layers Check Report", _icon='INFO') return {"FINISHED"}