diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-06-10 00:28:08 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-06-10 00:28:08 +0400 |
commit | eabb30a2367808c163a90d658c5be586530098ec (patch) | |
tree | e3d1a20fad111127c3c20c3450b003553b171db5 /source/blender/editors/object | |
parent | 28add50083204e99121c5290242652ccd3fcca9e (diff) |
patch [#35631] Active element for Lattice
by Kevin Mackay (yakca)
Was one of our TODO's from the wiki.
Diffstat (limited to 'source/blender/editors/object')
-rw-r--r-- | source/blender/editors/object/object_lattice.c | 18 | ||||
-rw-r--r-- | source/blender/editors/object/object_vgroup.c | 8 |
2 files changed, 22 insertions, 4 deletions
diff --git a/source/blender/editors/object/object_lattice.c b/source/blender/editors/object/object_lattice.c index 9d3b2b7272d..d3537051861 100644 --- a/source/blender/editors/object/object_lattice.c +++ b/source/blender/editors/object/object_lattice.c @@ -154,6 +154,7 @@ void load_editLatt(Object *obedit) lt->typeu = editlt->typeu; lt->typev = editlt->typev; lt->typew = editlt->typew; + lt->actbp = editlt->actbp; } if (lt->dvert) { @@ -180,7 +181,8 @@ void ED_setflagsLatt(Object *obedit, int flag) bp = lt->editlatt->latt->def; a = lt->editlatt->latt->pntsu * lt->editlatt->latt->pntsv * lt->editlatt->latt->pntsw; - + lt->editlatt->latt->actbp = LT_ACTBP_NONE; + while (a--) { if (bp->hide == 0) { bp->f1 = flag; @@ -224,6 +226,7 @@ static int lattice_select_all_exec(bContext *C, wmOperator *op) case SEL_INVERT: bp = lt->editlatt->latt->def; a = lt->editlatt->latt->pntsu * lt->editlatt->latt->pntsv * lt->editlatt->latt->pntsw; + lt->editlatt->latt->actbp = LT_ACTBP_NONE; while (a--) { if (bp->hide == 0) { @@ -642,8 +645,10 @@ bool mouse_lattice(bContext *C, const int mval[2], bool extend, bool deselect, b { ViewContext vc; BPoint *bp = NULL; + Lattice *lt; view3d_set_viewcontext(C, &vc); + lt = ((Lattice *)vc.obedit->data)->editlatt->latt; bp = findnearestLattvert(&vc, mval, TRUE); if (bp) { @@ -661,6 +666,13 @@ bool mouse_lattice(bContext *C, const int mval[2], bool extend, bool deselect, b bp->f1 |= SELECT; } + if (bp->f1 & SELECT) { + lt->actbp = bp - lt->def; + } + else { + lt->actbp = LT_ACTBP_NONE; + } + WM_event_add_notifier(C, NC_GEOM | ND_SELECT, vc.obedit->data); return true; @@ -673,7 +685,7 @@ bool mouse_lattice(bContext *C, const int mval[2], bool extend, bool deselect, b typedef struct UndoLattice { BPoint *def; - int pntsu, pntsv, pntsw; + int pntsu, pntsv, pntsw, actbp; } UndoLattice; static void undoLatt_to_editLatt(void *data, void *edata, void *UNUSED(obdata)) @@ -683,6 +695,7 @@ static void undoLatt_to_editLatt(void *data, void *edata, void *UNUSED(obdata)) int a = editlatt->latt->pntsu * editlatt->latt->pntsv * editlatt->latt->pntsw; memcpy(editlatt->latt->def, ult->def, a * sizeof(BPoint)); + editlatt->latt->actbp = ult->actbp; } static void *editLatt_to_undoLatt(void *edata, void *UNUSED(obdata)) @@ -694,6 +707,7 @@ static void *editLatt_to_undoLatt(void *edata, void *UNUSED(obdata)) ult->pntsu = editlatt->latt->pntsu; ult->pntsv = editlatt->latt->pntsv; ult->pntsw = editlatt->latt->pntsw; + ult->actbp = editlatt->latt->actbp; return ult; } diff --git a/source/blender/editors/object/object_vgroup.c b/source/blender/editors/object/object_vgroup.c index 437bea07069..54ef65ab3fb 100644 --- a/source/blender/editors/object/object_vgroup.c +++ b/source/blender/editors/object/object_vgroup.c @@ -65,6 +65,7 @@ #include "BKE_DerivedMesh.h" #include "BKE_object_deform.h" #include "BKE_object.h" +#include "BKE_lattice.h" #include "RNA_access.h" #include "RNA_define.h" @@ -1108,7 +1109,7 @@ static void vgroup_select_verts(Object *ob, int select) if (lt->dvert) { MDeformVert *dv; - BPoint *bp; + BPoint *bp, *actbp = BKE_lattice_active_point_get(lt); int a, tot; dv = lt->dvert; @@ -1117,7 +1118,10 @@ static void vgroup_select_verts(Object *ob, int select) for (a = 0, bp = lt->def; a < tot; a++, bp++, dv++) { if (defvert_find_index(dv, def_nr)) { if (select) bp->f1 |= SELECT; - else bp->f1 &= ~SELECT; + else { + bp->f1 &= ~SELECT; + if (actbp && bp == actbp) lt->actbp = LT_ACTBP_NONE; + } } } } |