bug fix
authorJens Ole Wund <bjornmose@gmx.net>
Thu, 5 Oct 2006 17:46:01 +0000 (17:46 +0000)
committerJens Ole Wund <bjornmose@gmx.net>
Thu, 5 Oct 2006 17:46:01 +0000 (17:46 +0000)
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

source/blender/blenkernel/intern/softbody.c
source/blender/src/buttons_object.c

index fbebf1bb70294a2e9e70181f38f10c99afd034a5..d2194cb66f276a4a15d326b968d231b92b8b5eea 100644 (file)
@@ -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);}
+       }
 }
 
 
index c463d7f3aa305493c91eb59b95ae41593e1fb5a9..84da744efd7ae8a69e2040bfe5e8471e4333fb30 100644 (file)
@@ -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*/