cascade file checks

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
main
Pullusb 2022-01-27 18:08:24 +01:00
parent 64efb7e395
commit baa9dbec35
4 changed files with 43 additions and 5 deletions

View File

@ -14,6 +14,11 @@ Activate / deactivate layer opaticty according to prefix
Activate / deactivate all masks using MA layers 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 0.9.4
- feat: `Renumber files on disk` option using number in file outputs (under advanced gp render options) - feat: `Renumber files on disk` option using number in file outputs (under advanced gp render options)

View File

@ -40,7 +40,7 @@ def check_layer_state(pool=None, reports=None):
# mlinvert = ' <>' if ml.invert else '' # mlinvert = ' <>' if ml.invert else ''
# reports.append(f' - {ml.name}{mlstate}{mlinvert}') # 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}') reports.append(f'{ob.name} > {l.info} > opacity {l.opacity}')
# if l.use_lights: # if l.use_lights:
@ -124,9 +124,13 @@ class GPEXP_OT_check_render_scene(bpy.types.Operator):
if not reports: if not reports:
self.report({'INFO'}, 'All OK !') self.report({'INFO'}, 'All OK !')
else: reports.append('Everything Ok !')
fn.show_message_box(_message=reports, _title='Potential Problems list')
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"} return {"FINISHED"}
classes=( classes=(

View File

@ -2,7 +2,7 @@ bl_info = {
"name": "GP Render", "name": "GP Render",
"description": "Organise export of gp layers through compositor output", "description": "Organise export of gp layers through compositor output",
"author": "Samuel Bernou", "author": "Samuel Bernou",
"version": (0, 9, 3), "version": (0, 9, 5),
"blender": (2, 93, 0), "blender": (2, 93, 0),
"location": "View3D", "location": "View3D",
"warning": "", "warning": "",

31
fn.py
View File

@ -835,8 +835,12 @@ def normalize_layer_name(layer, prefix='', desc='', suffix='', lower=True, dash_
print(f' - updated in {ob.name} modifier {m.name}') print(f' - updated in {ob.name} modifier {m.name}')
m.layer = new m.layer = new
## confirm pop-up message: """ # old show message gox without operator support
def show_message_box(_message = "", _title = "Message Box", _icon = 'INFO'): 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): def draw(self, context):
for l in _message: for l in _message:
if isinstance(l, str): if isinstance(l, str):
@ -847,6 +851,31 @@ def show_message_box(_message = "", _title = "Message Box", _icon = 'INFO'):
if isinstance(_message, str): if isinstance(_message, str):
_message = [_message] _message = [_message]
bpy.context.window_manager.popup_menu(draw, title = _title, icon = _icon) 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): def get_bbox_3d(ob):