[Bf-blender-cvs] [3b84dce9696] master: Fix T54526: Data Transfer modifier's Max Distance field working strangely.
Bastien Montagne
noreply at git.blender.org
Fri Oct 16 13:00:45 CEST 2020
Commit: 3b84dce96967e7a9fe568e2518ee774843d48733
Author: Bastien Montagne
Date: Fri Oct 16 12:59:03 2020 +0200
Branches: master
https://developer.blender.org/rB3b84dce96967e7a9fe568e2518ee774843d48733
Fix T54526: Data Transfer modifier's Max Distance field working strangely.
Based on investigation by Philipp Oeser (@lichtwerk) and solution by
Alexander Gavrilov (@angavrilov) in D5206, thanks!
===================================================================
M source/blender/blenkernel/intern/mesh_remap.c
===================================================================
diff --git a/source/blender/blenkernel/intern/mesh_remap.c b/source/blender/blenkernel/intern/mesh_remap.c
index a8937f74dee..1c48cf6f3cb 100644
--- a/source/blender/blenkernel/intern/mesh_remap.c
+++ b/source/blender/blenkernel/intern/mesh_remap.c
@@ -61,7 +61,12 @@ static bool mesh_remap_bvhtree_query_nearest(BVHTreeFromMesh *treedata,
{
/* Use local proximity heuristics (to reduce the nearest search). */
if (nearest->index != -1) {
- nearest->dist_sq = min_ff(len_squared_v3v3(co, nearest->co), max_dist_sq);
+ nearest->dist_sq = len_squared_v3v3(co, nearest->co);
+ if (nearest->dist_sq > max_dist_sq) {
+ /* The previous valid index is too far away and not valid for this check. */
+ nearest->dist_sq = max_dist_sq;
+ nearest->index = -1;
+ }
}
else {
nearest->dist_sq = max_dist_sq;
More information about the Bf-blender-cvs
mailing list