MCPcopy Create free account
hub / github.com/OGRECave/ogre-next / detachObject

Method detachObject

OgreMain/src/OgreSceneNode.cpp:176–206  ·  view source on GitHub ↗

-----------------------------------------------------------------------

Source from the content-addressed store, hash-verified

174 }
175 //-----------------------------------------------------------------------
176 void SceneNode::detachObject( MovableObject *obj )
177 {
178 if( obj->getParentNode() != this )
179 {
180 OGRE_EXCEPT( Exception::ERR_ITEM_NOT_FOUND,
181 "MovableObject ID: " + StringConverter::toString( obj->getId() ) + ", named '" +
182 obj->getName() + "' is not attached to this SceneNode!",
183 "SceneNode::detachObject" );
184 }
185 else if( obj->mParentIndex >= mAttachments.size() ||
186 obj != *( mAttachments.begin() + static_cast<ptrdiff_t>( obj->mParentIndex ) ) )
187 {
188 OGRE_EXCEPT( Exception::ERR_INTERNAL_ERROR,
189 "MovableObject ID: " + StringConverter::toString( obj->getId() ) + ", named '" +
190 obj->getName() +
191 "' had it's mParentIndex out of date!!! (or the MovableObject wasn't "
192 "attached to this SceneNode)",
193 "SceneNode::detachObject" );
194 }
195
196 ObjectVec::iterator itor = mAttachments.begin() + static_cast<ptrdiff_t>( obj->mParentIndex );
197
198 ( *itor )->_notifyAttached( (SceneNode *)0 );
199 itor = efficientVectorRemove( mAttachments, itor );
200
201 if( itor != mAttachments.end() )
202 {
203 // The object that was at the end got swapped and has now a different index
204 ( *itor )->mParentIndex = static_cast<size_t>( itor - mAttachments.begin() );
205 }
206 }
207 //-----------------------------------------------------------------------
208 void SceneNode::detachAllObjects()
209 {

Callers 5

destroyMethod · 0.80
loadGeometryMethod · 0.80
~MovableObjectMethod · 0.80
detachFromParentMethod · 0.80
OnFileOpenMethod · 0.80

Calls 8

efficientVectorRemoveFunction · 0.85
getIdMethod · 0.80
toStringFunction · 0.70
getNameMethod · 0.45
sizeMethod · 0.45
beginMethod · 0.45
_notifyAttachedMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected