BGE : Fix for T43724 and T41599 addObject() with KX_FontObject and

overlay scene

GetGameObjectType is overwritten in KX_FontObject to differentiate a
font object into AddNodeReplicaObject function. Now, in this function,
we add fonts in the appropriate list.

Reviewers: campbellbarton, moguri, dfelinto, lordloki

Reviewed By: lordloki

Subscribers: lordloki

Projects: #game_logic, #game_engine

Differential Revision: https://developer.blender.org/D1130
This commit is contained in:
Porteries Tristan 2015-03-15 10:36:55 +01:00 committed by Jorge Bernal
parent 3824e0f124
commit 176ecd9c9c
Notes: blender-bot 2023-02-14 10:09:30 +01:00
Referenced by issue #43724, addObject() with KX_FontObject and overlay scene
Referenced by issue #41599, GE crashes when object from other scene is ended after adding it
4 changed files with 4 additions and 1 deletions

View File

@ -221,6 +221,7 @@ public:
OBJ_ARMATURE=0,
OBJ_CAMERA=1,
OBJ_LIGHT=2,
OBJ_FONT=3,
} ObjectTypes;
};

View File

@ -118,7 +118,6 @@ CValue* KX_FontObject::GetReplica()
void KX_FontObject::ProcessReplica()
{
KX_GameObject::ProcessReplica();
KX_GetActiveScene()->AddFont(this);
}
int GetFontId(VFont *vfont)

View File

@ -54,6 +54,7 @@ public:
*/
virtual CValue* GetReplica();
virtual void ProcessReplica();
virtual int GetGameObjectType() { return OBJ_FONT; }
protected:
std::vector<STR_String> m_text;

View File

@ -532,6 +532,8 @@ KX_GameObject* KX_Scene::AddNodeReplicaObject(class SG_IObject* node, class CVal
m_objectlist->Add(newobj->AddRef());
if (newobj->GetGameObjectType()==SCA_IObject::OBJ_LIGHT)
m_lightlist->Add(newobj->AddRef());
else if (newobj->GetGameObjectType()==SCA_IObject::OBJ_FONT)
AddFont((KX_FontObject*)newobj);
newobj->AddMeshUser();
// logic cannot be replicated, until the whole hierarchy is replicated.