[Bf-blender-cvs] [18e063b69db] master: Functions: use better conversion from float2 to float3
Jacques Lucke
noreply at git.blender.org
Fri Jan 22 13:46:31 CET 2021
Commit: 18e063b69db3f810dae9753030111c1a2ea67117
Author: Jacques Lucke
Date: Fri Jan 22 13:46:13 2021 +0100
Branches: master
https://developer.blender.org/rB18e063b69db3f810dae9753030111c1a2ea67117
Functions: use better conversion from float2 to float3
Previously float2 was converted to float3 by implicitly converting to a
float pointer first, which was then passed to the float3 constructor.
This leads to uninitialized memory in the z component of the new float3.
Ideally this should be solved in float2/float3 itself, but my first fix for
that resulted in a compile error: rB6ac0a3d83c8e5a39bd5356aa0d68e3166bd91e82
This is an alternative fix that can be used for now. Will have to look
into the conversion in more detail again.
===================================================================
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 33192648d93..c2391667e86 100644
--- a/source/blender/nodes/intern/node_tree_multi_function.cc
+++ b/source/blender/nodes/intern/node_tree_multi_function.cc
@@ -199,7 +199,8 @@ static DataTypeConversions create_implicit_conversions()
add_implicit_conversion<float, Color4f>(
conversions, "float to Color4f", [](float a) { return Color4f(a, a, a, 1.0f); });
- add_implicit_conversion<float2, float3>(conversions);
+ add_implicit_conversion<float2, float3>(
+ conversions, "float2 to float3", [](float2 a) { return float3(a.x, a.y, 0.0f); });
add_implicit_conversion<float2, float>(
conversions, "float2 to float", [](float2 a) { return a.length(); });
add_implicit_conversion<float2, int32_t>(
More information about the Bf-blender-cvs
mailing list