- Timestamp:
- Dec 15, 2008, 11:26:16 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/objecthierarchy2/src/orxonox/objects/worldentities/WorldEntity.cc
r2365 r2478 79 79 this->detachFromParent(); 80 80 81 this->node_->removeAllChildren(); 82 81 83 if (this->getScene()->getSceneManager()) 82 84 this->getScene()->getSceneManager()->destroySceneNode(this->node_->getName()); … … 125 127 } 126 128 129 void WorldEntity::attachNode(Ogre::SceneNode* node) 130 { 131 Ogre::Node* parent = node->getParent(); 132 if (parent) 133 parent->removeChild(node); 134 this->node_->addChild(node); 135 } 136 137 void WorldEntity::detachNode(Ogre::SceneNode* node) 138 { 139 this->node_->removeChild(node); 140 // this->getScene()->getRootSceneNode()->addChild(node); 141 } 142 143 void WorldEntity::attachToNode(Ogre::SceneNode* node) 144 { 145 Ogre::Node* parent = this->node_->getParent(); 146 if (parent) 147 parent->removeChild(this->node_); 148 node->addChild(this->node_); 149 } 150 151 void WorldEntity::detachFromNode(Ogre::SceneNode* node) 152 { 153 node->removeChild(this->node_); 154 // this->getScene()->getRootSceneNode()->addChild(this->node_); 155 } 156 127 157 void WorldEntity::attach(WorldEntity* object) 128 158 { … … 135 165 if (object->getParent()) 136 166 object->detachFromParent(); 137 else138 {139 Ogre::Node* parent = object->node_->getParent();140 if (parent)141 parent->removeChild(object->node_);142 }143 167 144 this->node_->addChild(object->node_); 168 this->attachNode(object->node_); 169 145 170 this->children_.insert(object); 146 171 object->parent_ = this; … … 150 175 void WorldEntity::detach(WorldEntity* object) 151 176 { 152 this-> node_->removeChild(object->node_);177 this->detachNode(object->node_); 153 178 this->children_.erase(object); 154 179 object->parent_ = 0; 155 180 object->parentID_ = OBJECTID_UNKNOWN; 156 157 // this->getScene()->getRootSceneNode()->addChild(object->node_);158 181 } 159 182
Note: See TracChangeset
for help on using the changeset viewer.