From af34951fbb7fc87a10e79afc8d8a9d12b81685e0 Mon Sep 17 00:00:00 2001 From: tristan Date: Fri, 29 Jun 2018 20:06:31 +0200 Subject: [PATCH] UPBGE: Fix group replication. The function AddInstanceObjects and SetDupliGroupObject must be called for every objects replicated by the group. --- release/datafiles/locale | 2 +- release/scripts/addons | 2 +- release/scripts/addons_contrib | 2 +- source/gameengine/Ketsji/KX_Scene.cpp | 16 +++++++++------- source/tools | 2 +- 5 files changed, 13 insertions(+), 11 deletions(-) diff --git a/release/datafiles/locale b/release/datafiles/locale index d3349b42856d..507eacde9608 160000 --- a/release/datafiles/locale +++ b/release/datafiles/locale @@ -1 +1 @@ -Subproject commit d3349b42856d00c278f72f2a5909a6c96b9cdb5e +Subproject commit 507eacde9608ce0190c6087fb338dd63f7a1649b diff --git a/release/scripts/addons b/release/scripts/addons index 44cbc3d71a2e..ff8ef5cb121e 160000 --- a/release/scripts/addons +++ b/release/scripts/addons @@ -1 +1 @@ -Subproject commit 44cbc3d71a2e81b42bb1685825957b0255e8b369 +Subproject commit ff8ef5cb121e590ef1a5f3e5f57b9bf99c46559d diff --git a/release/scripts/addons_contrib b/release/scripts/addons_contrib index f178e6c933a2..2ff215a19426 160000 --- a/release/scripts/addons_contrib +++ b/release/scripts/addons_contrib @@ -1 +1 @@ -Subproject commit f178e6c933a25c621a5cc7d92935b66cd2ec2f5d +Subproject commit 2ff215a194267434043433d83e4cf48eff58250c diff --git a/source/gameengine/Ketsji/KX_Scene.cpp b/source/gameengine/Ketsji/KX_Scene.cpp index 05f7e5d1fb5b..d9f5b766bc6a 100644 --- a/source/gameengine/Ketsji/KX_Scene.cpp +++ b/source/gameengine/Ketsji/KX_Scene.cpp @@ -713,13 +713,6 @@ void KX_Scene::DupliGroupRecurse(KX_GameObject *groupobj, int level) // Add to 'rootparent' list (this is the list of top hierarchy objects, updated each frame). m_parentlist->Add(CM_AddRef(replica)); - /* Set references for dupli-group - * groupobj holds a list of all objects, that belongs to this group. */ - groupobj->AddInstanceObjects(replica); - - // Every object gets the reference to its dupli-group object. - replica->SetDupliGroupObject(groupobj); - // Recurse replication into children nodes. const NodeList& children = gameobj->GetNode()->GetChildren(); @@ -758,6 +751,15 @@ void KX_Scene::DupliGroupRecurse(KX_GameObject *groupobj, int level) replica->Release(); } + // Do the linking of member objects to group object for every objects. + for (KX_GameObject *gameobj : m_logicHierarchicalGameObjects) { + /* 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); + } + /* The logic must be replicated first because we need * the new logic bricks before relinking. */ for (KX_GameObject *gameobj : m_logicHierarchicalGameObjects) { diff --git a/source/tools b/source/tools index cd4c4ec24285..b11375e89061 160000 --- a/source/tools +++ b/source/tools @@ -1 +1 @@ -Subproject commit cd4c4ec24285f780e6b92a91f3684723444c9a73 +Subproject commit b11375e89061303401376f7aeae42ac2fd64692a