[Bf-blender-cvs] [722790e8d23] master: Fix T85493: Attribute glitches while using Attribute Proximity node

Victor-Louis De Gusseme noreply at git.blender.org
Tue Feb 9 23:25:01 CET 2021


Commit: 722790e8d23091e776d67c5e27c9719923b2f4c3
Author: Victor-Louis De Gusseme
Date:   Tue Feb 9 16:24:21 2021 -0600
Branches: master
https://developer.blender.org/rB722790e8d23091e776d67c5e27c9719923b2f4c3

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

===================================================================

M	source/blender/nodes/geometry/nodes/node_geo_attribute_proximity.cc

===================================================================

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;



More information about the Bf-blender-cvs mailing list