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:
Diffstat (limited to 'source/gameengine/Converter/BL_ShapeActionActuator.cpp')
-rw-r--r--source/gameengine/Converter/BL_ShapeActionActuator.cpp55
1 files changed, 51 insertions, 4 deletions
diff --git a/source/gameengine/Converter/BL_ShapeActionActuator.cpp b/source/gameengine/Converter/BL_ShapeActionActuator.cpp
index bb53c2d6fe6..ac377cdb7ca 100644
--- a/source/gameengine/Converter/BL_ShapeActionActuator.cpp
+++ b/source/gameengine/Converter/BL_ShapeActionActuator.cpp
@@ -59,10 +59,49 @@
extern "C" {
#include "BKE_animsys.h"
+ #include "BKE_key.h"
+ #include "RNA_access.h"
}
+BL_ShapeActionActuator::BL_ShapeActionActuator(SCA_IObject* gameobj,
+ const STR_String& propname,
+ const STR_String& framepropname,
+ float starttime,
+ float endtime,
+ struct bAction *action,
+ short playtype,
+ short blendin,
+ short priority,
+ float stride)
+ : SCA_IActuator(gameobj, KX_ACT_SHAPEACTION),
+
+ m_lastpos(0, 0, 0),
+ m_blendframe(0),
+ m_flag(0),
+ m_startframe (starttime),
+ m_endframe(endtime) ,
+ m_starttime(0),
+ m_localtime(starttime),
+ m_lastUpdate(-1),
+ m_blendin(blendin),
+ m_blendstart(0),
+ m_stridelength(stride),
+ m_playtype(playtype),
+ m_priority(priority),
+ m_action(action),
+ m_framepropname(framepropname),
+ m_propname(propname)
+{
+ m_idptr = new PointerRNA();
+ BL_DeformableGameObject *obj = (BL_DeformableGameObject*)GetParent();
+ BL_ShapeDeformer *shape_deformer = dynamic_cast<BL_ShapeDeformer*>(obj->GetDeformer());
+ RNA_id_pointer_create(&shape_deformer->GetKey()->id, m_idptr);
+};
+
BL_ShapeActionActuator::~BL_ShapeActionActuator()
{
+ if (m_idptr)
+ delete m_idptr;
}
void BL_ShapeActionActuator::ProcessReplica()
@@ -382,7 +421,11 @@ bool BL_ShapeActionActuator::Update(double curtime, bool frame)
/* Priority test */
if (obj->SetActiveAction(this, priority, curtime)){
- Key *key = obj->GetKey();
+ BL_ShapeDeformer *shape_deformer = dynamic_cast<BL_ShapeDeformer*>(obj->GetDeformer());
+ Key *key = NULL;
+
+ if (shape_deformer)
+ key = shape_deformer->GetKey();
if (!key) {
// this could happen if the mesh was changed in the middle of an action
@@ -397,10 +440,14 @@ bool BL_ShapeActionActuator::Update(double curtime, bool frame)
obj->GetShape(m_blendshape);
m_blendstart = curtime;
}
- // only interested in shape channel
- // in 2.4x was // extract_ipochannels_from_action(&tchanbase, &key->id, m_action, "Shape", m_localtime);
- BKE_animsys_evaluate_animdata(&key->id, key->adt, m_localtime, ADT_RECALC_ANIM);
+ KeyBlock *kb;
+ // We go through and clear out the keyblocks so there isn't any interference
+ // from other shape actions
+ for (kb=(KeyBlock*)key->block.first; kb; kb=(KeyBlock*)kb->next)
+ kb->curval = 0.f;
+
+ animsys_evaluate_action(m_idptr, m_action, NULL, m_localtime);
// XXX - in 2.5 theres no way to do this. possibly not that important to support - Campbell
if (0) { // XXX !execute_ipochannels(&tchanbase)) {