diff options
author | Campbell Barton <ideasman42@gmail.com> | 2010-10-25 21:08:40 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2010-10-25 21:08:40 +0400 |
commit | e002bcd876082562e197d4c33e8fa10c58447f88 (patch) | |
tree | dbf0092824c40269f8211d70fb4c19275f55b7c3 /source/gameengine/Converter/BL_DeformableGameObject.h | |
parent | 0dde63c0440c8d34004be8a79a8c58b66b84f921 (diff) |
bugfix [#22277] Absolute Shapekeys crash (in BGE)
running a shape actuator on a softbody would crash because it assumed the deformer was a BL_MeshDeformer.
Added TODO note, since it would be nice if softbody would work with shape keys too.
Diffstat (limited to 'source/gameengine/Converter/BL_DeformableGameObject.h')
-rw-r--r-- | source/gameengine/Converter/BL_DeformableGameObject.h | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/source/gameengine/Converter/BL_DeformableGameObject.h b/source/gameengine/Converter/BL_DeformableGameObject.h index 076bfaeb458..12f641eee96 100644 --- a/source/gameengine/Converter/BL_DeformableGameObject.h +++ b/source/gameengine/Converter/BL_DeformableGameObject.h @@ -37,6 +37,7 @@ #include "DNA_mesh_types.h" #include "KX_GameObject.h" #include "BL_MeshDeformer.h" +#include "KX_SoftBodyDeformer.h" #include <vector> class BL_ShapeActionActuator; @@ -79,7 +80,20 @@ public: bool GetShape(vector<float> &shape); Key* GetKey() { - return (m_pDeformer) ? ((BL_MeshDeformer*)m_pDeformer)->GetMesh()->key : NULL; + if(m_pDeformer) { + BL_MeshDeformer *deformer= dynamic_cast<BL_MeshDeformer *>(m_pDeformer); // incase its not a MeshDeformer + if(deformer) { + return deformer->GetMesh()->key; + } + +#if 0 // TODO. shape keys for softbody, currently they dont store a mesh. + KX_SoftBodyDeformer *deformer_soft= dynamic_cast<KX_SoftBodyDeformer *>(m_pDeformer); + if(deformer) { + return deformer->GetMesh()->key; + } +#endif + } + return NULL; } virtual void SetDeformer(class RAS_Deformer* deformer); |