Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMitchell Stokes <mogurijin@gmail.com>2011-06-23 23:20:28 +0400
committerMitchell Stokes <mogurijin@gmail.com>2011-06-23 23:20:28 +0400
commit8d179ca920d29dad1abfd91e27b8f6632fc86dca (patch)
tree312dfbf4e80a41482d8fb2d6f026612225ae0286 /source/gameengine/Ketsji/BL_Action.cpp
parent2d2aa95227e3b00f9dc42293d4231af3dc5a99b9 (diff)
BGE Animations: BL_Action now creates a PointerRNA only when constructed instead of on each Update() call.
Diffstat (limited to 'source/gameengine/Ketsji/BL_Action.cpp')
-rw-r--r--source/gameengine/Ketsji/BL_Action.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/source/gameengine/Ketsji/BL_Action.cpp b/source/gameengine/Ketsji/BL_Action.cpp
index 836bc24ffcd..078c69ab9e2 100644
--- a/source/gameengine/Ketsji/BL_Action.cpp
+++ b/source/gameengine/Ketsji/BL_Action.cpp
@@ -62,9 +62,16 @@ BL_Action::BL_Action(class KX_GameObject* gameobj)
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 @@ BL_Action::~BL_Action()
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 @@ void BL_Action::Play(const char* name,
return;
}
- //if (m_obj->GetGameObjectType() != SCA_IObject::OBJ_ARMATURE)
if (prev_action != m_action)
{
// Create an SG_Controller
@@ -224,13 +232,11 @@ void BL_Action::Update(float curtime)
// 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;
}