Fix T36973: Active snapping fails for edges/faces

also add snap-active support for armatures, pose & metas
This commit is contained in:
2014-05-09 16:52:09 +10:00
parent d61f8a5a22
commit 663c800ef3
5 changed files with 143 additions and 121 deletions

View File

@@ -1612,7 +1612,7 @@ static void createTransLatticeVerts(TransInfo *t)
{
Lattice *latt = ((Lattice *)t->obedit->data)->editlatt->latt;
TransData *td = NULL;
BPoint *bp, *actbp = BKE_lattice_active_point_get(latt);
BPoint *bp;
float mtx[3][3], smtx[3][3];
int a;
int count = 0, countsel = 0;
@@ -1649,7 +1649,6 @@ static void createTransLatticeVerts(TransInfo *t)
copy_v3_v3(td->center, td->loc);
if (bp->f1 & SELECT) {
td->flag = TD_SELECTED;
if (actbp && bp == actbp) td->flag |= TD_ACTIVE;
}
else td->flag = 0;
copy_m3_m3(td->smtx, smtx);
@@ -2138,7 +2137,6 @@ static void createTransEditVerts(TransInfo *t)
BMesh *bm = em->bm;
BMVert *eve;
BMIter iter;
BMVert *eve_act = NULL;
float (*mappedcos)[3] = NULL, (*quats)[4] = NULL;
float mtx[3][3], smtx[3][3], (*defmats)[3][3] = NULL, (*defcos)[3] = NULL;
float *dists = NULL;
@@ -2178,10 +2176,6 @@ static void createTransEditVerts(TransInfo *t)
BLI_assert(0);
}
/* check active */
eve_act = BM_mesh_active_vert_get(bm);
if (t->mode == TFM_BWEIGHT) {
BM_mesh_cd_flag_ensure(bm, BKE_mesh_from_object(t->obedit), ME_CDFLAG_VERT_BWEIGHT);
cd_vert_bweight_offset = CustomData_get_offset(&bm->vdata, CD_BWEIGHT);
@@ -2287,9 +2281,6 @@ static void createTransEditVerts(TransInfo *t)
if (BM_elem_flag_test(eve, BM_ELEM_SELECT))
tob->flag |= TD_SELECTED;
/* active */
if (eve == eve_act) tob->flag |= TD_ACTIVE;
if (propmode) {
if (propmode & T_PROP_CONNECTED) {
tob->dist = dists[a];
@@ -4726,8 +4717,7 @@ static bool constraints_list_needinv(TransInfo *t, ListBase *list)
}
/* transcribe given object into TransData for Transforming */
static void ObjectToTransData(TransInfo *t, TransData *td, Object *ob,
const Object *ob_act)
static void ObjectToTransData(TransInfo *t, TransData *td, Object *ob)
{
Scene *scene = t->scene;
bool constinv;
@@ -4851,11 +4841,6 @@ static void ObjectToTransData(TransInfo *t, TransData *td, Object *ob,
unit_m3(td->smtx);
unit_m3(td->mtx);
}
/* set active flag */
if (ob == ob_act) {
td->flag |= TD_ACTIVE;
}
}
@@ -5863,7 +5848,6 @@ int special_transform_moving(TransInfo *t)
static void createTransObject(bContext *C, TransInfo *t)
{
Scene *scene = t->scene;
const Object *ob_act = OBACT;
TransData *td = NULL;
TransDataExtension *tx;
@@ -5906,7 +5890,7 @@ static void createTransObject(bContext *C, TransInfo *t)
td->flag |= TD_SKIP;
}
ObjectToTransData(t, td, ob, ob_act);
ObjectToTransData(t, td, ob);
td->val = NULL;
td++;
tx++;
@@ -5928,7 +5912,7 @@ static void createTransObject(bContext *C, TransInfo *t)
td->ext = tx;
td->ext->rotOrder = ob->rotmode;
ObjectToTransData(t, td, ob, ob_act);
ObjectToTransData(t, td, ob);
td->val = NULL;
td++;
tx++;