From d6a102b044a060930ef72666e05e9b779fd6c5e9 Mon Sep 17 00:00:00 2001 From: pullusb Date: Tue, 1 Oct 2024 17:16:44 +0200 Subject: [PATCH] less flashy color on render layer node color - eye care update 1.8.7 - changed: Layer `channel_colors` have _value component_ clamped to 0.65 when transfered to compo node (eye care update) --- CHANGELOG.md | 4 ++++ __init__.py | 2 +- gen_vlayer.py | 12 +++++++++--- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 59f1f82..804f035 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.7 + +- changed: Layer `channel_colors` have _value component_ clamped to 0.65 when transfered to compo node to limit color flashyness (eye care update) + 1.8.6 - changed: removed mask terms from exclude export list `MA, MASK, mask, MSK, msk` (still excluded when opacity is at 0) diff --git a/__init__.py b/__init__.py index d37e5d2..0aadaac 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, 6), + "version": (1, 8, 7), "blender": (3, 0, 0), "location": "View3D", "warning": "", diff --git a/gen_vlayer.py b/gen_vlayer.py index d43960d..fa6e23d 100644 --- a/gen_vlayer.py +++ b/gen_vlayer.py @@ -1,5 +1,5 @@ import bpy -from mathutils import Vector +from mathutils import Vector, Color from . import fn def add_rlayer(layer_name, scene=None, node_scene=None, location=None, color=None, node_name=None, width=400): @@ -317,6 +317,12 @@ def connect_render_layer(rlayer, ng=None, out=None, frame=None, return ng, out +def clamp_color_value(color, clamp_value=0.65) -> Color: + '''Return Color instance with clamped value component''' + color = Color(color) + color.v = min(color.v, clamp_value) + return color + def get_set_viewlayer_from_gp(ob, l, scene=None, node_scene=None, base_path=None, file_slot=None, layer_slot=None): '''setup ouptut from passed gp obj > layer @@ -434,7 +440,7 @@ def get_set_viewlayer_from_gp(ob, l, scene=None, node_scene=None, # use same color as layer if fn.has_channel_color(l): cp.use_custom_color = True - cp.color = l.channel_color + cp.color = clamp_color_value(l.channel_color) connect_render_layer(cp, frame=frame, base_path=base_path, file_slot=file_slot, layer_slot=layer_slot) @@ -455,7 +461,7 @@ def get_set_viewlayer_from_gp(ob, l, scene=None, node_scene=None, if fn.has_channel_color(l): cp.use_custom_color = True - cp.color = l.channel_color + cp.color = clamp_color_value(l.channel_color) frame = next((f for f in nodes if f.type == 'FRAME' and f.label == ob.name), None) rl_nodes = frame_dic[frame.label] # get nodes from