Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Goudey <h.goudey@me.com>2021-03-10 18:51:44 +0300
committerHans Goudey <h.goudey@me.com>2021-03-10 18:51:44 +0300
commit1e7b2d0bc6d1f9346d8ffb0a86c02d661737ed31 (patch)
tree231731d8cd3e66beb9b5d9e5f7958c0e1a0884ec /source/blender/nodes/intern
parent7f07eff5881a6418a178399d082c6061ca88feae (diff)
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.
Diffstat (limited to 'source/blender/nodes/intern')
-rw-r--r--source/blender/nodes/intern/node_tree_multi_function.cc3
1 files changed, 3 insertions, 0 deletions
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>(