Skip to content

Commit

Permalink
UPBGE: Fix group replication.
Browse files Browse the repository at this point in the history
The function AddInstanceObjects and SetDupliGroupObject must be called
for every objects replicated by the group.
  • Loading branch information
panzergame committed Jun 29, 2018
1 parent aef8773 commit af34951
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 11 deletions.
2 changes: 1 addition & 1 deletion release/datafiles/locale
Submodule locale updated from d3349b to 507eac
2 changes: 1 addition & 1 deletion release/scripts/addons
Submodule addons updated 720 files
2 changes: 1 addition & 1 deletion release/scripts/addons_contrib
Submodule addons_contrib updated from f178e6 to 2ff215
16 changes: 9 additions & 7 deletions source/gameengine/Ketsji/KX_Scene.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion source/tools
Submodule tools updated from cd4c4e to b11375

0 comments on commit af34951

Please sign in to comment.