Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorBenoit Bolsee <benoit.bolsee@online.be>2008-09-07 02:06:01 +0400
committerBenoit Bolsee <benoit.bolsee@online.be>2008-09-07 02:06:01 +0400
commit667c8d83fb5ec719ac9d8944f37ed796f06ae2f0 (patch)
tree48b3e57f76f0c112ed10a35ccd7f9d52d18cc0ee /source
parentc7fe2199a736eff39fba5e5400a150511815525d (diff)
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.
Diffstat (limited to 'source')
-rw-r--r--source/gameengine/Converter/BL_BlenderDataConversion.cpp26
1 files changed, 19 insertions, 7 deletions
diff --git a/source/gameengine/Converter/BL_BlenderDataConversion.cpp b/source/gameengine/Converter/BL_BlenderDataConversion.cpp
index def4938b053..15e65ac9fe5 100644
--- a/source/gameengine/Converter/BL_BlenderDataConversion.cpp
+++ b/source/gameengine/Converter/BL_BlenderDataConversion.cpp
@@ -2144,7 +2144,6 @@ void BL_ConvertBlenderObjects(struct Main* maggie,
gameobj->NodeUpdateGS(0,true);
gameobj->AddMeshUser();
-
}
else
{
@@ -2209,6 +2208,24 @@ void BL_ConvertBlenderObjects(struct Main* maggie,
{
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 @@ void BL_ConvertBlenderObjects(struct Main* maggie,
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();