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.
This commit is contained in:
Campbell Barton 2010-10-25 17:08:40 +00:00
parent 0dde63c044
commit e002bcd876
3 changed files with 19 additions and 2 deletions

@ -66,7 +66,6 @@ void VIEW3D_OT_layers(struct wmOperatorType *ot);
/* view3d_ops.c */
void view3d_operatortypes(void);
void view3d_keymap(struct wmKeyConfig *keyconf);
/* view3d_edit.c */
void VIEW3D_OT_zoom(struct wmOperatorType *ot);
@ -94,6 +93,7 @@ void view3d_boxview_copy(ScrArea *sa, ARegion *ar);
void view3d_persp_mat4(struct RegionView3D *rv3d, float mat[][4]);
/* view3d_fly.c */
void view3d_keymap(struct wmKeyConfig *keyconf);
void VIEW3D_OT_fly(struct wmOperatorType *ot);
/* drawanim.c */

@ -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);

@ -24,6 +24,9 @@
#
# ***** END GPL LICENSE BLOCK *****
# since this includes bullet we get errors from the headers too
REMOVE_STRICT_FLAGS()
SET(INC
.
../common