From 0cbbcac23e47a686519b89c9cac7b2df2e4a4458 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 23 Aug 2018 21:40:30 +1000 Subject: [PATCH] Icons: clamp material color from 0..1 Warn about out of range colors too. --- release/datafiles/blender_icons_geom.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/release/datafiles/blender_icons_geom.py b/release/datafiles/blender_icons_geom.py index f3af7f997c1..644d0756234 100644 --- a/release/datafiles/blender_icons_geom.py +++ b/release/datafiles/blender_icons_geom.py @@ -93,6 +93,9 @@ def object_material_colors(ob): for node in node_tree.nodes if node.type == 'RGB' ), color_default) + if min(color) < 0.0 or max(color) > 1.0: + print(f"Material: {material.name!r} has color out of 0..1 range {color!r}") + color = tuple(max(min(c, 1.0), 0.0) for c in color) material_colors.append(color) return material_colors