[Bf-blender-cvs] [0cbbcac23e4] blender2.8: Icons: clamp material color from 0..1

Campbell Barton noreply at git.blender.org
Thu Aug 23 13:36:09 CEST 2018


Commit: 0cbbcac23e47a686519b89c9cac7b2df2e4a4458
Author: Campbell Barton
Date:   Thu Aug 23 21:40:30 2018 +1000
Branches: blender2.8
https://developer.blender.org/rB0cbbcac23e47a686519b89c9cac7b2df2e4a4458

Icons: clamp material color from 0..1

Warn about out of range colors too.

===================================================================

M	release/datafiles/blender_icons_geom.py

===================================================================

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



More information about the Bf-blender-cvs mailing list