diff --git a/CHANGELOG.md b/CHANGELOG.md index a35ee58..b4a8f26 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,11 @@ Activate / deactivate layer opaticty according to prefix Activate / deactivate all masks using MA layers --> +0.9.5 + +- added: `check for problems` button also propose to run GP toolbox's file checker (if addon is enabled) to perform generic file checks +- changed: `check for problems` skip check for opacity on 'MA_' prefixed layers + 0.9.4 - feat: `Renumber files on disk` option using number in file outputs (under advanced gp render options) diff --git a/OP_check_scene.py b/OP_check_scene.py index 2e2ef80..c28e29f 100644 --- a/OP_check_scene.py +++ b/OP_check_scene.py @@ -40,7 +40,7 @@ def check_layer_state(pool=None, reports=None): # mlinvert = ' <>' if ml.invert else '' # reports.append(f' - {ml.name}{mlstate}{mlinvert}') - if l.opacity != 1: + if l.opacity != 1 and not l.info.startswith('MA_'): reports.append(f'{ob.name} > {l.info} > opacity {l.opacity}') # if l.use_lights: @@ -124,9 +124,13 @@ class GPEXP_OT_check_render_scene(bpy.types.Operator): if not reports: self.report({'INFO'}, 'All OK !') - else: - fn.show_message_box(_message=reports, _title='Potential Problems list') + reports.append('Everything Ok !') + if hasattr(bpy.types, 'GP_OT_file_checker'): + # propose to run toolbox checker if exists + reports.append(['gp.file_checker', 'Run GP_toolbox File Checker', 'SCENE_DATA']) + + fn.show_message_box(_message=reports, _title='Potential Problems list') return {"FINISHED"} classes=( diff --git a/__init__.py b/__init__.py index f1557c1..4b10822 100644 --- a/__init__.py +++ b/__init__.py @@ -2,7 +2,7 @@ bl_info = { "name": "GP Render", "description": "Organise export of gp layers through compositor output", "author": "Samuel Bernou", - "version": (0, 9, 3), + "version": (0, 9, 5), "blender": (2, 93, 0), "location": "View3D", "warning": "", diff --git a/fn.py b/fn.py index 9ae0103..c0aac8e 100644 --- a/fn.py +++ b/fn.py @@ -835,8 +835,12 @@ def normalize_layer_name(layer, prefix='', desc='', suffix='', lower=True, dash_ print(f' - updated in {ob.name} modifier {m.name}') m.layer = new -## confirm pop-up message: +""" # old show message gox without operator support def show_message_box(_message = "", _title = "Message Box", _icon = 'INFO'): + '''get a str to display or a list of [str, str] + can have an icon [[str, icon], str, [str, icon]] + ''' + def draw(self, context): for l in _message: if isinstance(l, str): @@ -847,6 +851,31 @@ def show_message_box(_message = "", _title = "Message Box", _icon = 'INFO'): if isinstance(_message, str): _message = [_message] bpy.context.window_manager.popup_menu(draw, title = _title, icon = _icon) + """ + +def show_message_box(_message = "", _title = "Message Box", _icon = 'INFO'): + '''Show message box with element passed as string or list + if _message if a list of lists: + if sublist have 2 element: + considered a label [text,icon] + if sublist have 3 element: + considered as an operator [ops_id_name, text, icon] + ''' + + def draw(self, context): + for l in _message: + if isinstance(l, str): + self.layout.label(text=l) + else: + if len(l) == 2: # label with icon + self.layout.label(text=l[0], icon=l[1]) + elif len(l) == 3: # ops + self.layout.operator_context = "INVOKE_DEFAULT" + self.layout.operator(l[0], text=l[1], icon=l[2], emboss=False) # <- highligh the entry + + if isinstance(_message, str): + _message = [_message] + bpy.context.window_manager.popup_menu(draw, title = _title, icon = _icon) def get_bbox_3d(ob):