[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [37764] branches/soc-2011-pepper/source/ gameengine/Ketsji/BL_Action.cpp: BGE Animations: Adding shape actions to BL_Action.
Mitchell Stokes
mogurijin at gmail.com
Thu Jun 23 21:49:53 CEST 2011
Revision: 37764
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=37764
Author: moguri
Date: 2011-06-23 19:49:53 +0000 (Thu, 23 Jun 2011)
Log Message:
-----------
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.
Modified Paths:
--------------
branches/soc-2011-pepper/source/gameengine/Ketsji/BL_Action.cpp
Modified: branches/soc-2011-pepper/source/gameengine/Ketsji/BL_Action.cpp
===================================================================
--- branches/soc-2011-pepper/source/gameengine/Ketsji/BL_Action.cpp 2011-06-23 19:42:54 UTC (rev 37763)
+++ branches/soc-2011-pepper/source/gameengine/Ketsji/BL_Action.cpp 2011-06-23 19:49:53 UTC (rev 37764)
@@ -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,8 +72,19 @@
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);
+ }
+ }
}
BL_Action::~BL_Action()
@@ -268,6 +281,28 @@
}
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);
}
More information about the Bf-blender-cvs
mailing list