diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2013-05-13 14:54:57 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2013-05-13 14:54:57 +0400 |
commit | 21955ac8aae315f59ef55088cce32234ce60a3ea (patch) | |
tree | 8a5d3cdedf7dc80ba377393031b23be5914c3604 /source/gameengine | |
parent | fa4ef0828e0211fdfdd06b125ed244cba06c1293 (diff) |
Fix #35329: action actuator crash with replacemesh, pointers got outdated.
No need to cache this, creating it is quick.
Diffstat (limited to 'source/gameengine')
-rw-r--r-- | source/gameengine/Ketsji/BL_Action.cpp | 31 | ||||
-rw-r--r-- | source/gameengine/Ketsji/BL_Action.h | 1 |
2 files changed, 8 insertions, 24 deletions
diff --git a/source/gameengine/Ketsji/BL_Action.cpp b/source/gameengine/Ketsji/BL_Action.cpp index fa00cafa148..07295d238ef 100644 --- a/source/gameengine/Ketsji/BL_Action.cpp +++ b/source/gameengine/Ketsji/BL_Action.cpp @@ -55,7 +55,6 @@ BL_Action::BL_Action(class KX_GameObject* gameobj) 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 @@ BL_Action::BL_Action(class KX_GameObject* gameobj) 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 @@ BL_Action::~BL_Action() game_free_pose(m_blendpose); if (m_blendinpose) game_free_pose(m_blendinpose); - if (m_ptrrna) - delete m_ptrrna; ClearControllerList(); } @@ -426,7 +405,11 @@ void BL_Action::Update(float curtime) 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 @@ void BL_Action::Update(float curtime) { 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) diff --git a/source/gameengine/Ketsji/BL_Action.h b/source/gameengine/Ketsji/BL_Action.h index 370bbf51d72..e4088633e61 100644 --- a/source/gameengine/Ketsji/BL_Action.h +++ b/source/gameengine/Ketsji/BL_Action.h @@ -42,7 +42,6 @@ private: 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; |