use const for readonly strings and set some functions to static
[blender.git] / source / gameengine / Converter / BL_DeformableGameObject.cpp
index cb882f31e805ea0114de2d1101f859e41c9e91df..9d514e996616653147626fc288373d5b182b403a 100644 (file)
@@ -1,6 +1,4 @@
-/**
- * $Id$
- *
+/*
  * ***** BEGIN GPL LICENSE BLOCK *****
  *
  * This program is free software; you can redistribute it and/or
@@ -15,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  *
  * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
  * All rights reserved.
  * ***** END GPL LICENSE BLOCK *****
  */
 
+/** \file gameengine/Converter/BL_DeformableGameObject.cpp
+ *  \ingroup bgeconv
+ */
+
+
 #include "BL_DeformableGameObject.h"
 #include "BL_ShapeDeformer.h"
 #include "BL_ShapeActionActuator.h"
 #include "RAS_MaterialBucket.h"
 
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
 BL_DeformableGameObject::~BL_DeformableGameObject()
 {
        if (m_pDeformer)
@@ -86,15 +85,16 @@ bool BL_DeformableGameObject::SetActiveAction(BL_ShapeActionActuator *act, short
 bool BL_DeformableGameObject::GetShape(vector<float> &shape)
 {
        shape.clear();
-       if (m_pDeformer)
+       BL_ShapeDeformer* shape_deformer = dynamic_cast<BL_ShapeDeformer*>(m_pDeformer);
+       if (shape_deformer)
        {
-               Mesh* mesh = ((BL_MeshDeformer*)m_pDeformer)->GetMesh();
                // this check is normally superfluous: a shape deformer can only be created if the mesh
                // has relative keys
-               if (mesh && mesh->key && mesh->key->type==KEY_RELATIVE) 
+               Key* key = shape_deformer->GetKey();
+               if (key && key->type==KEY_RELATIVE) 
                {
                        KeyBlock *kb;
-                       for (kb = (KeyBlock*)mesh->key->block.first; kb; kb = (KeyBlock*)kb->next)
+                       for (kb = (KeyBlock*)key->block.first; kb; kb = (KeyBlock*)kb->next)
                        {
                                shape.push_back(kb->curval);
                        }