bug fix #7399 crash with certain Physics button settings
authorJens Ole Wund <bjornmose@gmx.net>
Wed, 3 Oct 2007 21:01:14 +0000 (21:01 +0000)
committerJens Ole Wund <bjornmose@gmx.net>
Wed, 3 Oct 2007 21:01:14 +0000 (21:01 +0000)
-- on the fly allocating of ob->pd data was missing in SB_II panel .. still is ugly that .. shudder

source/blender/src/buttons_object.c

index cd3246fcd8d6065d5133512fadd797eba67a9fc3..55b36ce43dbdd5a2d9aa0ab14c807f8f36ffc603 100644 (file)
@@ -2807,6 +2807,13 @@ static void object_softbodies_II(Object *ob)
        uiBlock *block;
        static int val;
     if(!_can_softbodies_at_all(ob)) return;
+       /*bah that is ugly! creating missing data members in UI code*/
+       if(ob->pd == NULL){
+               ob->pd= MEM_callocN(sizeof(PartDeflect), "PartDeflect");
+               ob->pd->pdef_sbdamp = 0.1f;
+               ob->pd->pdef_sbift  = 0.2f;
+               ob->pd->pdef_sboft  = 0.02f;
+       }
        block= uiNewBlock(&curarea->uiblocks, "object_softbodies_II", UI_EMBOSS, UI_HELV, curarea->win);
        uiNewPanelTabbed("Soft Body", "Physics");
        if(uiNewPanel(curarea, block, "Soft Body Collision", "Physics", 651, 0, 318, 204)==0) return;
@@ -2825,7 +2832,7 @@ static void object_softbodies_II(Object *ob)
                        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_FIELD_CHANGE, "Damping:",       160,50,150,20, &ob->pd->pdef_sbdamp, 0.0, 1.0, 10, 0, "Amount of damping during soft body collision");
-                           uiDefButBitS(block, TOG,OB_SB_COLLFINAL , B_DIFF, "Ev.M.Stack",10,30,150,20, &ob->softflag, 0, 0, 0, 0, "Pick collision object from modifier stack");
+                               uiDefButBitS(block, TOG,OB_SB_COLLFINAL , B_DIFF, "Ev.M.Stack",10,30,150,20, &ob->softflag, 0, 0, 0, 0, "Pick collision object from modifier stack");
                                uiDefButF(block, NUM, B_FIELD_CHANGE, "Inner:", 160,30,150,20, &ob->pd->pdef_sbift, 0.001, 1.0, 10, 0, "Inner face thickness");
                                uiDefButF(block, NUM, B_FIELD_CHANGE, "Outer:", 160,10,150,20, &ob->pd->pdef_sboft, 0.001, 1.0, 10, 0, "Outer face thickness");
                        }
@@ -2870,7 +2877,7 @@ static void object_softbodies_II(Object *ob)
                        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");
-                           uiDefButBitS(block, TOG,OB_SB_COLLFINAL , B_DIFF, "Ev.M.Stack",10,30,150,20, &ob->softflag, 0, 0, 0, 0, "Pick collision object from modifier stack");
+                               uiDefButBitS(block, TOG,OB_SB_COLLFINAL , B_DIFF, "Ev.M.Stack",10,30,150,20, &ob->softflag, 0, 0, 0, 0, "Pick collision object from modifier stack");
                                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");
                        }