Fix snap to endpoint being represented as loose point

Since different symbols are implemented, there is a distinction between
endpoint and loose point, which was partially missing in the snap code
for Mesh.
This commit is contained in:
Germano Cavalcante 2023-10-02 16:30:23 -03:00
parent 94e2973f0b
commit c706de891c

@ -394,7 +394,7 @@ eSnapMode snap_polygon_mesh(SnapObjectContext *sctx,
}
}
else {
elem = SCE_SNAP_TO_VERTEX;
elem = SCE_SNAP_TO_EDGE_ENDPOINT;
const int *face_verts = &nearest2d.corner_verts[face.start()];
for (int i = face.size(); i--;) {
cb_snap_vert(&nearest2d,
@ -483,7 +483,7 @@ static eSnapMode snapMesh(SnapObjectContext *sctx,
nearest.dist_sq = sctx->ret.dist_px_sq;
int last_index = nearest.index;
eSnapMode elem = SCE_SNAP_TO_POINT;
eSnapMode elem = SCE_SNAP_TO_NONE;
if (bvhtree[1]) {
BLI_assert(snap_to & SCE_SNAP_TO_POINT);
@ -498,7 +498,10 @@ static eSnapMode snapMesh(SnapObjectContext *sctx,
cb_snap_vert,
&nearest2d);
last_index = nearest.index;
if (nearest.index != -1) {
last_index = nearest.index;
elem = SCE_SNAP_TO_POINT;
}
}
if (snap_to & (SNAP_TO_EDGE_ELEMENTS & ~SCE_SNAP_TO_EDGE_ENDPOINT)) {
@ -563,6 +566,10 @@ static eSnapMode snapMesh(SnapObjectContext *sctx,
cb_snap_tri_verts,
&nearest2d);
}
if (last_index != nearest.index) {
elem = SCE_SNAP_TO_EDGE_ENDPOINT;
}
}
if (nearest.index != -1) {