diff options
author | Jens Ole Wund <bjornmose@gmx.net> | 2008-02-02 02:20:29 +0300 |
---|---|---|
committer | Jens Ole Wund <bjornmose@gmx.net> | 2008-02-02 02:20:29 +0300 |
commit | d09fe9d228ff82e61d8da50f1b18c790dcef6862 (patch) | |
tree | 8940d7d3dda70bce773fa8fa7d91095226912b1e /source/blender | |
parent | 9d9ba570386a90285288daddcfcc5c399649585f (diff) |
users feature request
-- material memory
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenkernel/intern/softbody.c | 27 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_object_force.h | 2 | ||||
-rw-r--r-- | source/blender/src/buttons_object.c | 8 |
3 files changed, 31 insertions, 6 deletions
diff --git a/source/blender/blenkernel/intern/softbody.c b/source/blender/blenkernel/intern/softbody.c index e23708aa328..0186fad5c13 100644 --- a/source/blender/blenkernel/intern/softbody.c +++ b/source/blender/blenkernel/intern/softbody.c @@ -2913,7 +2913,6 @@ static void softbody_apply_forces(Object *ob, float forcetime, int mode, float * VecMulf(dx,forcetime); /* the freezer */ - /* disable slip stich for now if ((Inpf(dx,dx)<freezeloc )&&(Inpf(bp->force,bp->force)<freezeforce )){ bp->frozen /=2; } @@ -2921,7 +2920,6 @@ static void softbody_apply_forces(Object *ob, float forcetime, int mode, float * bp->frozen =MIN2(bp->frozen*1.05f,1.0f); } VecMulf(dx,bp->frozen); - */ /* again some nasty if's to have heun in here too */ if (mode ==1){ @@ -3085,6 +3083,30 @@ static void softbody_apply_goalsnap(Object *ob) } } + +void apply_spring_memory(Object *ob) +{ + SoftBody *sb = ob->soft; + BodySpring *bs; + BodyPoint *bp1, *bp2; + int a; + float b,l,r; + + b = sb->plastic; + if (sb && sb->totspring){ + for(a=0; a<sb->totspring; a++) { + bs = &sb->bspring[a]; + bp1 =&sb->bpoint[bs->v1]; + bp2 =&sb->bpoint[bs->v2]; + l = VecLenf(bp1->pos,bp2->pos); + r = bs->len/l; + if (( r > 1.05f) || (r < 0.95)){ + bs->len = ((100.0f - b) * bs->len + b*l)/100.0f; + } + } + } +} + /* expects full initialized softbody */ static void interpolate_exciter(Object *ob, int timescale, int time) { @@ -4372,6 +4394,7 @@ void sbObjectStep(Object *ob, float framenr, float (*vertexCos)[3], int numVerts else{ printf("softbody no valid solver ID!"); }/*SOLVER SELECT*/ + if(sb->plastic){ apply_spring_memory(ob);} if(sb->solverflags & SBSO_MONITOR ){ sct=PIL_check_seconds_timer(); diff --git a/source/blender/makesdna/DNA_object_force.h b/source/blender/makesdna/DNA_object_force.h index 928fcc4a4e0..c2500fba7fe 100644 --- a/source/blender/makesdna/DNA_object_force.h +++ b/source/blender/makesdna/DNA_object_force.h @@ -130,7 +130,7 @@ typedef struct SoftBody { maxloops, choke, solver_ID, - pad4,pad5 + plastic,pad5 ; struct SBScratch *scratch; /* scratch pad/cache on live time not saved in file */ diff --git a/source/blender/src/buttons_object.c b/source/blender/src/buttons_object.c index b3b1c0da99e..268e6a48898 100644 --- a/source/blender/src/buttons_object.c +++ b/source/blender/src/buttons_object.c @@ -3936,12 +3936,14 @@ static void object_softbodies(Object *ob) uiDefButF(block, NUM, B_DIFF, "E Pull:", 10,30,100,20, &sb->inspring, 0.0, 0.999, 10, 0, "Edge spring stiffness when longer than rest length"); uiDefButF(block, NUM, B_DIFF, "E Push:", 110,30,100,20, &sb->inpush, 0.0, 0.999, 10, 0, "Edge spring stiffness when shorter than rest length"); uiDefButF(block, NUM, B_DIFF, "E Damp:", 210,30,100,20, &sb->infrict, 0.0, 50.0, 10, 0, "Edge spring friction"); + uiDefButBitS(block, TOG,OB_SB_AERO_ANGLE,B_SOFTBODY_CHANGE, "N",10,10,20,20, softflag, 0, 0, 0, 0, "New aero(uses angle and length)"); - uiDefButS(block, NUM, B_DIFF, "Aero:", 30,10,80,20, &sb->aeroedge, 0.00, 30000.0, 10, 0, "Make edges 'sail'"); + uiDefButS(block, NUM, B_DIFF, "Aero:", 30,10,60,20, &sb->aeroedge, 0.00, 30000.0, 10, 0, "Make edges 'sail'"); + uiDefButS(block, NUM, B_SOFTBODY_CHANGE, "Plas:", 90,10,60,20, &sb->plastic, 0.0, 100.0, 10, 0, "Permanent deform"); if(ob->type==OB_MESH) { - uiDefButF(block, NUM, B_SOFTBODY_CHANGE, "Bend:", 110,10,100,20, &sb->secondspring, 0.0, 10.0, 10, 0, "Strenght of Springs over 2 Edges"); + uiDefButF(block, NUM, B_SOFTBODY_CHANGE, "Be:", 150,10,80,20, &sb->secondspring, 0.0, 10.0, 10, 0, "Bendig Stiffness"); if (*softflag & OB_SB_QUADS){ - uiDefButF(block, NUM, B_SOFTBODY_CHANGE, "Shear:", 210,10,100,20, &sb->shearstiff, 0.0, 1.0, 10, 0, "Strenght of diagonal Springs"); + uiDefButF(block, NUM, B_SOFTBODY_CHANGE, "Sh:", 230,10,80,20, &sb->shearstiff, 0.0, 1.0, 10, 0, "Shear Stiffness"); } } else sb->secondspring = 0; |