Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4436 in orxonox.OLD for orxonox/trunk


Ignore:
Timestamp:
Jun 1, 2005, 12:50:07 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: baseObject now implements loading of objectNames

Location:
orxonox/trunk/src
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/lib/coord/p_node.cc

    r4435 r4436  
    2929#include "vector.h"
    3030#include "null_parent.h"
     31#include "load_param.h"
    3132
    3233//#include "vector.h"
     
    4546  init(NULL);
    4647
    47   NullParent* np = NullParent::getInstance();
    48   np->addChild(this);
    49 }
    50 
     48  NullParent::getInstance()->addChild(this);
     49}
     50
     51PNode::PNode(const TiXmlElement* root)
     52{
     53  this->init(NULL);
     54  NullParent::getInstance()->addChild(this);
     55}
    5156
    5257
     
    8792}
    8893
    89 
    9094void PNode::init(PNode* parent)
    9195{
     
    98102}
    99103
    100 
     104void PNode::loadParams(const TiXmlElement* root)
     105{
     106  static_cast<BaseObject*>(this)->loadParams(root);
     107}
    101108
    102109/**
  • orxonox/trunk/src/lib/coord/p_node.h

    r4435 r4436  
    2929//class Quaternion;
    3030//class Vector;
     31class TiXmlElement;
    3132template<class T> class tList;
    3233
     
    4950 public:
    5051  PNode ();
     52  PNode(const TiXmlElement* root);
    5153  PNode (const Vector& absCoordinate, PNode* pNode);
    5254  virtual ~PNode ();
     55
     56  void loadParams(const TiXmlElement* root);
     57
    5358
    5459  PNode* parent;            //!< a pointer to the parent node
  • orxonox/trunk/src/lib/lang/base_object.cc

    r4435 r4436  
    1818
    1919#include "base_object.h"
    20 #include "stdincl.h"
    21 
     20#include "load_param.h"
    2221
    2322using namespace std;
     
    2524
    2625/**
    27    \brief standard constructor
     26   \brief sets the name from a LoadXML-Element
     27   \param root the element to load from
    2828*/
    29 BaseObject::BaseObject ()
     29BaseObject::BaseObject(const TiXmlElement* root)
    3030{
    3131  this->className = NULL;
     
    3434
    3535  this->objectName = NULL;
     36
     37  if (root)
     38    this->loadParams(root);
    3639}
    37 
    3840
    3941/**
     
    4749}
    4850
     51/**
     52   \brief loads parameters
     53   \param root the element to load from
     54*/
     55void BaseObject::loadParams(const TiXmlElement* root)
     56{
     57  // name setup
     58  LoadParam<BaseObject>(root, "name", this, &BaseObject::setName)
     59    .describe("the name of the Object at hand");
     60}
    4961
    5062/**
  • orxonox/trunk/src/lib/lang/base_object.h

    r4435 r4436  
    99
    1010#include "class_list.h"
     11#ifndef NULL
     12#define NULL 0x0
     13#endif
     14
     15class TiXmlElement;
    1116
    1217//! A class all other classes are derived from
     
    1419
    1520 public:
    16   BaseObject ();
     21  BaseObject (const TiXmlElement* root = NULL);
    1722  virtual ~BaseObject ();
     23
     24  void loadParams(const TiXmlElement* root);
    1825
    1926  void setClassID(int id);
  • orxonox/trunk/src/lib/particles/particle_system.cc

    r4434 r4436  
    8585   if (this->material)
    8686     delete this->material;
    87 }
    88 
    89 /**
    90    \brief sets the Name of the Particle System
    91    \param name the Name of the System
    92 */
    93 void ParticleSystem::setName(const char* name)
    94 {
    95   if (this->name)
    96     delete this->name;
    97   this->name = new char[strlen(name)+1];
    98   strcpy(this->name, name);
    99 }
    100 
    101 /**
    102    \returns the Name of the ParticleSystem
    103 */
    104 const char* ParticleSystem::getName(void) const
    105 {
    106   return this->name;
    10787}
    10888
  • orxonox/trunk/src/lib/particles/particle_system.h

    r4434 r4436  
    6868                 PARTICLE_TYPE type = PARTICLE_DEFAULT_TYPE);
    6969  virtual ~ParticleSystem();
    70   void setName(const char* name);
    71   const char* getName(void) const;
    7270
    7371  void setType(PARTICLE_TYPE particleType, int count = 0);
  • orxonox/trunk/src/world_entities/skybox.cc

    r4357 r4436  
    4545}
    4646
    47 SkyBox::SkyBox(const TiXmlElement* root) : WorldEntity(root)
     47SkyBox::SkyBox(const TiXmlElement* root)
    4848{
    4949  this->preInit();
     
    5656void SkyBox::loadParams(const TiXmlElement* root)
    5757{
     58  static_cast<WorldEntity*>(this)->loadParams(root);
     59
    5860  LoadParam<SkyBox>(root, "Materialset", this, &SkyBox::setTexture)
    5961    .describe("Sets the material on the SkyBox. The string must be the path relative to the data-dir, and without a trailing .jpg");
  • orxonox/trunk/src/world_entities/world_entity.cc

    r4435 r4436  
    3939}
    4040
    41 void WorldEntity::loadParams(const TiXmlElement* root)
    42 {
    43   // name setup
    44   //  LoadParam<WorldEntity>(root, "name", this, &BaseObject::setName)
    45   //    .describe("the name of the Object at hand");
    46 
    47   // Model Loading     
    48   LoadParam<WorldEntity>(root, "model", this, &WorldEntity::loadModel)
    49     .describe("the fileName of the model, that should be loaded onto this world-entity. (must be relative to the data-dir)") ;
    50 }
    51 
    5241/**
    5342   \brief standard destructor
     
    5847  if (this->model)
    5948    ResourceManager::getInstance()->unload(this->model);
     49}
     50
     51void WorldEntity::loadParams(const TiXmlElement* root)
     52{
     53  static_cast<PNode*>(this)->loadParams(root);
     54  // Model Loading
     55  LoadParam<WorldEntity>(root, "model", this, &WorldEntity::loadModel)
     56    .describe("the fileName of the model, that should be loaded onto this world-entity. (must be relative to the data-dir)") ;
    6057}
    6158
Note: See TracChangeset for help on using the changeset viewer.