From 09a47413c3a6e364db1bb5a1fdb5dda2bf4a03a8 Mon Sep 17 00:00:00 2001 From: "florentin.luce" Date: Wed, 4 Dec 2024 16:22:34 +0100 Subject: [PATCH] Use GP_RENDER_FILE_FORMAT env var to set file output nodes --- CHANGELOG.md | 4 ++++ __init__.py | 2 +- fn.py | 23 +++++++++++------------ 3 files changed, 16 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d2d7d6d..e0a4cdb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,10 @@ Activate / deactivate layer opacity according to prefix Activate / deactivate all masks using MA layers --> +1.8.12 + +- changed: Use GP_RENDER_FILE_FORMAT env var to set file output nodes + 1.8.11 - fixed: cleaning materials duplication checked against name without checking material GP type diff --git a/__init__.py b/__init__.py index ad14c40..9b5cec0 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": (1, 8, 11), + "version": (1, 8, 12), "blender": (3, 0, 0), "location": "View3D", "warning": "", diff --git a/fn.py b/fn.py index 9200689..caf216c 100644 --- a/fn.py +++ b/fn.py @@ -152,19 +152,18 @@ def copy_settings(obj_a, obj_b): pass def set_file_output_format(fo): - # FIXME for now default fallback to multilayer - env_file_format = os.environ.get('FILE_FORMAT') - fo.format.file_format = env_file_format if env_file_format else 'OPEN_EXR_MULTILAYER' - # fo.format.file_format = 'OPEN_EXR' # 'OPEN_EXR_MULTILAYER' - fo.format.color_mode = 'RGBA' - fo.format.color_depth = '16' - fo.format.exr_codec = 'PIZ' # 'ZIP', 'RLE' - ## PNG format - # fo.format.file_format = 'PNG' - # fo.format.color_mode = 'RGBA' - # fo.format.color_depth = '8' - # fo.format.compression = 15 + env_file_format = json.loads(os.environ.get('GP_RENDER_FILE_FORMAT', '{}')) + if not env_file_format: + env_file_format = { + 'file_format': 'OPEN_EXR_MULTILAYER', + 'exr_codec': 'ZIP', + 'color_depth': '16', + 'color_mode': 'RGBA' + } + + for k, v in env_file_format.items(): + setattr(fo.format, k, v) def set_scene_aa_settings(scene=None, aa=True): '''aa == using native AA, else disable scene AA'''