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:
authorVictor-Louis De Gusseme <victorlouis>2021-02-10 01:24:21 +0300
committerHans Goudey <h.goudey@me.com>2021-02-10 01:24:49 +0300
commit722790e8d23091e776d67c5e27c9719923b2f4c3 (patch)
tree952edf09837d7058dec4779a4e1b98ea103007dd
parenta86605fffd884bd29fc9d984a93df3fc572ef210 (diff)
Fix T85493: Attribute glitches while using Attribute Proximity node
The span fill was in multithreaded code, so calculated values were sometimes reset. The fix is to move FLT_MAX fill outside of parallel_for. Differential Revision: https://developer.blender.org/D10378
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_attribute_proximity.cc10
1 files changed, 5 insertions, 5 deletions
diff --git a/source/blender/nodes/geometry/nodes/node_geo_attribute_proximity.cc b/source/blender/nodes/geometry/nodes/node_geo_attribute_proximity.cc
index 1067a1e8593..45f20ca553a 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_attribute_proximity.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_attribute_proximity.cc
@@ -66,6 +66,11 @@ static void proximity_calc(MutableSpan<float> distance_span,
const bool bvh_mesh_success,
const bool bvh_pointcloud_success)
{
+ /* The pointcloud loop uses the values already in the span,
+ * which is only set if the mesh BVH is used (because it's first). */
+ if (!bvh_mesh_success) {
+ distance_span.fill(FLT_MAX);
+ }
IndexRange range = positions.index_range();
parallel_for(range, 512, [&](IndexRange range) {
@@ -86,11 +91,6 @@ static void proximity_calc(MutableSpan<float> distance_span,
}
}
- /* The next loop(s) use the values already in the span. */
- if (!bvh_mesh_success) {
- distance_span.fill(FLT_MAX);
- }
-
if (bvh_pointcloud_success) {
copy_v3_fl(nearest.co, FLT_MAX);
nearest.index = -1;