From 47774a46e388eef313275330ae837a0c5be7e8e5 Mon Sep 17 00:00:00 2001 From: Pullusb Date: Thu, 23 Sep 2021 15:13:30 +0200 Subject: [PATCH] fix output settings - default to exr 0.3.6 change: output settings switch from PNG to EXR fix: set render scene output (preview) to jpeg fast to write fix: correct copy output format ops --- CHANGELOG.md | 8 ++++++++ OP_manage_outputs.py | 27 +++++++++++++++++++-------- __init__.py | 2 +- fn.py | 21 ++++++++++++++++----- 4 files changed, 44 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2c75b80..55fbb56 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ +0.3.6 + +change: output settings switch from PNG to EXR +fix: set render scene output (preview) to jpeg fast to write +fix: correct copy output format ops + 0.3.5: feat: set full opacity -> skip chosen prefix (MA by default) diff --git a/OP_manage_outputs.py b/OP_manage_outputs.py index 0a826c1..f69e033 100644 --- a/OP_manage_outputs.py +++ b/OP_manage_outputs.py @@ -85,20 +85,29 @@ class GPEXP_OT_set_output_node_format(bpy.types.Operator): return {"CANCELLED"} ref = nodes.active - color_mode = ref.format.color_mode - file_format = ref.format.file_format - color_depth = ref.format.color_depth - compression = ref.format.compression + + # file_format = ref.format.file_format + # color_mode = ref.format.color_mode + # color_depth = ref.format.color_depth + # compression = ref.format.compression ct = 0 for n in nodes: if n.type != 'OUTPUT_FILE' or n == ref or not n.select: continue - n.format.color_mode = color_mode - n.format.file_format = file_format - n.format.color_depth = color_depth - n.format.compression = compression + for attr in dir(ref.format): + if attr.startswith('__') or attr in {'rna_type','bl_rna', 'view_settings'}: # views_format + continue + try: + setattr(n.format, attr, getattr(ref.format, attr)) + except Exception as e: + print(f"can't set attribute : {attr}") + + # n.format.file_format = file_format + # n.format.color_mode = color_mode + # n.format.color_depth = color_depth + # n.format.compression = compression ct += 1 @@ -107,6 +116,7 @@ class GPEXP_OT_set_output_node_format(bpy.types.Operator): return {"FINISHED"} + def out_norm(x): a = x.group(1) if x.group(1) else '' b = x.group(2) if x.group(2) else '' @@ -115,6 +125,7 @@ def out_norm(x): e = x.group(5) if x.group(5) else '' return f'{a}{b}{fn.normalize(c)}{d}{e}' + ## does not match the right thing yet class GPEXP_OT_normalize_outnames(bpy.types.Operator): bl_idname = "gp.normalize_outnames" diff --git a/__init__.py b/__init__.py index 1793a6d..11eab30 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, 3, 5), + "version": (0, 3, 6), "blender": (2, 93, 0), "location": "View3D", "warning": "", diff --git a/fn.py b/fn.py index 8252b26..4e2bad9 100644 --- a/fn.py +++ b/fn.py @@ -94,10 +94,16 @@ def copy_settings(obj_a, obj_b): def set_file_output_format(fo): + fo.format.file_format = 'OPEN_EXR' fo.format.color_mode = 'RGBA' - fo.format.file_format = 'PNG' - fo.format.color_depth = '8' - fo.format.compression = 15 + fo.format.color_depth = '16' + fo.format.exr_codec = 'ZIP' + # fo.format.exr_codec = 'RLE' + + # fo.format.file_format = 'PNG' + # fo.format.color_mode = 'RGBA' + # fo.format.color_depth = '8' + # fo.format.compression = 15 def set_settings(scene=None): if not scene: @@ -108,6 +114,13 @@ def set_settings(scene=None): scene.render.film_transparent = True scene.view_settings.view_transform = 'Standard' + # output (fast write settings since this is just to delete afterwards...) + scene.render.filepath = '//render/preview/preview_' + scene.render.image_settings.file_format = 'JPEG' + scene.render.image_settings.color_mode = 'BW' + scene.render.image_settings.quality = 0 + + def get_render_scene(): '''Get / Create a scene named Render''' @@ -125,8 +138,6 @@ def get_render_scene(): for ob in bpy.context.scene.objects: if ob.type in ('CAMERA', 'LIGHT'): render_scn.collection.objects.link(ob) - - render_scn.render.filepath = '//render/preview/preview_' # set adapted render settings (no AA) set_settings(render_scn)