diff options
author | Campbell Barton <ideasman42@gmail.com> | 2021-03-29 09:43:06 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2021-03-29 10:08:57 +0300 |
commit | 80cbbd2843c2358879b1a710d81a3b41e1468327 (patch) | |
tree | 8a116de6c922c94bc4db01627a5e6e5d81fe0317 /source/blender/editors/mesh/editmesh_path.c | |
parent | 36593405713745854f4da933282ca3c3a5041063 (diff) |
Knife: support vert/edge snapping when not directly over a face
Respect the distance argument to EDBM_face_find_nearest,
when zero, sample a single pixel, otherwise sample a region.
Knife uses the selection-buffer to pick a face when the ray-cast failed.
This was meant to allow snapping to nearby faces however as the margin
was ignored, it was only used in edge cases where the ray-cast missed
but the pixel didn't.
Now the face-picking threshold is working as expected.
Note that other callers to EDBM_face_find_nearest have been updated
so set their distance argument to zero so this only impacts the knife.
Regular selection and path select could be modified separately if users
prefer this behavior.
Diffstat (limited to 'source/blender/editors/mesh/editmesh_path.c')
-rw-r--r-- | source/blender/editors/mesh/editmesh_path.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/source/blender/editors/mesh/editmesh_path.c b/source/blender/editors/mesh/editmesh_path.c index b7f671a4157..13c156fddec 100644 --- a/source/blender/editors/mesh/editmesh_path.c +++ b/source/blender/editors/mesh/editmesh_path.c @@ -646,6 +646,9 @@ static BMElem *edbm_elem_find_nearest(ViewContext *vc, const char htype) return (BMElem *)EDBM_edge_find_nearest(vc, &dist); } if ((em->selectmode & SCE_SELECT_FACE) && (htype == BM_FACE)) { + /* Only pick faces directly under the cursor. + * We could look into changing this, for now it matches regular face selection. */ + dist = 0.0f; return (BMElem *)EDBM_face_find_nearest(vc, &dist); } |