diff options
author | Mitchell Stokes <mogurijin@gmail.com> | 2011-06-23 23:49:53 +0400 |
---|---|---|
committer | Mitchell Stokes <mogurijin@gmail.com> | 2011-06-23 23:49:53 +0400 |
commit | 545bf50e1dbdaa22ba4d6526194e846279a2a157 (patch) | |
tree | c60e96c6a8d7448fc0ccfcefafe208d4ad755087 /source/gameengine/Ketsji | |
parent | 8d179ca920d29dad1abfd91e27b8f6632fc86dca (diff) |
BGE Animations: Adding shape actions to BL_Action. This means Shape Actions now work through the Action actuator. I still need to handle blendin for shape actions though.
Diffstat (limited to 'source/gameengine/Ketsji')
-rw-r--r-- | source/gameengine/Ketsji/BL_Action.cpp | 37 |
1 files changed, 36 insertions, 1 deletions
diff --git a/source/gameengine/Ketsji/BL_Action.cpp b/source/gameengine/Ketsji/BL_Action.cpp index 078c69ab9e2..8f77d2728b2 100644 --- a/source/gameengine/Ketsji/BL_Action.cpp +++ b/source/gameengine/Ketsji/BL_Action.cpp @@ -31,6 +31,8 @@ #include "BL_Action.h" #include "BL_ArmatureObject.h" +#include "BL_DeformableGameObject.h" +#include "BL_ShapeDeformer.h" #include "KX_IpoConvert.h" #include "KX_GameObject.h" @@ -70,7 +72,18 @@ BL_Action::BL_Action(class KX_GameObject* gameobj) BL_ArmatureObject *obj = (BL_ArmatureObject*)m_obj; m_ptrrna = new PointerRNA(); - RNA_id_pointer_create((ID*)obj->GetArmatureObject(), m_ptrrna); + 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); + } } } @@ -268,6 +281,28 @@ void BL_Action::Update(float curtime) } else { + BL_DeformableGameObject *obj = (BL_DeformableGameObject*)m_obj; + BL_ShapeDeformer *shape_deformer = dynamic_cast<BL_ShapeDeformer*>(obj->GetDeformer()); + + // Handle shape actions if we have any + if (shape_deformer) + { + Key *key = shape_deformer->GetKey(); + + // We go through and clear out the keyblocks so there isn't any interference + // from other shape actions + KeyBlock *kb; + for (kb=(KeyBlock*)key->block.first; kb; kb=(KeyBlock*)kb->next) + kb->curval = 0.f; + + animsys_evaluate_action(m_ptrrna, m_action, NULL, m_localtime); + + // XXX TODO handle blendin + + obj->SetActiveAction(NULL, 0, m_localtime); + } + + InitIPO(); m_obj->UpdateIPO(m_localtime, m_ipo_flags & ACT_IPOFLAG_CHILD); } |