Special Orange request; support for SoftBody Goal weights for Lattices.

Animating detailed clothes with softbody becomes messy, so now we'll
try it this way. :)

It simply uses the W (weight) value, as already available in each Lattice
Point. Only had to make it editable;

- NKey panel
- or press W in editmode

Further there's a minimalistic W button in the softbody Panel!
This commit is contained in:
2005-11-16 21:58:49 +00:00
parent 7a60679c75
commit befd6f3150
5 changed files with 63 additions and 19 deletions

View File

@@ -1043,6 +1043,7 @@ static void makelatticesprings(Lattice *lt, BodySpring *bs, int dostiff)
static void lattice_to_softbody(Object *ob,int *rcs)
{
Lattice *lt= ob->data;
SoftBody *sb= ob->soft;
int totvert, totspring = 0;
totvert= lt->pntsu*lt->pntsv*lt->pntsw;
@@ -1060,6 +1061,22 @@ static void lattice_to_softbody(Object *ob,int *rcs)
/* renew ends with ob->soft with points and edges, also checks & makes ob->soft */
renew_softbody(ob, totvert, totspring,rcs);
/* weights from bpoints, same code used as for mesh vertices */
if((ob->softflag & OB_SB_GOAL) && sb->vertgroup) {
BodyPoint *bp= sb->bpoint;
BPoint *bpnt= lt->def;
float goalfac= ABS(sb->maxgoal - sb->mingoal);
int a;
for(a=0; a<totvert; a++, bp++, bpnt++) {
bp->goal= sb->mingoal + bpnt->vec[3]*goalfac;
/* a little ad hoc changing the goal control to be less *sharp* */
bp->goal = (float)pow(bp->goal, 4.0f);
}
}
/* create some helper edges to enable SB lattice to be usefull at all */
if (ob->softflag & OB_SB_EDGES){
makelatticesprings(lt,ob->soft->bspring,ob->softflag & OB_SB_QUADS);