diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2010-06-23 16:27:13 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2010-06-23 16:27:13 +0400 |
commit | 46d28a5e8dee014fe3aadce6c137eb5d67b9e4ac (patch) | |
tree | 0c175c802b429887d264d4510f5e1422f500b3da /source/blender/blenkernel/intern/key.c | |
parent | 08b5e5a492d5ac4097d814debb3c4520cb18e33d (diff) |
Sculpt+shape keys:
- Sculpting on the basis key should change original mesh
- For relative keys sculpting on basis key should update others
Diffstat (limited to 'source/blender/blenkernel/intern/key.c')
-rw-r--r-- | source/blender/blenkernel/intern/key.c | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/key.c b/source/blender/blenkernel/intern/key.c index 84484417f42..b8219c4aa35 100644 --- a/source/blender/blenkernel/intern/key.c +++ b/source/blender/blenkernel/intern/key.c @@ -1868,3 +1868,54 @@ void vertcos_to_key(Object *ob, KeyBlock *kb, float (*vertCos)[3]) } } } + +void offset_to_key(Object *ob, KeyBlock *kb, float (*ofs)[3]) +{ + int a; + float *co= (float*)ofs, *fp= kb->data; + + if(ELEM(ob->type, OB_MESH, OB_LATTICE)) { + for (a= 0; a<kb->totelem; a++, fp+=3, co+=3) { + add_v3_v3(fp, co); + } + } else if(ELEM(ob->type, OB_CURVE, OB_SURF)) { + Curve *cu= (Curve*)ob->data; + Nurb *nu= cu->nurb.first; + BezTriple *bezt; + BPoint *bp; + + while (nu) { + if(nu->bezt) { + int i; + bezt= nu->bezt; + a= nu->pntsu; + + while (a--) { + for (i= 0; i<3; i++) { + add_v3_v3(fp, co); + fp+= 3; co+= 3; + } + + fp+= 3; /* skip alphas */ + + bezt++; + } + } + else { + bp= nu->bp; + a= nu->pntsu*nu->pntsv; + + while (a--) { + add_v3_v3(fp, co); + + fp+= 4; + co+= 3; + + bp++; + } + } + + nu= nu->next; + } + } +} |