BGE patch: support runtime duplication of groups. Adding an object with Dupligroup option set will cause the group to be instantiated. No special actuator is needed for this feature, just put dupligroup objects in inactive layers and add them dynamically
This commit is contained in:
@@ -2027,8 +2027,8 @@ void BL_ConvertBlenderObjects(struct Main* maggie,
|
||||
// needed for python scripting
|
||||
logicmgr->RegisterGameObjectName(gameobj->GetName(),gameobj);
|
||||
|
||||
// needed for dynamic object morphing
|
||||
logicmgr->RegisterGameObj(gameobj, blenderobject);
|
||||
// needed for group duplication
|
||||
logicmgr->RegisterGameObj(blenderobject, gameobj);
|
||||
for (int i = 0; i < gameobj->GetMeshCount(); i++)
|
||||
logicmgr->RegisterGameMeshName(gameobj->GetMesh(i)->GetName(), blenderobject);
|
||||
|
||||
@@ -2050,8 +2050,6 @@ void BL_ConvertBlenderObjects(struct Main* maggie,
|
||||
gameobj->NodeUpdateGS(0,true);
|
||||
gameobj->Bucketize();
|
||||
|
||||
if (gameobj->IsDupliGroup())
|
||||
grouplist.insert(blenderobject->dup_group);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2059,6 +2057,8 @@ void BL_ConvertBlenderObjects(struct Main* maggie,
|
||||
//at the end of this function if it is not a root object
|
||||
inactivelist->Add(gameobj->AddRef());
|
||||
}
|
||||
if (gameobj->IsDupliGroup())
|
||||
grouplist.insert(blenderobject->dup_group);
|
||||
if (converter->addInitFromFrame){
|
||||
gameobj->NodeSetLocalPosition(posPrev);
|
||||
gameobj->NodeSetLocalOrientation(angor);
|
||||
@@ -2109,7 +2109,7 @@ void BL_ConvertBlenderObjects(struct Main* maggie,
|
||||
blenderscene);
|
||||
|
||||
// this code is copied from above except that
|
||||
// object from groups are never is active layer
|
||||
// object from groups are never in active layer
|
||||
bool isInActiveLayer = false;
|
||||
bool addobj=true;
|
||||
|
||||
@@ -2207,8 +2207,8 @@ void BL_ConvertBlenderObjects(struct Main* maggie,
|
||||
// needed for python scripting
|
||||
logicmgr->RegisterGameObjectName(gameobj->GetName(),gameobj);
|
||||
|
||||
// needed for dynamic object morphing
|
||||
logicmgr->RegisterGameObj(gameobj, blenderobject);
|
||||
// needed for group duplication
|
||||
logicmgr->RegisterGameObj(blenderobject, gameobj);
|
||||
for (int i = 0; i < gameobj->GetMeshCount(); i++)
|
||||
logicmgr->RegisterGameMeshName(gameobj->GetMesh(i)->GetName(), blenderobject);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user