diff options
author | Hans Goudey <h.goudey@me.com> | 2021-03-13 19:39:48 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2021-03-13 19:39:48 +0300 |
commit | 8ab6450abbbb8d30db33d006fcbea543beb82e6c (patch) | |
tree | 39925f90528f33ffe08525911ea56b5445c56b9d | |
parent | 258b15da74ad6f734d4e9870bbe051066a9a705c (diff) |
Fix geometry nodes implicit conversion to booleans reversed
The result value should be true if the input values are not zero.
Note that there is ongoing conversation about these conversions
in D10685. This is simply a fix though.
-rw-r--r-- | source/blender/nodes/intern/node_tree_multi_function.cc | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/source/blender/nodes/intern/node_tree_multi_function.cc b/source/blender/nodes/intern/node_tree_multi_function.cc index abd9940cf56..c9729d43a42 100644 --- a/source/blender/nodes/intern/node_tree_multi_function.cc +++ b/source/blender/nodes/intern/node_tree_multi_function.cc @@ -175,12 +175,12 @@ static DataTypeConversions create_implicit_conversions() add_implicit_conversion<float2, int32_t>( conversions, "float2 to int32_t", [](float2 a) { return (int32_t)a.length(); }); add_implicit_conversion<float2, bool>( - conversions, "float2 to bool", [](float2 a) { return a.length_squared() == 0.0f; }); + conversions, "float2 to bool", [](float2 a) { return !is_zero_v2(a); }); add_implicit_conversion<float2, Color4f>( conversions, "float2 to Color4f", [](float2 a) { return Color4f(a.x, a.y, 0.0f, 1.0f); }); add_implicit_conversion<float3, bool>( - conversions, "float3 to boolean", [](float3 a) { return a.length_squared() == 0.0f; }); + conversions, "float3 to boolean", [](float3 a) { return !is_zero_v3(a); }); add_implicit_conversion<float3, float>( conversions, "Vector Length", [](float3 a) { return a.length(); }); add_implicit_conversion<float3, int32_t>( @@ -207,7 +207,7 @@ static DataTypeConversions create_implicit_conversions() }); add_implicit_conversion<Color4f, bool>(conversions, "Color4f to boolean", [](Color4f a) { - return a.r == 0.0f && a.g == 0.0f && a.b == 0.0f; + 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); }); |