Commit: c8f6313487dfbbee030c6796220cc0d91228d658
Author: Dalai Felinto
Date:   Thu Jul 16 12:37:42 2015 -0300
Branches: master
https://developer.blender.org/rBc8f6313487dfbbee030c6796220cc0d91228d658

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

===================================================================

M       source/gameengine/Ketsji/KX_Scene.cpp

===================================================================

diff --git a/source/gameengine/Ketsji/KX_Scene.cpp 
b/source/gameengine/Ketsji/KX_Scene.cpp
index 1959b3d..fd709a8 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)

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to