Add pattern for layer group merge and check layer in autobuild
1.8.1 - added: `Reset Layer State` (Check layer) in Autobuild - added: environment variable `GP_RENDER_LAYER_GROUP_PATTERN` for layer merging regex patternmain
parent
fe3f0ae869
commit
aefc84fd7a
|
@ -14,6 +14,11 @@ Activate / deactivate layer opacity according to prefix
|
||||||
Activate / deactivate all masks using MA layers
|
Activate / deactivate all masks using MA layers
|
||||||
-->
|
-->
|
||||||
|
|
||||||
|
1.8.1
|
||||||
|
|
||||||
|
- added: `Reset Layer State` (Check layer) in Autobuild
|
||||||
|
- added: environment variable `GP_RENDER_LAYER_GROUP_PATTERN` for layer merging regex pattern
|
||||||
|
|
||||||
1.8.0
|
1.8.0
|
||||||
|
|
||||||
- added: Allow to rename output on the fly using `connect selection to output`
|
- added: Allow to rename output on the fly using `connect selection to output`
|
||||||
|
|
|
@ -88,7 +88,7 @@ class GPEXP_OT_render_auto_build(bpy.types.Operator):
|
||||||
description='Clean material stack. i.e: Replace "mat.001" in material stack if "mat" exists and has same color')
|
description='Clean material stack. i.e: Replace "mat.001" in material stack if "mat" exists and has same color')
|
||||||
|
|
||||||
prefix_filter : StringProperty(name='Prefix Filter', default='CO, CU, FX, TO', # , MA # exclude MA if mask are applied
|
prefix_filter : StringProperty(name='Prefix Filter', default='CO, CU, FX, TO', # , MA # exclude MA if mask are applied
|
||||||
description='Comma separated prefix to render. Set the other prefix and non-prefixed layer to exluded viewlayer')
|
description='Comma separated prefix to render, Layer with those prefix will be made visible')
|
||||||
|
|
||||||
set_layers_colors : BoolProperty(name='Set Layers Colors', default=True,
|
set_layers_colors : BoolProperty(name='Set Layers Colors', default=True,
|
||||||
description='Set colors for on layers according to prefix (hadrcoded color set)')
|
description='Set colors for on layers according to prefix (hadrcoded color set)')
|
||||||
|
@ -102,6 +102,9 @@ class GPEXP_OT_render_auto_build(bpy.types.Operator):
|
||||||
export_layer_infos : BoolProperty(name='Export Layer Infos', default=True,
|
export_layer_infos : BoolProperty(name='Export Layer Infos', default=True,
|
||||||
description='Export layers infos to a Json file')
|
description='Export layers infos to a Json file')
|
||||||
|
|
||||||
|
reset_layers_state : BoolProperty(name='Reset Layer State', default=True,
|
||||||
|
description='Set layer opacity to 100%, Disable use light on all layer, set regular blend mode, hide invisible')
|
||||||
|
|
||||||
group_all_adjacent_layer_type : BoolProperty(name='Group All Adjacent Layer Type', default=False,
|
group_all_adjacent_layer_type : BoolProperty(name='Group All Adjacent Layer Type', default=False,
|
||||||
description='Fuse output Viewlayer according to adjacent Prefix in layer stack')
|
description='Fuse output Viewlayer according to adjacent Prefix in layer stack')
|
||||||
|
|
||||||
|
@ -150,6 +153,7 @@ class GPEXP_OT_render_auto_build(bpy.types.Operator):
|
||||||
col.prop(self, 'trigger_rename_lowercase')
|
col.prop(self, 'trigger_rename_lowercase')
|
||||||
col.prop(self, 'trigger_renumber_by_distance')
|
col.prop(self, 'trigger_renumber_by_distance')
|
||||||
col.prop(self, 'export_layer_infos')
|
col.prop(self, 'export_layer_infos')
|
||||||
|
col.prop(self, 'reset_layers_state')
|
||||||
|
|
||||||
col.label(text='Send prefixed layer to render scene (except excluded)')
|
col.label(text='Send prefixed layer to render scene (except excluded)')
|
||||||
col.prop(self, 'excluded_prefix', text='Excluded')
|
col.prop(self, 'excluded_prefix', text='Excluded')
|
||||||
|
@ -246,6 +250,10 @@ class GPEXP_OT_render_auto_build(bpy.types.Operator):
|
||||||
print('Export layer infos (skip if json already exists)')
|
print('Export layer infos (skip if json already exists)')
|
||||||
bpy.ops.gp.export_infos_for_compo('INVOKE_DEFAULT', skip_check=True)
|
bpy.ops.gp.export_infos_for_compo('INVOKE_DEFAULT', skip_check=True)
|
||||||
|
|
||||||
|
## Reset layer states -> 100% opacity (except mask layer 'MA' by default), remove use light, set default blend mode, hide material named "invisible".
|
||||||
|
if self.reset_layers_state:
|
||||||
|
bpy.ops.gp.layers_state()
|
||||||
|
|
||||||
## Set GP object data to single user (Individual viewlayers)
|
## Set GP object data to single user (Individual viewlayers)
|
||||||
if self.make_gp_single_user:
|
if self.make_gp_single_user:
|
||||||
for o in ob_list:
|
for o in ob_list:
|
||||||
|
|
|
@ -6,6 +6,8 @@ Organise export of gp layers through compositor output
|
||||||
|
|
||||||
`FILE_FORMAT` : Define file_format used for output. If not specified, use `OPEN_EXR_MULTILAYER` (set `OPEN_EXR` for separate sequences)
|
`FILE_FORMAT` : Define file_format used for output. If not specified, use `OPEN_EXR_MULTILAYER` (set `OPEN_EXR` for separate sequences)
|
||||||
|
|
||||||
|
`GP_RENDER_MERGE_PATTERN` : Regex pattern for GP layer group merge. If not specified, pattern is `^([A-Z]{2})_` to match gp_toolbox two-capital-letter prefix system)
|
||||||
|
|
||||||
|
|
||||||
### Notable operator arguments for automatisation
|
### Notable operator arguments for automatisation
|
||||||
|
|
||||||
|
|
|
@ -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, 0),
|
"version": (1, 8, 1),
|
||||||
"blender": (3, 0, 0),
|
"blender": (3, 0, 0),
|
||||||
"location": "View3D",
|
"location": "View3D",
|
||||||
"warning": "",
|
"warning": "",
|
||||||
|
|
9
fn.py
9
fn.py
|
@ -1,13 +1,14 @@
|
||||||
from typing import Coroutine
|
|
||||||
import bpy
|
import bpy
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
|
import json
|
||||||
|
|
||||||
from mathutils import Vector
|
from mathutils import Vector
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
from itertools import groupby
|
||||||
from math import isclose
|
from math import isclose
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
from time import time
|
from time import time
|
||||||
import json
|
|
||||||
|
|
||||||
from . constant import RD_SCENE_NAME
|
from . constant import RD_SCENE_NAME
|
||||||
|
|
||||||
|
@ -579,8 +580,8 @@ def group_adjacent_layer_prefix_rlayer(ob, excluded_prefix=[], first_name=True):
|
||||||
:first_name: Keep the viewlayer of the bottom layer in group, else last
|
:first_name: Keep the viewlayer of the bottom layer in group, else last
|
||||||
'''
|
'''
|
||||||
|
|
||||||
from itertools import groupby
|
pattern = os.environ.get('GP_RENDER_MERGE_PATTERN', r'^([A-Z]{2})_')
|
||||||
re_prefix = re.compile(r'^([A-Z]{2})_')
|
re_prefix = re.compile(pattern)
|
||||||
|
|
||||||
if isinstance(excluded_prefix, str):
|
if isinstance(excluded_prefix, str):
|
||||||
excluded_prefix = [p.strip() for p in excluded_prefix.split(',')]
|
excluded_prefix = [p.strip() for p in excluded_prefix.split(',')]
|
||||||
|
|
Loading…
Reference in New Issue