diff options
-rw-r--r-- | source/blender/editors/transform/transform_snap_object.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/source/blender/editors/transform/transform_snap_object.c b/source/blender/editors/transform/transform_snap_object.c index 7a8a123cf79..e809b3d1acd 100644 --- a/source/blender/editors/transform/transform_snap_object.c +++ b/source/blender/editors/transform/transform_snap_object.c @@ -2335,7 +2335,6 @@ static short snapEditMesh(SnapObjectContext *sctx, .index = -1, .dist_sq = dist_px_sq, }; - int last_index = nearest.index; short elem = SCE_SNAP_MODE_VERTEX; float tobmat[4][4], clip_planes_local[MAX_CLIPPLANE_LEN][4]; @@ -2356,12 +2355,12 @@ static short snapEditMesh(SnapObjectContext *sctx, &nearest, cb_snap_vert, &nearest2d); - - last_index = nearest.index; } if (treedata_edge && snapdata->snap_to_flag & (SCE_SNAP_MODE_EDGE | SCE_SNAP_MODE_EDGE_MIDPOINT | SCE_SNAP_MODE_EDGE_PERPENDICULAR)) { + int last_index = nearest.index; + nearest.index = -1; BM_mesh_elem_table_ensure(em->bm, BM_EDGE | BM_VERT); BLI_bvhtree_find_nearest_projected(treedata_edge->tree, lpmat, @@ -2373,9 +2372,12 @@ static short snapEditMesh(SnapObjectContext *sctx, cb_snap_edge, &nearest2d); - if (last_index != nearest.index) { + if (nearest.index != -1) { elem = SCE_SNAP_MODE_EDGE; } + else { + nearest.index = last_index; + } } if (nearest.index != -1) { |