diff --git a/OP_setup_layers.py b/OP_setup_layers.py index a1d4ca1..fbe0b11 100644 --- a/OP_setup_layers.py +++ b/OP_setup_layers.py @@ -184,10 +184,16 @@ class GPEXP_OT_layers_state(bpy.types.Operator): default=True, description='Check/Set blend mode to regular') # , options={'SKIP_SAVE'} clear_frame_out_of_range : BoolProperty(name='Clear Frames Out Of Scene Range', - default=False, description='Delete frames that before scene start and after scene end range\nWith a tolerance of one frame to avoid problem\nAffect all layers)') # , options={'SKIP_SAVE'} + default=False, description='Delete frames that before scene start and after scene end range\ + \nWith a tolerance of one frame to avoid problem\ + \nAffect all layers)') # , options={'SKIP_SAVE'} opacity_exclude_list : StringProperty(name='Skip', - default='MA', description='Skip prefixes from this list when changing opacity\nSeparate multiple value with a comma (ex: MA,IN)') # , options={'SKIP_SAVE'} + default='MA', description='Skip prefixes from this list when changing opacity\ + \nSeparate multiple value with a comma (ex: MAIN)') # , options={'SKIP_SAVE'} + + hide_invisible_materials : BoolProperty(name='Hide Materials named invisible', + default=True, description='Hide material with name starting with "invisible"') # , options={'SKIP_SAVE'} @classmethod @@ -222,6 +228,7 @@ class GPEXP_OT_layers_state(bpy.types.Operator): row.prop(self, 'opacity_exclude_list') layout.prop(self, 'set_use_lights') layout.prop(self, 'set_blend_mode') + layout.prop(self, 'hide_invisible_materials') # layout.prop(self, 'clear_unused_view_layers') def execute(self, context): @@ -312,6 +319,14 @@ class GPEXP_OT_layers_state(bpy.types.Operator): if gp_mu_edit_ct: changes.append(f'{gp_mu_edit_ct} multiframe-edit mode disabled') + ## Hide invisible named materials + if self.hide_invisible_materials: + for m in bpy.data.materials: + if m.is_grease_pencil and m.name.lower().startswith('invisible'): + if not m.grease_pencil.hide: + print(f'Hiding gp material {m.name}') + m.grease_pencil.hide = True + changes.append(f'{m.name} material hidden') fn.show_message_box(_message=changes, _title="Layers Check Report", _icon='INFO')