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:
authorBastien Montagne <bastien@blender.org>2020-10-16 13:59:03 +0300
committerBastien Montagne <bastien@blender.org>2020-10-16 14:00:40 +0300
commit3b84dce96967e7a9fe568e2518ee774843d48733 (patch)
tree2e6d129f666bdedd9464fe7873f299788d308970 /source/blender/blenkernel/intern/mesh_remap.c
parent14f490b932ad7b2009563c9ee21103b93143d0bb (diff)
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!
Diffstat (limited to 'source/blender/blenkernel/intern/mesh_remap.c')
-rw-r--r--source/blender/blenkernel/intern/mesh_remap.c7
1 files changed, 6 insertions, 1 deletions
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;