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
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2012-11-05 14:43:52 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-11-05 14:43:52 +0400
commit77bf273e1b4dd1eabddf0cff5a401951332e81d6 (patch)
tree708bd0fb73a7c6958401873c4f534c71508ca57d /source/blender/editors/space_view3d/view3d_snap.c
parent29ef22a5fdc84d2b4b0e4649593966b90387cff4 (diff)
fix [#33051] view selected (focus) bug
this was really a feature request!, previously the first cage vertex was used no matter what, but no the code checks to use the closest vertex to the original.
Diffstat (limited to 'source/blender/editors/space_view3d/view3d_snap.c')
-rw-r--r--source/blender/editors/space_view3d/view3d_snap.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/source/blender/editors/space_view3d/view3d_snap.c b/source/blender/editors/space_view3d/view3d_snap.c
index e29066c2d45..7f1bbb22f24 100644
--- a/source/blender/editors/space_view3d/view3d_snap.c
+++ b/source/blender/editors/space_view3d/view3d_snap.c
@@ -214,9 +214,22 @@ static void set_mapped_co(void *vuserdata, int index, const float co[3],
TransVert *tv = userdata[1];
BMVert *eve = EDBM_vert_at_index(em, index);
- if (BM_elem_index_get(eve) != TM_INDEX_SKIP && !(tv[BM_elem_index_get(eve)].flag & TX_VERT_USE_MAPLOC)) {
- copy_v3_v3(tv[BM_elem_index_get(eve)].maploc, co);
- tv[BM_elem_index_get(eve)].flag |= TX_VERT_USE_MAPLOC;
+ if (BM_elem_index_get(eve) != TM_INDEX_SKIP) {
+ tv = &tv[BM_elem_index_get(eve)];
+
+ /* be clever, get the closest vertex to the original,
+ * behaves most logically when the mirror modifier is used for eg [#33051]*/
+ if ((tv->flag & TX_VERT_USE_MAPLOC) == 0) {
+ /* first time */
+ copy_v3_v3(tv->maploc, co);
+ tv->flag |= TX_VERT_USE_MAPLOC;
+ }
+ else {
+ /* find best location to use */
+ if (len_squared_v3v3(eve->co, co) < len_squared_v3v3(eve->co, tv->maploc)) {
+ copy_v3_v3(tv->maploc, co);
+ }
+ }
}
}