diff options
author | Jens Ole Wund <bjornmose@gmx.net> | 2006-10-05 21:46:01 +0400 |
---|---|---|
committer | Jens Ole Wund <bjornmose@gmx.net> | 2006-10-05 21:46:01 +0400 |
commit | f2d27eb4cb46f816054531c1af0a7c92680fe846 (patch) | |
tree | 720999ee5182731f76a399f40eb05bc54b28118f | |
parent | 4811ba51edb612241185466792815724518d92c5 (diff) |
bug fix
only alow self collision for suited objects
feature request from hairdressers
self collision for curves
works amazingly well if you keep in mind there balls around vertices colliding
-rw-r--r-- | source/blender/blenkernel/intern/softbody.c | 5 | ||||
-rw-r--r-- | source/blender/src/buttons_object.c | 28 |
2 files changed, 21 insertions, 12 deletions
diff --git a/source/blender/blenkernel/intern/softbody.c b/source/blender/blenkernel/intern/softbody.c index fbebf1bb702..d2194cb66f2 100644 --- a/source/blender/blenkernel/intern/softbody.c +++ b/source/blender/blenkernel/intern/softbody.c @@ -1536,7 +1536,7 @@ static void mesh_to_softbody(Object *ob) build_bps_springlist(ob); /* yes we need to do it again*/ } springs_from_mesh(ob); /* write the 'rest'-lenght of the springs */ - calculate_collision_balls(ob); + if (ob->softflag & OB_SB_SELF) {calculate_collision_balls(ob);} } } @@ -1782,7 +1782,10 @@ static void curve_surf_to_softbody(Object *ob) } if(totspring) + { build_bps_springlist(ob); /* link bps to springs */ + if (ob->softflag & OB_SB_SELF) {calculate_collision_balls(ob);} + } } diff --git a/source/blender/src/buttons_object.c b/source/blender/src/buttons_object.c index c463d7f3aa3..84da744efd7 100644 --- a/source/blender/src/buttons_object.c +++ b/source/blender/src/buttons_object.c @@ -2267,11 +2267,13 @@ static void object_softbodies(Object *ob) uiDefBut(block, LABEL, 0, "",10,10,1,2, NULL, 0.0, 0, 0, 0, ""); /* tell UI we go to 10,10*/ if(ob->pd && (ob->softflag & OB_SB_COLLISIONSET)){ /* OTHER OBJECTS COLLISION STUFF */ - uiDefButBitS(block, TOG, 1, B_REDR, "Deflection",10,50,150,20, &ob->pd->deflect, 0, 0, 0, 0, "Makes this object visible to softbody objects"); - if(ob->pd->deflect) { - uiDefButF(block, NUM, B_DIFF, "Damping:", 160,50,150,20, &ob->pd->pdef_sbdamp, 0.0, 1.0, 10, 0, "Amount of damping during soft body collision"); - uiDefButF(block, NUM, B_DIFF, "Inner:", 160,30,150,20, &ob->pd->pdef_sbift, 0.001, 1.0, 10, 0, "Inner face thickness"); - uiDefButF(block, NUM, B_DIFF, "Outer:", 160,10,150,20, &ob->pd->pdef_sboft, 0.001, 1.0, 10, 0, "Outer face thickness"); + if (ob->type==OB_MESH){ + uiDefButBitS(block, TOG, 1, B_REDR, "Deflection",10,50,150,20, &ob->pd->deflect, 0, 0, 0, 0, "Makes this object visible to softbody objects"); + if(ob->pd->deflect) { + uiDefButF(block, NUM, B_DIFF, "Damping:", 160,50,150,20, &ob->pd->pdef_sbdamp, 0.0, 1.0, 10, 0, "Amount of damping during soft body collision"); + uiDefButF(block, NUM, B_DIFF, "Inner:", 160,30,150,20, &ob->pd->pdef_sbift, 0.001, 1.0, 10, 0, "Inner face thickness"); + uiDefButF(block, NUM, B_DIFF, "Outer:", 160,10,150,20, &ob->pd->pdef_sboft, 0.001, 1.0, 10, 0, "Outer face thickness"); + } } } } @@ -2317,15 +2319,19 @@ static void object_softbodies(Object *ob) } else { if(ob->softflag & OB_SB_COLLISIONSET) { - /* COLLISION STUFF */ + /* SELF COLLISION STUFF */ + if ((ob->type==OB_MESH)||(ob->type==OB_CURVE)) { uiDefButBitS(block, TOG, OB_SB_SELF, B_SOFTBODY_CHANGE, "Self Collision", 10,170,90,20, &ob->softflag, 0, 0, 0, 0, "enable naive vertex ball self collision"); uiDefButF(block, NUM, B_SOFTBODY_CHANGE, "Ball Size:", 110,170,170,20, &sb->colball, -10.0, 10.0, 10, 0, "col. ball size ==0 average spring lenght, >0 set collision ball manual, -1.0 max, -0.1 min ,-1.1 (min+max)/2"); + } /* OTHER OBJECTS COLLISION STUFF */ - uiDefButBitS(block, TOG, 1, B_REDR, "Deflection",10,50,150,20, &ob->pd->deflect, 0, 0, 0, 0, "Makes this object visible to other softbody objects"); - if(ob->pd->deflect) { - uiDefButF(block, NUM, B_DIFF, "Damping:", 160,50,150,20, &ob->pd->pdef_sbdamp, 0.0, 1.0, 10, 0, "Amount of damping during soft body collision"); - uiDefButF(block, NUM, B_DIFF, "Inner:", 160,30,150,20, &ob->pd->pdef_sbift, 0.001, 1.0, 10, 0, "Inner face thickness"); - uiDefButF(block, NUM, B_DIFF, "Outer:", 160,10,150,20, &ob->pd->pdef_sboft, 0.001, 1.0, 10, 0, "Outer face thickness"); + if (ob->type==OB_MESH){ + uiDefButBitS(block, TOG, 1, B_REDR, "Deflection",10,50,150,20, &ob->pd->deflect, 0, 0, 0, 0, "Makes this object visible to other softbody objects"); + if(ob->pd->deflect) { + uiDefButF(block, NUM, B_DIFF, "Damping:", 160,50,150,20, &ob->pd->pdef_sbdamp, 0.0, 1.0, 10, 0, "Amount of damping during soft body collision"); + uiDefButF(block, NUM, B_DIFF, "Inner:", 160,30,150,20, &ob->pd->pdef_sbift, 0.001, 1.0, 10, 0, "Inner face thickness"); + uiDefButF(block, NUM, B_DIFF, "Outer:", 160,10,150,20, &ob->pd->pdef_sboft, 0.001, 1.0, 10, 0, "Outer face thickness"); + } } uiDefBut(block, LABEL, 0, "",10,10,1,2, NULL, 0.0, 0, 0, 0, ""); /* tell UI we go to 10,10*/ |