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.
This commit is contained in:
parent
29ef22a5fd
commit
77bf273e1b
@ -214,9 +214,22 @@ static void set_mapped_co(void *vuserdata, int index, const float co[3],
|
|||||||
TransVert *tv = userdata[1];
|
TransVert *tv = userdata[1];
|
||||||
BMVert *eve = EDBM_vert_at_index(em, index);
|
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)) {
|
if (BM_elem_index_get(eve) != TM_INDEX_SKIP) {
|
||||||
copy_v3_v3(tv[BM_elem_index_get(eve)].maploc, co);
|
tv = &tv[BM_elem_index_get(eve)];
|
||||||
tv[BM_elem_index_get(eve)].flag |= TX_VERT_USE_MAPLOC;
|
|
||||||
|
/* 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user