From 1e7b2d0bc6d1f9346d8ffb0a86c02d661737ed31 Mon Sep 17 00:00:00 2001 From: Hans Goudey Date: Wed, 10 Mar 2021 10:51:44 -0500 Subject: Geometry Nodes: Add color to boolean implicit conversion This conversion works the same way as a combination of the existing color to float3 to boolean conversions, so the boolean result will be false if the color is black, otherwise true, and the alpha is ignored. --- source/blender/nodes/intern/node_tree_multi_function.cc | 3 +++ 1 file changed, 3 insertions(+) (limited to 'source/blender/nodes') diff --git a/source/blender/nodes/intern/node_tree_multi_function.cc b/source/blender/nodes/intern/node_tree_multi_function.cc index bb1367573f8..abd9940cf56 100644 --- a/source/blender/nodes/intern/node_tree_multi_function.cc +++ b/source/blender/nodes/intern/node_tree_multi_function.cc @@ -206,6 +206,9 @@ static DataTypeConversions create_implicit_conversions() return (a) ? Color4f(1.0f, 1.0f, 1.0f, 1.0f) : Color4f(0.0f, 0.0f, 0.0f, 1.0f); }); + add_implicit_conversion(conversions, "Color4f to boolean", [](Color4f a) { + return a.r == 0.0f && a.g == 0.0f && a.b == 0.0f; + }); add_implicit_conversion( conversions, "Color4f to float", [](Color4f a) { return rgb_to_grayscale(a); }); add_implicit_conversion( -- cgit v1.2.3