[Bf-blender-cvs] [1e7b2d0bc6d] master: Geometry Nodes: Add color to boolean implicit conversion
Hans Goudey
noreply at git.blender.org
Wed Mar 10 16:51:49 CET 2021
Commit: 1e7b2d0bc6d1f9346d8ffb0a86c02d661737ed31
Author: Hans Goudey
Date: Wed Mar 10 10:51:44 2021 -0500
Branches: master
https://developer.blender.org/rB1e7b2d0bc6d1f9346d8ffb0a86c02d661737ed31
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.
===================================================================
M source/blender/nodes/intern/node_tree_multi_function.cc
===================================================================
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<Color4f, bool>(conversions, "Color4f to boolean", [](Color4f a) {
+ return a.r == 0.0f && a.g == 0.0f && a.b == 0.0f;
+ });
add_implicit_conversion<Color4f, float>(
conversions, "Color4f to float", [](Color4f a) { return rgb_to_grayscale(a); });
add_implicit_conversion<Color4f, float2>(
More information about the Bf-blender-cvs
mailing list