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:09:09 +0400
committerMitchell Stokes <mogurijin@gmail.com>2011-06-23 23:09:09 +0400
commit2d2aa95227e3b00f9dc42293d4231af3dc5a99b9 (patch)
treecfc159562c6e0f48957d702104dd18f7d2cc05af /source/gameengine/Converter/BL_ShapeDeformer.cpp
parent413bc87e4f18bb46eeb2f2f52b5278d182b51de8 (diff)
BGE Animations: Making shape actions work again:
* BL_DeformableGameObject is no longer responsible for handling keys, BL_ShapeDeformer is * BL_ShapeDeformer also creates a copy of the key on construction and puts it back on the mesh when destructed. This avoids us permanently modifying Blender data. * I'm not too fond of clearing out the key every frame, but this works and I can't think of another alternative at the moment (something may be possible with some key juggling)
Diffstat (limited to 'source/gameengine/Converter/BL_ShapeDeformer.cpp')
-rw-r--r--source/gameengine/Converter/BL_ShapeDeformer.cpp41
1 files changed, 41 insertions, 0 deletions
diff --git a/source/gameengine/Converter/BL_ShapeDeformer.cpp b/source/gameengine/Converter/BL_ShapeDeformer.cpp
index 8d8f149bb6c..c651d457cd9 100644
--- a/source/gameengine/Converter/BL_ShapeDeformer.cpp
+++ b/source/gameengine/Converter/BL_ShapeDeformer.cpp
@@ -68,9 +68,40 @@ extern "C"{
#define __NLA_DEFNORMALS
//#undef __NLA_DEFNORMALS
+BL_ShapeDeformer::BL_ShapeDeformer(BL_DeformableGameObject *gameobj,
+ Object *bmeshobj,
+ RAS_MeshObject *mesh)
+ :
+ BL_SkinDeformer(gameobj,bmeshobj, mesh),
+ m_lastShapeUpdate(-1)
+{
+ m_key = m_bmesh->key;
+ m_bmesh->key = copy_key(m_key);
+};
+
+/* this second constructor is needed for making a mesh deformable on the fly. */
+BL_ShapeDeformer::BL_ShapeDeformer(BL_DeformableGameObject *gameobj,
+ Object *bmeshobj_old,
+ Object *bmeshobj_new,
+ RAS_MeshObject *mesh,
+ bool release_object,
+ bool recalc_normal,
+ BL_ArmatureObject* arma)
+ :
+ BL_SkinDeformer(gameobj, bmeshobj_old, bmeshobj_new, mesh, release_object, recalc_normal, arma),
+ m_lastShapeUpdate(-1)
+{
+ m_key = m_bmesh->key;
+ m_bmesh->key = copy_key(m_key);
+};
BL_ShapeDeformer::~BL_ShapeDeformer()
{
+ if (m_key && m_bmesh->key)
+ {
+ free_key(m_bmesh->key);
+ m_bmesh->key = m_key;
+ }
};
RAS_Deformer *BL_ShapeDeformer::GetReplica()
@@ -190,3 +221,13 @@ bool BL_ShapeDeformer::Update(void)
}
return bSkinUpdate;
}
+
+Key *BL_ShapeDeformer::GetKey()
+{
+ return m_bmesh->key;
+}
+
+void BL_ShapeDeformer::SetKey(Key *key)
+{
+ m_bmesh->key = key;
+}