add a no_popup arg in check layer for autobuild background mode

main
pullusb 2024-09-04 17:38:00 +02:00
parent 747638eca9
commit 734714be09
2 changed files with 8 additions and 4 deletions

View File

@ -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:

View File

@ -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,6 +330,7 @@ class GPEXP_OT_layers_state(bpy.types.Operator):
m.grease_pencil.hide = True
changes.append(f'{m.name} material hidden')
if not self.no_popup:
fn.show_message_box(_message=changes, _title="Layers Check Report", _icon='INFO')
return {"FINISHED"}