fix for crash when a parent compound object didn't get a physics controller.

also show this in the UI.
This commit is contained in:
Campbell Barton 2009-08-27 23:29:07 +00:00
parent 324b3fbe74
commit d7bf9688ac
2 changed files with 17 additions and 9 deletions

@ -3513,14 +3513,20 @@ static void buttons_bullet(uiBlock *block, Object *ob)
}
if (ob->body_type!=OB_BODY_TYPE_SOFT)
{
if (ob->parent)
uiDefButBitI(block, TOG, OB_CHILD, B_REDR, "Add to parent", 240,105,110,19,
&ob->gameflag, 0, 0, 0, 0,
"Add this shape to the parent compound shape");
else
uiDefButBitI(block, TOG, OB_CHILD, B_REDR, "Compound", 240,105,110,19,
&ob->gameflag, 0, 0, 0, 0,
"Create a compound shape with the children's shape that are tagged for addition");
if (ob->parent) {
if(ob->parent->gameflag & (OB_DYNAMIC|OB_COLLISION)) {
uiDefButBitI(block, TOG, OB_CHILD, B_REDR, "Add to parent", 240,105,110,19,
&ob->gameflag, 0, 0, 0, 0,
"Add this shape to the parent compound shape");
}
}
else {
if(ob->gameflag & (OB_DYNAMIC|OB_COLLISION)) {
uiDefButBitI(block, TOG, OB_CHILD, B_REDR, "Compound", 240,105,110,19,
&ob->gameflag, 0, 0, 0, 0,
"Create a compound shape with the children's shape that are tagged for addition");
}
}
}
}
uiBlockEndAlign(block);

@ -1381,7 +1381,9 @@ void BL_CreatePhysicsObjectNew(KX_GameObject* gameobj,
bool isCompoundChild = false;
bool hasCompoundChildren = !parent && (blenderobject->gameflag & OB_CHILD);
if (parent/* && (parent->gameflag & OB_DYNAMIC)*/) {
/* When the parent is not OB_DYNAMIC and has no OB_COLLISION then it gets no bullet controller
* and cant be apart of the parents compound shape */
if (parent && (parent->gameflag & (OB_DYNAMIC | OB_COLLISION))) {
if ((parent->gameflag & OB_CHILD) != 0 && (blenderobject->gameflag & OB_CHILD))
{