import bpy from . import fn ## not used, replaced by "setup_layers.py" class GPEXP_OT_check_render_scene(bpy.types.Operator): bl_idname = "gp.check_render_scene" bl_label = "Check render scene" bl_description = "Auto check render scene" bl_options = {"REGISTER"} # , "UNDO" # clear_unused_view_layers : bpy.props.BoolProperty(name="Clear unused view layers", # description="Delete view layer that aren't used in the nodetree anymore", # default=True) @classmethod def poll(cls, context): return True def invoke(self, context, event): return self.execute(context) return context.window_manager.invoke_props_dialog(self) def draw(self, context): layout = self.layout # layout.prop(self, 'clear_unused_view_layers') def execute(self, context): gp_objs = [o for o in context.scene.objects if o.type == 'GPENCIL'] # TODO create a list to disaply everything in a message box ? for ob in pool: layers = ob.data.layers for l in layers: used = False if l.mask_layers: print(f'-> masks') state = '' if l.use_mask_layer else ' (disabled)' print(f'{ob.name} > {l.info}{state}:') used = True for ml in l.mask_layers: mlstate = ' (disabled)' if ml.hide else '' mlinvert = ' <>' if ml.invert else '' print(f' - {ml.info}{mlstate}{mlinvert}') if l.opacity != 1: print(f'-> opacity {l.opacity}') used = True if l.use_lights: print(f'-> use lights !') used = True if l.blend_mode != 'REGULAR': print(f'-> blend mode "{l.blend_mode}" !') used = True if used: print() # render = bpy.data.scenes.get('Render') # if not render: # print('SKIP, no Render scene') # return {"CANCELLED"} return {"FINISHED"} classes=( GPEXP_OT_check_render_scene, ) def register(): for cls in classes: bpy.utils.register_class(cls) def unregister(): for cls in reversed(classes): bpy.utils.unregister_class(cls)