[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [37762] branches/soc-2011-pepper/source/ gameengine/Ketsji/BL_Action.cpp: BGE Animations: BL_Action now creates a PointerRNA only when constructed instead of on each Update () call.

Mitchell Stokes mogurijin at gmail.com
Thu Jun 23 21:20:29 CEST 2011


Revision: 37762
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=37762
Author:   moguri
Date:     2011-06-23 19:20:28 +0000 (Thu, 23 Jun 2011)
Log Message:
-----------
BGE Animations: BL_Action now creates a PointerRNA only when constructed instead of on each Update() call.

Modified Paths:
--------------
    branches/soc-2011-pepper/source/gameengine/Ketsji/BL_Action.cpp

Modified: branches/soc-2011-pepper/source/gameengine/Ketsji/BL_Action.cpp
===================================================================
--- branches/soc-2011-pepper/source/gameengine/Ketsji/BL_Action.cpp	2011-06-23 19:09:09 UTC (rev 37761)
+++ branches/soc-2011-pepper/source/gameengine/Ketsji/BL_Action.cpp	2011-06-23 19:20:28 UTC (rev 37762)
@@ -62,9 +62,16 @@
 	m_pose(NULL),
 	m_blendpose(NULL),
 	m_sg_contr(NULL),
+	m_ptrrna(NULL),
 	m_done(true)
 {
+	if (m_obj->GetGameObjectType() == SCA_IObject::OBJ_ARMATURE)
+	{
+		BL_ArmatureObject *obj = (BL_ArmatureObject*)m_obj;
 
+		m_ptrrna = new PointerRNA();
+		RNA_id_pointer_create((ID*)obj->GetArmatureObject(), m_ptrrna);
+	}
 }
 
 BL_Action::~BL_Action()
@@ -78,6 +85,8 @@
 		m_obj->GetSGNode()->RemoveSGController(m_sg_contr);
 		delete m_sg_contr;
 	}
+	if (m_ptrrna)
+		delete m_ptrrna;
 }
 
 void BL_Action::Play(const char* name,
@@ -100,7 +109,6 @@
 		return;
 	}
 
-	//if (m_obj->GetGameObjectType() != SCA_IObject::OBJ_ARMATURE)
 	if (prev_action != m_action)
 	{
 		// Create an SG_Controller
@@ -224,13 +232,11 @@
 
 		// Extract the pose from the action
 		{
-			struct PointerRNA id_ptr;
 			Object *arm = obj->GetArmatureObject();
 			bPose *temp = arm->pose;
 
 			arm->pose = m_pose;
-			RNA_id_pointer_create((ID*)arm, &id_ptr);
-			animsys_evaluate_action(&id_ptr, m_action, NULL, m_localtime);
+			animsys_evaluate_action(m_ptrrna, m_action, NULL, m_localtime);
 
 			arm->pose = temp;
 		}




More information about the Bf-blender-cvs mailing list