diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2015-07-16 18:37:42 +0300 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2015-07-16 18:53:20 +0300 |
commit | c8f6313487dfbbee030c6796220cc0d91228d658 (patch) | |
tree | 1687d641cedeb08c373a4b263a23f7c394b66406 /source/gameengine | |
parent | 2fe922437536a3418c79ffe2c26c964b98f2b366 (diff) |
Fix T45428: Sometimes in a dupligroup linked actuators are not triggered
Revert "BGE: Cleanup : merge 3 loop in 1 in function DupliGroupRecurse."
This reverts commit 371e5f25a054759014efa27c6fe4d497854ed64e.
The fix is basically to revert the cleanup commit 371e5f25 (and 3d658bf7)
Also 5dc22fbbf had to be adapted to the reverted code.
Conflicts:
source/gameengine/Ketsji/KX_Scene.cpp
Diffstat (limited to 'source/gameengine')
-rw-r--r-- | source/gameengine/Ketsji/KX_Scene.cpp | 57 |
1 files changed, 33 insertions, 24 deletions
diff --git a/source/gameengine/Ketsji/KX_Scene.cpp b/source/gameengine/Ketsji/KX_Scene.cpp index 1959b3d8b0a..fd709a87def 100644 --- a/source/gameengine/Ketsji/KX_Scene.cpp +++ b/source/gameengine/Ketsji/KX_Scene.cpp @@ -819,38 +819,47 @@ void KX_Scene::DupliGroupRecurse(CValue* obj, int level) // the logic must be replicated first because we need // the new logic bricks before relinking vector<KX_GameObject*>::iterator git; - for (git = m_logicHierarchicalGameObjects.begin(); git != m_logicHierarchicalGameObjects.end(); ++git) { - KX_GameObject *gameobj = *git; - - if (gameobj->GetBlenderGroupObject() == blgroupobj) { - // set references for dupli-group - // groupobj holds a list of all objects, that belongs to this group - groupobj->AddInstanceObjects(gameobj); - // every object gets the reference to its dupli-group object - gameobj->SetDupliGroupObject(groupobj); - } - - gameobj->ReParentLogic(); - - // relink any pointers as necessary, sort of a temporary solution + for (git = m_logicHierarchicalGameObjects.begin();!(git==m_logicHierarchicalGameObjects.end());++git) + { + (*git)->ReParentLogic(); + } + + // relink any pointers as necessary, sort of a temporary solution + for (git = m_logicHierarchicalGameObjects.begin();!(git==m_logicHierarchicalGameObjects.end());++git) + { // this will also relink the actuator to objects within the hierarchy - gameobj->Relink(&m_map_gameobject_to_replica); + (*git)->Relink(&m_map_gameobject_to_replica); // add the object in the layer of the parent - gameobj->SetLayer(groupobj->GetLayer()); + (*git)->SetLayer(groupobj->GetLayer()); + } - // replicate crosslinks etc. between logic bricks - ReplicateLogic(gameobj); + // replicate crosslinks etc. between logic bricks + for (git = m_logicHierarchicalGameObjects.begin();!(git==m_logicHierarchicalGameObjects.end());++git) + { + ReplicateLogic((*git)); + } - // now look if object in the hierarchy have dupli group and recurse + // now look if object in the hierarchy have dupli group and recurse + for (git = m_logicHierarchicalGameObjects.begin();!(git==m_logicHierarchicalGameObjects.end());++git) + { /* Replicate all constraints. */ - if (gameobj->GetPhysicsController()) { - gameobj->GetPhysicsController()->ReplicateConstraints(gameobj, m_logicHierarchicalGameObjects); - gameobj->ClearConstraints(); + if ((*git)->GetPhysicsController()) { + (*git)->GetPhysicsController()->ReplicateConstraints((*git), m_logicHierarchicalGameObjects); + (*git)->ClearConstraints(); } - if (gameobj != groupobj && gameobj->IsDupliGroup()) + if ((*git) != groupobj && (*git)->IsDupliGroup()) // can't instantiate group immediately as it destroys m_logicHierarchicalGameObjects - duplilist.push_back(gameobj); + duplilist.push_back((*git)); + + if ((*git)->GetBlenderGroupObject() == blgroupobj) { + // set references for dupli-group + // groupobj holds a list of all objects, that belongs to this group + groupobj->AddInstanceObjects((*git)); + + // every object gets the reference to its dupli-group object + (*git)->SetDupliGroupObject(groupobj); + } } for (git = duplilist.begin(); !(git == duplilist.end()); ++git) |