Icons: clamp material color from 0..1

Warn about out of range colors too.
This commit is contained in:
Campbell Barton 2018-08-23 21:40:30 +10:00
parent 7f8014f918
commit 0cbbcac23e

@ -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