Add more default prefix for mask layer exclusion
1.8.3 - changed: for layer with 0 opacity, do not send to render and keep opacity - removed: `GP` prefix exclusion to send GP to render - added: more default prefix exclusion for _layer to render_ and _skip opacity reset_ (`MASK, mask, MSK, msk`)main
parent
2f8efed73b
commit
ea0561e14e
|
@ -14,6 +14,13 @@ Activate / deactivate layer opacity according to prefix
|
||||||
Activate / deactivate all masks using MA layers
|
Activate / deactivate all masks using MA layers
|
||||||
-->
|
-->
|
||||||
|
|
||||||
|
1.8.3
|
||||||
|
|
||||||
|
- changed: for layer with 0 opacity, do not send to render and keep opacity
|
||||||
|
- removed: `GP` prefix exclusion to send GP to render
|
||||||
|
- added: more default prefix exclusion for _layer to render_ and _skip opacity reset_ (`MASK, mask, MSK, msk`)
|
||||||
|
- added: option to restore layer state from json (commit by Christophe.S)
|
||||||
|
|
||||||
1.8.2
|
1.8.2
|
||||||
|
|
||||||
- added: `Reset Layer State` (Check layer) in Autobuild
|
- added: `Reset Layer State` (Check layer) in Autobuild
|
||||||
|
|
|
@ -77,7 +77,7 @@ class GPEXP_OT_render_auto_build(bpy.types.Operator):
|
||||||
description='Set single user on all objects GP data')
|
description='Set single user on all objects GP data')
|
||||||
|
|
||||||
excluded_prefix : StringProperty(
|
excluded_prefix : StringProperty(
|
||||||
name='Excluded Layer By Prefix', default='GP, RG, PO, MA',
|
name='Excluded Layer By Prefix', default='RG, PO, MA, MASK, mask, MSK, msk',
|
||||||
description='Exclude layer to send to render by prefix (comma separated list)')
|
description='Exclude layer to send to render by prefix (comma separated list)')
|
||||||
|
|
||||||
clean_name_and_visibility : BoolProperty(name='Clean Name And Visibility', default=True,
|
clean_name_and_visibility : BoolProperty(name='Clean Name And Visibility', default=True,
|
||||||
|
@ -196,7 +196,7 @@ class GPEXP_OT_render_auto_build(bpy.types.Operator):
|
||||||
|
|
||||||
all_gp_objects = [o for o in context.scene.objects if o.type == 'GPENCIL']
|
all_gp_objects = [o for o in context.scene.objects if o.type == 'GPENCIL']
|
||||||
|
|
||||||
## clean name and visibility
|
## Clean name and visibility
|
||||||
if self.clean_name_and_visibility:
|
if self.clean_name_and_visibility:
|
||||||
for o in all_gp_objects:
|
for o in all_gp_objects:
|
||||||
if o.hide_render:
|
if o.hide_render:
|
||||||
|
@ -208,10 +208,10 @@ class GPEXP_OT_render_auto_build(bpy.types.Operator):
|
||||||
l.info = l.info + o.name.lower()
|
l.info = l.info + o.name.lower()
|
||||||
|
|
||||||
## Make used prefix visible ?? (maybe some layer were intentionally hidden...)
|
## Make used prefix visible ?? (maybe some layer were intentionally hidden...)
|
||||||
if (res := re.search(r'^([A-Z]{2})_', l.info)):
|
# if (res := re.search(r'^([A-Z]{2})_', l.info)):
|
||||||
if res.group(1) in prefix_to_render and l.hide == True and not 'invisible' in l.info:
|
# if res.group(1) in prefix_to_render and l.hide == True and not 'invisible' in l.info:
|
||||||
print(f'{o.name} -> {l.info} : Switch visibility On')
|
# print(f'{o.name} -> {l.info} : Switch visibility On')
|
||||||
l.hide = False
|
# l.hide = False
|
||||||
|
|
||||||
if self.clean_material_duplication:
|
if self.clean_material_duplication:
|
||||||
print('Clean material duplicates')
|
print('Clean material duplicates')
|
||||||
|
|
|
@ -223,7 +223,7 @@ class GPEXP_OT_layers_state(bpy.types.Operator):
|
||||||
\nAffect all layers)') # , options={'SKIP_SAVE'}
|
\nAffect all layers)') # , options={'SKIP_SAVE'}
|
||||||
|
|
||||||
opacity_exclude_list : StringProperty(name='Skip',
|
opacity_exclude_list : StringProperty(name='Skip',
|
||||||
default='MA', description='Skip prefixes from this list when changing opacity\
|
default='MA, MASK, mask, MSK, msk', description='Skip prefixes from this list when changing opacity\
|
||||||
\nSeparate multiple value with a comma (ex: MAIN)') # , options={'SKIP_SAVE'}
|
\nSeparate multiple value with a comma (ex: MAIN)') # , options={'SKIP_SAVE'}
|
||||||
|
|
||||||
hide_invisible_materials : BoolProperty(name='Hide Materials named invisible',
|
hide_invisible_materials : BoolProperty(name='Hide Materials named invisible',
|
||||||
|
@ -297,11 +297,15 @@ class GPEXP_OT_layers_state(bpy.types.Operator):
|
||||||
|
|
||||||
|
|
||||||
if l.opacity != 1:
|
if l.opacity != 1:
|
||||||
# TODO Skip zeroed opacity ?
|
if l.opacity == 0:
|
||||||
# check if there is an exclusion word
|
## Skip layer with zero opacity
|
||||||
if any(x.strip() + '_' in l.info for x in self.opacity_exclude_list.strip(',').split(',') if x):
|
print(f'Skipped layer opacity reset (0 opacity) : {l.info}')
|
||||||
print(f'Skipped layer : {l.info}')
|
|
||||||
|
elif any(x.strip() + '_' in l.info for x in self.opacity_exclude_list.strip(',').split(',') if x):
|
||||||
|
# Skip layer if name has exclusion prefix
|
||||||
|
print(f'Skipped layer opacity reset (prefix in exclusion list) : {l.info}')
|
||||||
else:
|
else:
|
||||||
|
## Set full opacity
|
||||||
full_opacity_state = '' if self.set_full_opacity else ' (check only)'
|
full_opacity_state = '' if self.set_full_opacity else ' (check only)'
|
||||||
mess = f'{l.info} : opacity {l.opacity:.2f} >> 1.0{full_opacity_state}'
|
mess = f'{l.info} : opacity {l.opacity:.2f} >> 1.0{full_opacity_state}'
|
||||||
print(mess)
|
print(mess)
|
||||||
|
@ -341,7 +345,7 @@ class GPEXP_OT_layers_state(bpy.types.Operator):
|
||||||
if changes:
|
if changes:
|
||||||
changes.append('')
|
changes.append('')
|
||||||
|
|
||||||
## disable multiframe editing on all GP (can cause artifacts on render)
|
## Disable multiframe editing on all GP (can cause artifacts on render)
|
||||||
gp_mu_edit_ct = 0
|
gp_mu_edit_ct = 0
|
||||||
for gp in bpy.data.grease_pencils:
|
for gp in bpy.data.grease_pencils:
|
||||||
if gp.use_multiedit:
|
if gp.use_multiedit:
|
||||||
|
|
|
@ -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": (1, 8, 2),
|
"version": (1, 8, 3),
|
||||||
"blender": (3, 0, 0),
|
"blender": (3, 0, 0),
|
||||||
"location": "View3D",
|
"location": "View3D",
|
||||||
"warning": "",
|
"warning": "",
|
||||||
|
|
|
@ -518,9 +518,10 @@ def export_gp_objects(oblist, exclude_list=[], scene=None, node_scene=None, base
|
||||||
for l in ob.data.layers:
|
for l in ob.data.layers:
|
||||||
# if l.hide:
|
# if l.hide:
|
||||||
# continue
|
# continue
|
||||||
if l.hide or any(x + '_' in l.info for x in exclude_list): # exclude hided ?
|
if l.hide or l.opacity == 0 or any(x + '_' in l.info for x in exclude_list):
|
||||||
print(f'Exclude export: {ob.name} : {l.info}')
|
print(f'Exclude export: {ob.name} : {l.info}')
|
||||||
l.viewlayer_render = fn.get_view_layer('exclude', scene=scene).name # assign "exclude"
|
# Assign "exclude" layer
|
||||||
|
l.viewlayer_render = fn.get_view_layer('exclude', scene=scene).name
|
||||||
continue
|
continue
|
||||||
|
|
||||||
get_set_viewlayer_from_gp(ob, l, scene=scene, node_scene=node_scene,
|
get_set_viewlayer_from_gp(ob, l, scene=scene, node_scene=node_scene,
|
||||||
|
|
Loading…
Reference in New Issue