BGE fix: Parenting the object to itself crashes BGE + stubs update

it may happen if you start doing exec, setParent, ... in Python
not a big deal, but to crash Blender is always bad
This commit is contained in:
Dalai Felinto 2010-03-31 22:49:59 +00:00
parent c19725b266
commit ea0e0b3f15
2 changed files with 4 additions and 1 deletions

@ -186,6 +186,8 @@ int WM_keymap_item_compare(struct wmKeyMapItem *k1, struct wmKeyMapItem *k2){ret
/* rna editors */
int insert_vert_fcurve(struct FCurve *fcu, float x, float y, short flag){return 0;}
void delete_fcurve_key(struct FCurve *fcu, int index, short do_recalc){}
struct KeyingSetInfo *ANIM_keyingset_info_find_named (const char name[]){return (struct KeyingSetInfo *) NULL;}
struct KeyingSet *ANIM_scene_get_active_keyingset (struct Scene *scene){return (struct KeyingSet *) NULL;}
int ANIM_scene_get_keyingset_index(struct Scene *scene, struct KeyingSet *ks){return 0;}

@ -238,7 +238,8 @@ void KX_GameObject::SetParent(KX_Scene *scene, KX_GameObject* obj, bool addToCom
GetSGNode() && // object is not zombi
obj->GetSGNode() && // object is not zombi
GetSGNode()->GetSGParent() != obj->GetSGNode() && // not already parented to same object
!GetSGNode()->IsAncessor(obj->GetSGNode())) // no parenting loop
!GetSGNode()->IsAncessor(obj->GetSGNode()) && // no parenting loop
this != obj) // not the object itself
{
// Make sure the objects have some scale
MT_Vector3 scale1 = NodeGetWorldScaling();