Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authormano-wii <germano.costa@ig.com.br>2019-08-27 07:06:30 +0300
committermano-wii <germano.costa@ig.com.br>2019-08-27 07:06:30 +0300
commit963a991a20de2a57c14c58f56391f0818e30c043 (patch)
tree3322bafd5830deeccafea315da11b5f43c22e1db /source
parent3df04851cfa0e2091c96c3aa10f1c6e8e1075016 (diff)
Fix specific case where a vertex is ignored in snapping
Sometimes the index of the edge and the vertex may coincide.
Diffstat (limited to 'source')
-rw-r--r--source/blender/editors/transform/transform_snap_object.c10
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) {