diff options
author | Ton Roosendaal <ton@blender.org> | 2009-01-13 18:18:41 +0300 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2009-01-13 18:18:41 +0300 |
commit | b8dac71bdab7bd562ca13eb8c4af2f966533067b (patch) | |
tree | a5ad1039b7065fef5e2e045c95743633ad241573 /source/blender/editors/mesh/editdeform.c | |
parent | b3d8cbd1130578e440966449d0bec995c7764a18 (diff) |
2.5
- restored three more C files: editlattice, editkey
and editgroup
- editmode lattice working, (mouse select works)
- accidentally removed yesterday 3d cursor drawing
- removed global editLatt entirely now.
Diffstat (limited to 'source/blender/editors/mesh/editdeform.c')
-rw-r--r-- | source/blender/editors/mesh/editdeform.c | 83 |
1 files changed, 50 insertions, 33 deletions
diff --git a/source/blender/editors/mesh/editdeform.c b/source/blender/editors/mesh/editdeform.c index 0533c37b292..845290660c7 100644 --- a/source/blender/editors/mesh/editdeform.c +++ b/source/blender/editors/mesh/editdeform.c @@ -65,6 +65,17 @@ static void BIF_undo_push() {} static void error() {} +static Lattice *def_get_lattice(Object *ob) +{ + if(ob->type==OB_LATTICE) { + Lattice *lt= ob->data; + if(lt->editlatt) + return lt->editlatt; + return lt; + } + return NULL; +} + /* only in editmode */ void sel_verts_defgroup (Object *obedit, int select) { @@ -103,14 +114,17 @@ void sel_verts_defgroup (Object *obedit, int select) } break; case OB_LATTICE: - if(editLatt->dvert) { + { + Lattice *lt= def_get_lattice(ob); + + if(lt->dvert) { BPoint *bp; int a, tot; - dvert= editLatt->dvert; + dvert= lt->dvert; - tot= editLatt->pntsu*editLatt->pntsv*editLatt->pntsw; - for(a=0, bp= editLatt->def; a<tot; a++, bp++, dvert++) { + tot= lt->pntsu*lt->pntsv*lt->pntsw; + for(a=0, bp= lt->def; a<tot; a++, bp++, dvert++) { for (i=0; i<dvert->totweight; i++){ if (dvert->dw[i].def_nr == (ob->actdef-1)) { if(select) bp->f1 |= SELECT; @@ -120,7 +134,8 @@ void sel_verts_defgroup (Object *obedit, int select) } } } - } + } + } break; default: @@ -392,14 +407,15 @@ void del_defgroup (Object *ob) dvert->dw[i].def_nr--; } } - else { + else if(ob->type==OB_LATTICE) { + Lattice *lt= def_get_lattice(ob); BPoint *bp; - MDeformVert *dvert= editLatt->dvert; + MDeformVert *dvert= lt->dvert; int a, tot; if (dvert) { - tot= editLatt->pntsu*editLatt->pntsv*editLatt->pntsw; - for(a=0, bp= editLatt->def; a<tot; a++, bp++, dvert++) { + tot= lt->pntsu*lt->pntsv*lt->pntsw; + for(a=0, bp= lt->def; a<tot; a++, bp++, dvert++) { for (i=0; i<dvert->totweight; i++){ if (dvert->dw[i].def_nr > (ob->actdef-1)) dvert->dw[i].def_nr--; @@ -424,10 +440,11 @@ void del_defgroup (Object *ob) CustomData_free_layer_active(&me->vdata, CD_MDEFORMVERT, me->totvert); me->dvert= NULL; } - else { - if (editLatt->dvert) { - MEM_freeN(editLatt->dvert); - editLatt->dvert= NULL; + else if(ob->type==OB_LATTICE) { + Lattice *lt= def_get_lattice(ob); + if (lt->dvert) { + MEM_freeN(lt->dvert); + lt->dvert= NULL; } } } @@ -445,10 +462,11 @@ void del_all_defgroups (Object *ob) CustomData_free_layer_active(&me->vdata, CD_MDEFORMVERT, me->totvert); me->dvert= NULL; } - else { - if (editLatt->dvert) { - MEM_freeN(editLatt->dvert); - editLatt->dvert= NULL; + else if(ob->type==OB_LATTICE) { + Lattice *lt= def_get_lattice(ob); + if (lt->dvert) { + MEM_freeN(lt->dvert); + lt->dvert= NULL; } } @@ -500,9 +518,8 @@ void remove_vert_def_nr (Object *ob, int def_nr, int vertnum) dvert = ((Mesh*)ob->data)->dvert + vertnum; } else if(ob->type==OB_LATTICE) { - Lattice *lt= ob->data; + Lattice *lt= def_get_lattice(ob); - if(lt->editlatt) lt= lt->editlatt; if(lt->dvert) dvert = lt->dvert + vertnum; } @@ -568,10 +585,8 @@ void add_vert_defnr (Object *ob, int def_nr, int vertnum, dv = ((Mesh*)ob->data)->dvert + vertnum; } else if(ob->type==OB_LATTICE) { - Lattice *lt= ob->data; + Lattice *lt= def_get_lattice(ob); - if(lt->editlatt) lt= lt->editlatt; - if(lt->dvert) dv = lt->dvert + vertnum; } @@ -747,18 +762,19 @@ void assign_verts_defgroup (Object *obedit, float weight) break; case OB_LATTICE: { + Lattice *lt= def_get_lattice(ob); BPoint *bp; int a, tot; - if(editLatt->dvert==NULL) - create_dverts(&editLatt->id); + if(lt->dvert==NULL) + create_dverts(<->id); - tot= editLatt->pntsu*editLatt->pntsv*editLatt->pntsw; - for(a=0, bp= editLatt->def; a<tot; a++, bp++) { + tot= lt->pntsu*lt->pntsv*lt->pntsw; + for(a=0, bp= lt->def; a<tot; a++, bp++) { if(bp->f1 & SELECT) add_vert_defnr (ob, ob->actdef-1, a, weight, WEIGHT_REPLACE); } - } + } break; default: printf ("Assigning deformation groups to unknown object type\n"); @@ -807,9 +823,7 @@ static float get_vert_def_nr (Object *ob, int def_nr, int vertnum) dvert = ((Mesh*)ob->data)->dvert + vertnum; } else if(ob->type==OB_LATTICE) { - Lattice *lt= ob->data; - - if(lt->editlatt) lt= lt->editlatt; + Lattice *lt= def_get_lattice(ob); if(lt->dvert) dvert = lt->dvert + vertnum; @@ -899,16 +913,19 @@ void remove_verts_defgroup (Object *obedit, int allverts) } break; case OB_LATTICE: + { + Lattice *lt= def_get_lattice(ob); - if(editLatt->dvert) { + if(lt->dvert) { BPoint *bp; - int a, tot= editLatt->pntsu*editLatt->pntsv*editLatt->pntsw; + int a, tot= lt->pntsu*lt->pntsv*lt->pntsw; - for(a=0, bp= editLatt->def; a<tot; a++, bp++) { + for(a=0, bp= lt->def; a<tot; a++, bp++) { if(allverts || (bp->f1 & SELECT)) remove_vert_defgroup (ob, dg, a); } } + } break; default: |