[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [56756] trunk/blender/source/gameengine/ Ketsji: Fix #35329: action actuator crash with replacemesh, pointers got outdated.

Brecht Van Lommel brechtvanlommel at pandora.be
Mon May 13 12:54:57 CEST 2013


Revision: 56756
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=56756
Author:   blendix
Date:     2013-05-13 10:54:57 +0000 (Mon, 13 May 2013)
Log Message:
-----------
Fix #35329: action actuator crash with replacemesh, pointers got outdated.
No need to cache this, creating it is quick.

Modified Paths:
--------------
    trunk/blender/source/gameengine/Ketsji/BL_Action.cpp
    trunk/blender/source/gameengine/Ketsji/BL_Action.h

Modified: trunk/blender/source/gameengine/Ketsji/BL_Action.cpp
===================================================================
--- trunk/blender/source/gameengine/Ketsji/BL_Action.cpp	2013-05-13 10:40:42 UTC (rev 56755)
+++ trunk/blender/source/gameengine/Ketsji/BL_Action.cpp	2013-05-13 10:54:57 UTC (rev 56756)
@@ -55,7 +55,6 @@
 	m_pose(NULL),
 	m_blendpose(NULL),
 	m_blendinpose(NULL),
-	m_ptrrna(NULL),
 	m_obj(gameobj),
 	m_startframe(0.f),
 	m_endframe(0.f),
@@ -71,24 +70,6 @@
 	m_done(true),
 	m_calc_localtime(true)
 {
-	if (m_obj->GetGameObjectType() == SCA_IObject::OBJ_ARMATURE)
-	{
-		BL_ArmatureObject *obj = (BL_ArmatureObject*)m_obj;
-
-		m_ptrrna = new PointerRNA();
-		RNA_id_pointer_create(&obj->GetArmatureObject()->id, m_ptrrna);
-	}
-	else
-	{
-		BL_DeformableGameObject *obj = (BL_DeformableGameObject*)m_obj;
-		BL_ShapeDeformer *shape_deformer = dynamic_cast<BL_ShapeDeformer*>(obj->GetDeformer());
-
-		if (shape_deformer)
-		{
-			m_ptrrna = new PointerRNA();
-			RNA_id_pointer_create(&shape_deformer->GetKey()->id, m_ptrrna);
-		}
-	}
 }
 
 BL_Action::~BL_Action()
@@ -99,8 +80,6 @@
 		game_free_pose(m_blendpose);
 	if (m_blendinpose)
 		game_free_pose(m_blendinpose);
-	if (m_ptrrna)
-		delete m_ptrrna;
 	ClearControllerList();
 }
 
@@ -426,8 +405,12 @@
 			bPose *temp = arm->pose;
 
 			arm->pose = m_pose;
-			animsys_evaluate_action(m_ptrrna, m_action, NULL, m_localtime);
 
+			PointerRNA ptrrna;
+			RNA_id_pointer_create(&arm->id, &ptrrna);
+
+			animsys_evaluate_action(&ptrrna, m_action, NULL, m_localtime);
+
 			arm->pose = temp;
 		}
 
@@ -465,8 +448,10 @@
 		{
 			Key *key = shape_deformer->GetKey();
 
+			PointerRNA ptrrna;
+			RNA_id_pointer_create(&key->id, &ptrrna);
 
-			animsys_evaluate_action(m_ptrrna, m_action, NULL, m_localtime);
+			animsys_evaluate_action(&ptrrna, m_action, NULL, m_localtime);
 
 			// Handle blending between shape actions
 			if (m_blendin && m_blendframe < m_blendin)

Modified: trunk/blender/source/gameengine/Ketsji/BL_Action.h
===================================================================
--- trunk/blender/source/gameengine/Ketsji/BL_Action.h	2013-05-13 10:40:42 UTC (rev 56755)
+++ trunk/blender/source/gameengine/Ketsji/BL_Action.h	2013-05-13 10:54:57 UTC (rev 56756)
@@ -42,7 +42,6 @@
 	struct bPose* m_pose;
 	struct bPose* m_blendpose;
 	struct bPose* m_blendinpose;
-	struct PointerRNA *m_ptrrna;
 	std::vector<class SG_Controller*> m_sg_contr_list;
 	class KX_GameObject* m_obj;
 	std::vector<float>	m_blendshape;




More information about the Bf-blender-cvs mailing list