Add format customization for splitted tech passes codec (default to ZIP)

This commit is contained in:
pullusb 2025-07-31 11:18:29 +02:00
parent 46d7eeb59c
commit aa4293c7d7
3 changed files with 42 additions and 15 deletions

View File

@ -2,7 +2,7 @@ bl_info = {
"name": "Render Toolbox",
"description": "Setup outputs and perform cheks for rendering",
"author": "Samuel Bernou",
"version": (0, 7, 0),
"version": (0, 8, 0),
"blender": (4, 0, 0),
"location": "View3D",
"warning": "",

11
fn.py
View File

@ -208,7 +208,7 @@ def create_and_connect_file_output(node, outputs, file_out, out_name, base_path,
def connect_to_file_output(node_list, file_out=None, base_path='', excludes=None, remap_names=None,
file_format=None, split_tech_passes=False, template=None):
file_format=None, split_tech_passes=False, tech_file_format=None, template=None):
"""Connect selected nodes output to file output(s)
if a file output is selected, add intputs on it
@ -248,12 +248,13 @@ def connect_to_file_output(node_list, file_out=None, base_path='', excludes=None
excludes = excludes or {}
remap_names = remap_names or {}
if tech_file_format is None:
## Fallback to file format (then customize) is not provided
tech_file_format = file_format.copy() if file_format else None
if tech_file_format:
## TODO: Set to EXR if provioded is not ERX or EXR multilayer ?
# ->> if tech_file_format.get('file_format')) is not in ('OPEN_EXR', 'OPEN_EXR_MULTILAYER'): ...
# Set to EXR if provided is not exr type e.g PNG
if tech_file_format.get('file_format') not in ('OPEN_EXR', 'OPEN_EXR_MULTILAYER'):
tech_file_format['file_format'] = 'OPEN_EXR'
## Force 32 bit
tech_file_format['color_depth'] = '32'

View File

@ -227,6 +227,23 @@ class RT_OT_create_output_layers(bpy.types.Operator):
),
)
tech_exr_codec : EnumProperty(
name='Tech Passes Codec',
default='ZIP',
description='Codec settings for Techpasses OpenEXR (passes are set to 32bit)',
items=(
('PIZ', 'PIZ (lossless)', ''),
('ZIP', 'ZIP (lossless)', ''),
('RLE', 'RLE (lossless)', ''),
('ZIPS', 'ZIPS (lossless)', ''),
# ('PXR24', 'Pxr24 (lossy)', ''),
# ('B44', 'B44 (lossy)', ''),
# ('B44A', 'B44A (lossy)', ''),
# ('DWAA', 'DWAA (lossy)', ''),
# ('DWAB', 'DWAB (lossy)', ''),
),
)
color_depth : EnumProperty(
name='Color Depth',
default='16',
@ -460,13 +477,14 @@ Possible variables:
row_multi.prop(self, 'template_multilayer_name')
row_multi.active = final_format == 'OPEN_EXR_MULTILAYER'
## Todo: Add rt.info_note to explain templates
box.row().prop(self, 'name_type', expand=False)
col = box.column()
col.prop(self, 'file_format')
col.prop(self, 'exr_codec')
col.row().prop(self, 'color_depth', expand=True)
col.prop(self, 'split_tech_passes')
if self.split_tech_passes:
col.prop(self, 'tech_exr_codec', text='Tech Passes Codec')
search_row = layout.row()
op = search_row.operator("rt.colprop_search_and_replace", icon='BORDERMOVE')
@ -574,6 +592,13 @@ Possible variables:
'color_depth' : self.color_depth,
}
tech_file_format = {
## Force the use of OpenEXR for tech passes if normal passes uses PNG or the likes
'file_format' : file_ext if file_ext in ('OPEN_EXR_MULTILAYER', 'OPEN_EXR') else 'OPEN_EXR',
'exr_codec' : self.tech_exr_codec,
'color_depth' : '32',
}
scn = context.scene
nodes = scn.node_tree.nodes
selected = [n for n in nodes if n.select]
@ -591,6 +616,7 @@ Possible variables:
remap_names=remap_names,
file_format=file_format,
split_tech_passes=self.split_tech_passes,
tech_file_format=tech_file_format,
template=self.final_base_path_template)
return {"FINISHED"}