Skip to content

Commit

Permalink
UPBGE: Fix components of group instances.
Browse files Browse the repository at this point in the history
Previously group instances were created in pre conversion (BL_ConvertBlenderObjects)
but only added to scene active objects. In post conversion (BL_PostConvertBlenderObjects)
where the component conversion take place, only the objects in the converter
are converting components, but these are not group instances.

This introduced that group instance could not use components. To solve this
issue, the group instances must be created after component conversion as
a normal object is duplicated.

Fix issue: #957.
  • Loading branch information
panzergame authored and youle31 committed May 26, 2019
1 parent 732ba41 commit 1522a0f
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions source/gameengine/Converter/BL_BlenderDataConversion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1834,19 +1834,6 @@ void BL_ConvertBlenderObjects(struct Main *maggie,
// Cleanup converted set of group objects.
convertedlist->Release();
logicbrick_conversionlist->Release();

/* Instantiate dupli group, we will loop trough the object
* that are in active layers. Note that duplicating group
* has the effect of adding objects at the end of objectlist.
* Only loop through the first part of the list.
*/
int objcount = objectlist->GetCount();
for (unsigned int i = 0; i < objcount; ++i) {
KX_GameObject *gameobj = objectlist->GetValue(i);
if (gameobj->IsDupliGroup()) {
kxscene->DupliGroupRecurse(gameobj, 0);
}
}
}

void BL_PostConvertBlenderObjects(KX_Scene *kxscene, const BL_SceneConverter& sceneconverter)
Expand Down Expand Up @@ -1912,5 +1899,18 @@ void BL_PostConvertBlenderObjects(KX_Scene *kxscene, const BL_SceneConverter& sc
}
}
}

/* Instantiate dupli group, we will loop trough the object
* that are in active layers. Note that duplicating group
* has the effect of adding objects at the end of objectlist.
* Only loop through the first part of the list.
*/
const unsigned int objcount = objectlist->GetCount();
for (unsigned int i = 0; i < objcount; ++i) {
KX_GameObject *gameobj = objectlist->GetValue(i);
if (gameobj->IsDupliGroup()) {
kxscene->DupliGroupRecurse(gameobj, 0);
}
}
}

0 comments on commit 1522a0f

Please sign in to comment.