Revision: 16399 http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=16399 Author: ben2610 Date: 2008-09-07 00:06:01 +0200 (Sun, 07 Sep 2008)
Log Message: ----------- BGE patch: break parent relationship when child and parent are not active/inactive at the same time. This unusual situation is used in Apricot for test purposes. Modified Paths: -------------- trunk/blender/source/gameengine/Converter/BL_BlenderDataConversion.cpp Modified: trunk/blender/source/gameengine/Converter/BL_BlenderDataConversion.cpp =================================================================== --- trunk/blender/source/gameengine/Converter/BL_BlenderDataConversion.cpp 2008-09-06 17:49:26 UTC (rev 16398) +++ trunk/blender/source/gameengine/Converter/BL_BlenderDataConversion.cpp 2008-09-06 22:06:01 UTC (rev 16399) @@ -2144,7 +2144,6 @@ gameobj->NodeUpdateGS(0,true); gameobj->AddMeshUser(); - } else { @@ -2209,6 +2208,24 @@ { struct Object* blenderchild = pcit->m_blenderchild; + struct Object* blenderparent = blenderchild->parent; + KX_GameObject* parentobj = converter->FindGameObject(blenderparent); + KX_GameObject* childobj = converter->FindGameObject(blenderchild); + + assert(childobj); + + if (!parentobj || objectlist->SearchValue(childobj) != objectlist->SearchValue(parentobj)) + { + // special case: the parent and child object are not in the same layer. + // This weird situation is used in Apricot for test purposes. + // Resolve it by breaking the parent relationship + childobj->GetSGNode()->DisconnectFromParent(); + delete pcit->m_gamechildnode; + // This leave the child object is an incorrect position: its local position becomes + // the global position but we don't care: the child should be in an invisble layer + continue; + } + switch (blenderchild->partype) { case PARVERT1: @@ -2248,12 +2265,7 @@ break; } - struct Object* blenderparent = blenderchild->parent; - KX_GameObject* parentobj = converter->FindGameObject(blenderparent); - if (parentobj) - { - parentobj-> GetSGNode()->AddChild(pcit->m_gamechildnode); - } + parentobj-> GetSGNode()->AddChild(pcit->m_gamechildnode); } vec_parent_child.clear(); _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org http://lists.blender.org/mailman/listinfo/bf-blender-cvs