From 2a297366f0597ec8a01dc815834db19834498d81 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 12 Jan 2021 00:20:47 +1100 Subject: [PATCH] Fix T84565: UV face select fails when zoomed in Exposed by recent commit 246efd7286f6187e4dd4b3edcc79cccb1746bb1d Although this was an existing logical error causing `uv_find_nearest_face` to only work properly when the hit distance was initialized to FLT_MAX, which wasn't the case in multi-object edit mode. --- source/blender/editors/uvedit/uvedit_select.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/source/blender/editors/uvedit/uvedit_select.c b/source/blender/editors/uvedit/uvedit_select.c index 118a2263cc3..34e953597fb 100644 --- a/source/blender/editors/uvedit/uvedit_select.c +++ b/source/blender/editors/uvedit/uvedit_select.c @@ -732,9 +732,11 @@ bool uv_find_nearest_face(Scene *scene, Object *obedit, const float co[2], UvNea const int cd_loop_uv_offset = CustomData_get_offset(&em->bm->ldata, CD_MLOOPUV); - /* this will fill in hit.vert1 and hit.vert2 */ + /* This will fill in `hit.l`. */ float dist_sq_init = hit_final->dist_sq; UvNearestHit hit = *hit_final; + /* The edge of the face might be further away than the threshold from it's center. */ + hit.dist_sq = FLT_MAX; if (uv_find_nearest_edge(scene, obedit, co, &hit)) { hit.dist_sq = dist_sq_init; hit.l = NULL;