Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 25, 2009, 11:16:27 PM (16 years ago)
Author:
landauf
Message:

Added Attacher - a class which attaches itself to an object with a given name

Location:
code/trunk/src/orxonox/objects/worldentities
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/src/orxonox/objects/worldentities/CMakeLists.txt

    r3033 r3077  
    66  ControllableEntity.cc
    77
     8  Attacher.cc
    89  Backlight.cc
    910  Billboard.cc
  • code/trunk/src/orxonox/objects/worldentities/WorldEntity.cc

    r2855 r3077  
    6969        this->parent_ = 0;
    7070        this->parentID_ = OBJECTID_UNKNOWN;
     71        this->bDeleteWithParent_ = true;
    7172
    7273        this->node_->setPosition(Vector3::ZERO);
     
    108109
    109110            for (std::set<WorldEntity*>::const_iterator it = this->children_.begin(); it != this->children_.end(); )
    110                 delete (*(it++));
     111            {
     112                if ((*it)->getDeleteWithParent())
     113                    delete (*(it++));
     114                else
     115                {
     116                    this->detach(*it);
     117                    (*it)->setPosition(this->getWorldPosition());
     118                    ++it;
     119                }
     120            }
    111121
    112122            if (this->physicalBody_)
     
    138148        XMLPortParamLoadOnly(WorldEntity, "pitch",       pitch_xmlport,        xmlelement, mode);
    139149        XMLPortParamLoadOnly(WorldEntity, "roll",        roll_xmlport,         xmlelement, mode);
     150        XMLPortParam        (WorldEntity, "deletewithparent", setDeleteWithParent, getDeleteWithParent, xmlelement, mode);
    140151
    141152        // Physics
  • code/trunk/src/orxonox/objects/worldentities/WorldEntity.h

    r2851 r3077  
    173173            void detachFromNode(Ogre::SceneNode* node);
    174174
     175            inline void setDeleteWithParent(bool value)
     176                { this->bDeleteWithParent_ = value; }
     177            inline bool getDeleteWithParent() const
     178                { return this->bDeleteWithParent_; }
     179
    175180            void notifyChildPropsChanged();
    176181
     
    200205            unsigned int parentID_;
    201206            std::set<WorldEntity*> children_;
     207            bool bDeleteWithParent_;
    202208
    203209
Note: See TracChangeset for help on using the changeset viewer.