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/blenkernel/intern/lattice.c | |
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/blenkernel/intern/lattice.c')
-rw-r--r-- | source/blender/blenkernel/intern/lattice.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/lattice.c b/source/blender/blenkernel/intern/lattice.c index dac6ba4a0f3..feb82a34708 100644 --- a/source/blender/blenkernel/intern/lattice.c +++ b/source/blender/blenkernel/intern/lattice.c @@ -168,6 +168,7 @@ void BKE_lattice_resize(Lattice *lt, int uNew, int vNew, int wNew, Object *ltOb) lt->pntsv = vNew; lt->pntsw = wNew; + lt->actbp = LT_ACTBP_NONE; MEM_freeN(lt->def); lt->def = MEM_callocN(lt->pntsu * lt->pntsv * lt->pntsw * sizeof(BPoint), "lattice bp"); @@ -192,6 +193,7 @@ Lattice *BKE_lattice_add(Main *bmain, const char *name) lt->def = MEM_callocN(sizeof(BPoint), "lattvert"); /* temporary */ BKE_lattice_resize(lt, 2, 2, 2, NULL); /* creates a uniform lattice */ + lt->actbp = LT_ACTBP_NONE; return lt; } @@ -1012,6 +1014,24 @@ struct MDeformVert *BKE_lattice_deform_verts_get(struct Object *oblatt) return lt->dvert; } +struct BPoint *BKE_lattice_active_point_get(Lattice *lt) +{ + BLI_assert(GS(lt->id.name) == ID_LT); + + if (lt->editlatt) { + lt = lt->editlatt->latt; + } + + BLI_assert(lt->actbp < lt->pntsu * lt->pntsv * lt->pntsw); + + if ((lt->actbp != LT_ACTBP_NONE) && (lt->actbp < lt->pntsu * lt->pntsv * lt->pntsw)) { + return <->def[lt->actbp]; + } + else { + return NULL; + } +} + void BKE_lattice_center_median(struct Lattice *lt, float cent[3]) { int i, numVerts; |