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!
This commit is contained in:
Bastien Montagne 2020-10-16 12:59:03 +02:00
parent 14f490b932
commit 3b84dce969
Notes: blender-bot 2023-02-14 06:32:27 +01:00
Referenced by issue #54526, Data Transfer modifier's Max Distance field working strangely
1 changed files with 6 additions and 1 deletions

View File

@ -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;