[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [38407] branches/soc-2011-cucumber/source/ gameengine/Ketsji/KX_FontObject.cpp: Changing the "text" property of a KX_FontObject now changes the text.

Daniel Stokes kupomail at gmail.com
Fri Jul 15 02:01:24 CEST 2011


Revision: 38407
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=38407
Author:   kupoman
Date:     2011-07-15 00:01:23 +0000 (Fri, 15 Jul 2011)
Log Message:
-----------
Changing the "text" property of a KX_FontObject now changes the text. This allows for control of a FontObject through logic bricks.

Modified Paths:
--------------
    branches/soc-2011-cucumber/source/gameengine/Ketsji/KX_FontObject.cpp

Modified: branches/soc-2011-cucumber/source/gameengine/Ketsji/KX_FontObject.cpp
===================================================================
--- branches/soc-2011-cucumber/source/gameengine/Ketsji/KX_FontObject.cpp	2011-07-14 22:01:09 UTC (rev 38406)
+++ branches/soc-2011-cucumber/source/gameengine/Ketsji/KX_FontObject.cpp	2011-07-15 00:01:23 UTC (rev 38407)
@@ -119,6 +119,10 @@
 
 void KX_FontObject::DrawText()
 {
+	/* Allow for some logic brick control */
+	if(this->GetProperty("text"))
+		m_text = split_string(this->GetProperty("text")->GetText());
+
 	/* only draws the text if visible */
 	if(this->GetVisible() == 0) return;
 
@@ -131,19 +135,19 @@
 	float size = m_fsize * m_object->size[0] * RES;
 	float aspect = 1.f / (m_object->size[0] * RES);
 
-	// Get a working copy of the OpenGLMatrix to use
+	/* Get a working copy of the OpenGLMatrix to use */
 	double mat[16];
 	memcpy(mat, this->GetOpenGLMatrix(), sizeof(double)*16);
 
-	//Account for offset
+	/* Account for offset */
 	MT_Vector3 offset = this->NodeGetWorldOrientation() * m_offset;
 	mat[12] += offset[0]; mat[13] += offset[1]; mat[14] += offset[2];
 
-	//Orient the spacing vector
+	/* Orient the spacing vector */
 	MT_Vector3 spacing = MT_Vector3(0, m_fsize*m_line_spacing, 0);
 	spacing =this->NodeGetWorldOrientation() * spacing;
 
-	//Draw each line, taking spacing into consideration
+	/* Draw each line, taking spacing into consideration */
 	for(int i=0; i<m_text.size(); ++i)
 	{
 		if (i!=0)




More information about the Bf-blender-cvs mailing list