Index: trunk/src/lib/graphics/importer/md2Model.h
===================================================================
--- trunk/src/lib/graphics/importer/md2Model.h	(revision 5303)
+++ trunk/src/lib/graphics/importer/md2Model.h	(revision 5304)
@@ -103,5 +103,5 @@
 
 //! class to store the md2 data in
-class MD2Data
+class MD2Data : public BaseObject
 {
  public:
Index: trunk/src/lib/graphics/importer/model.cc
===================================================================
--- trunk/src/lib/graphics/importer/model.cc	(revision 5303)
+++ trunk/src/lib/graphics/importer/model.cc	(revision 5304)
@@ -167,6 +167,5 @@
   this->normals = new Array<GLfloat>();
 
-  this->materialList = new tList<Material>;
-  this->materialsExtern = false;
+  this->materialList = new tList<ModelMaterial>;
 
   if (this->type == MODEL_VERTEX_ARRAY)
@@ -196,18 +195,17 @@
 
   // deleting the MaterialList
-  if (!this->materialsExtern)
+  PRINTF(5)("Deleting Materials.\n");
+
+  tIterator<ModelMaterial>* tmpIt = this->materialList->getIterator();
+  ModelMaterial* modMat = tmpIt->firstElement();
+  //! @todo do we really have to delete this material??
+  while(modMat != NULL)
   {
-    PRINTF(5)("Deleting Materials.\n");
-
-    tIterator<Material>* tmpIt = this->materialList->getIterator();
-    Material* material = tmpIt->firstElement();
-  //! @todo do we really have to delete this material??
-    while(material)
-    {
-      delete material;
-      material = tmpIt->nextElement();
-    }
-    delete tmpIt;
+    if (!modMat->external)
+      delete modMat->material;
+    delete modMat;
+    modMat = tmpIt->nextElement();
   }
+  delete tmpIt;
   delete materialList;
   delete this->pModelInfo;
@@ -391,11 +389,12 @@
  * this also tells this Model, that all the Materials are handled externally
  * with this option set the Materials will not be deleted with the Model.
- * !! -> NO MATERIALS GET DELETED WITH ONE CALL TO THIS FUNCTION !!
-*/
+ */
 Material* Model::addMaterial(Material* material)
 {
-  this->materialList->add(material);
-  this->materialsExtern = true;
-  return material;
+  ModelMaterial* modMat = new ModelMaterial;
+  modMat->external = true;
+  modMat->material = material;
+  this->materialList->add(modMat);
+  return modMat->material;
 }
 
@@ -407,10 +406,12 @@
 Material* Model::addMaterial(const char* materialName)
 {
-  Material* newMat = new Material();
-  newMat->setName(materialName);
+  ModelMaterial* modMat = new ModelMaterial;
+  modMat->external = false;
+  modMat->material = new Material();
+  modMat->material->setName(materialName);
 
   // adding material to the List of materials
-  this->materialList->add(newMat);
-  return newMat;
+  this->materialList->add(modMat);
+  return modMat->material;
 }
 
@@ -422,14 +423,14 @@
 Material* Model::findMaterialByName(const char* materialName)
 {
-  tIterator<Material>* tmpIt = this->materialList->getIterator();
-  Material* material = tmpIt->firstElement();
-  while(material)
-    {
-      if (!strcmp(material->getName(), materialName))
+  tIterator<ModelMaterial>* tmpIt = this->materialList->getIterator();
+  ModelMaterial* modMat = tmpIt->firstElement();
+  while(modMat != NULL)
+    {
+      if (!strcmp(modMat->material->getName(), materialName))
         {
           delete tmpIt;
-          return material;
+          return modMat->material;
         }
-      material = tmpIt->nextElement();
+      modMat = tmpIt->nextElement();
     }
   delete tmpIt;
Index: trunk/src/lib/graphics/importer/model.h
===================================================================
--- trunk/src/lib/graphics/importer/model.h	(revision 5303)
+++ trunk/src/lib/graphics/importer/model.h	(revision 5304)
@@ -96,8 +96,13 @@
 };
 
+struct ModelMaterial
+{
+  Material* material;
+  bool external;
+};
+
 /////////////
 /// MODEL ///
 /////////////
-
 //! Class that handles 3D-Models. it can also read them in and display them.
 class Model : public AbstractModel
@@ -172,23 +177,22 @@
 
  private:
-  MODEL_TYPE       type;            //!< A type for the Model
-  bool             finalized;       //!< Sets the Object to be finalized.
+  MODEL_TYPE             type;            //!< A type for the Model
+  bool                   finalized;       //!< Sets the Object to be finalized.
 
-  unsigned int     vertexCount;     //!< A modelwide Counter for vertices.
-  unsigned int     normalCount;     //!< A modelwide Counter for the normals.
-  unsigned int     texCoordCount;   //!< A modelwide Counter for the texCoord.
-  unsigned int     faceCount;       //!< A modelwide Counter for the faces
-  unsigned int     triangleCount;   //!< Number of triangles >= faceCount
-  Array<GLfloat>*  vertices;        //!< The Array that handles the Vertices.
-  Array<GLfloat>*  normals;         //!< The Array that handles the Normals.
-  Array<GLfloat>*  vTexture;        //!< The Array that handles the VertexTextureCoordinates.
-  sTriangleExt*    triangles;       //!< The Array of triangles in the abstract_model.h style
+  unsigned int           vertexCount;     //!< A modelwide Counter for vertices.
+  unsigned int           normalCount;     //!< A modelwide Counter for the normals.
+  unsigned int           texCoordCount;   //!< A modelwide Counter for the texCoord.
+  unsigned int           faceCount;       //!< A modelwide Counter for the faces
+  unsigned int           triangleCount;   //!< Number of triangles >= faceCount
+  Array<GLfloat>*        vertices;        //!< The Array that handles the Vertices.
+  Array<GLfloat>*        normals;         //!< The Array that handles the Normals.
+  Array<GLfloat>*        vTexture;        //!< The Array that handles the VertexTextureCoordinates.
+  sTriangleExt*          triangles;       //!< The Array of triangles in the abstract_model.h style
 
-  ModelGroup*      firstGroup;      //!< The first of all groups.
-  ModelGroup*      currentGroup;    //!< The currentGroup. this is the one we will work with.
-  int              groupCount;      //!< The Count of Groups.
+  ModelGroup*            firstGroup;      //!< The first of all groups.
+  ModelGroup*            currentGroup;    //!< The currentGroup. this is the one we will work with.
+  int                    groupCount;      //!< The Count of Groups.
 
-  tList<Material>* materialList;    //!< A list for all the Materials in this Model
-  bool             materialsExtern; //!< If the materials given to this Object are extern.
+  tList<ModelMaterial>*  materialList;    //!< A list for all the Materials in this Model
 };
 
Index: trunk/src/lib/graphics/importer/texture.cc
===================================================================
--- trunk/src/lib/graphics/importer/texture.cc	(revision 5303)
+++ trunk/src/lib/graphics/importer/texture.cc	(revision 5304)
@@ -32,4 +32,6 @@
 Texture::Texture(const char* imageName)
 {
+  this->setClassID(CL_TEXTURE, "Texture");
+
   this->bAlpha = false;
   this->texture = 0;
Index: trunk/src/lib/graphics/importer/texture.h
===================================================================
--- trunk/src/lib/graphics/importer/texture.h	(revision 5303)
+++ trunk/src/lib/graphics/importer/texture.h	(revision 5304)
@@ -10,4 +10,5 @@
 
 #include "glincl.h"
+#include "base_object.h"
 
 #include "debug.h"
@@ -20,5 +21,5 @@
 
 //! A Class, that reads in Textures from different fileformats.
-class Texture
+class Texture : public  BaseObject
 {
  public:
