[Bf-blender-cvs] [176ecd9] master: BGE : Fix for T43724 and T41599 addObject() with KX_FontObject and overlay scene

Porteries Tristan noreply at git.blender.org
Sun Mar 15 10:54:27 CET 2015


Commit: 176ecd9c9ca9fd0d2b28b4690e005f79177ab509
Author: Porteries Tristan
Date:   Sun Mar 15 10:36:55 2015 +0100
Branches: master
https://developer.blender.org/rB176ecd9c9ca9fd0d2b28b4690e005f79177ab509

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

===================================================================

M	source/gameengine/GameLogic/SCA_IObject.h
M	source/gameengine/Ketsji/KX_FontObject.cpp
M	source/gameengine/Ketsji/KX_FontObject.h
M	source/gameengine/Ketsji/KX_Scene.cpp

===================================================================

diff --git a/source/gameengine/GameLogic/SCA_IObject.h b/source/gameengine/GameLogic/SCA_IObject.h
index 3ffe128..d5972a0 100644
--- a/source/gameengine/GameLogic/SCA_IObject.h
+++ b/source/gameengine/GameLogic/SCA_IObject.h
@@ -221,6 +221,7 @@ public:
 		OBJ_ARMATURE=0,
 		OBJ_CAMERA=1,
 		OBJ_LIGHT=2,
+		OBJ_FONT=3,
 	} ObjectTypes;
 
 };
diff --git a/source/gameengine/Ketsji/KX_FontObject.cpp b/source/gameengine/Ketsji/KX_FontObject.cpp
index 9789a82..f3b098f 100644
--- a/source/gameengine/Ketsji/KX_FontObject.cpp
+++ b/source/gameengine/Ketsji/KX_FontObject.cpp
@@ -118,7 +118,6 @@ CValue* KX_FontObject::GetReplica()
 void KX_FontObject::ProcessReplica()
 {
 	KX_GameObject::ProcessReplica();
-	KX_GetActiveScene()->AddFont(this);
 }
 
 int GetFontId(VFont *vfont)
diff --git a/source/gameengine/Ketsji/KX_FontObject.h b/source/gameengine/Ketsji/KX_FontObject.h
index 209ab6c..3a25d36 100644
--- a/source/gameengine/Ketsji/KX_FontObject.h
+++ b/source/gameengine/Ketsji/KX_FontObject.h
@@ -54,6 +54,7 @@ public:
 	 */
 	virtual	CValue* GetReplica();
 	virtual void ProcessReplica();
+	virtual int GetGameObjectType() { return OBJ_FONT; }
 
 protected:
 	std::vector<STR_String>		m_text;
diff --git a/source/gameengine/Ketsji/KX_Scene.cpp b/source/gameengine/Ketsji/KX_Scene.cpp
index 97ebd6d..6d989ca 100644
--- a/source/gameengine/Ketsji/KX_Scene.cpp
+++ b/source/gameengine/Ketsji/KX_Scene.cpp
@@ -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.




More information about the Bf-blender-cvs mailing list