DiTransUnitPtr DiCullNode::DetachObject( unsigned short index ) { DiTransUnitPtr ret; if (index < mObjectsByName.size()) { ObjectMap::iterator i = mObjectsByName.begin(); while (index--)++i; ret = i->second; mObjectsByName.erase(i); if (ret->GetParentNode() == this) { ret->NotifyAttached((DiCullNode*)0); } NeedUpdate(); return ret; } else { DI_ERROR("Cannot detach object, invalid index"); return NULL; } }
void DiCullNode::DetachAllObjects( void ) { ObjectMap::iterator itr; DiTransUnitPtr ret; for ( itr = mObjectsByName.begin(); itr != mObjectsByName.end(); ++itr ) { ret = itr->second; if (ret->GetParentNode() == this) { ret->NotifyAttached((DiCullNode*)0); } } mObjectsByName.clear(); NeedUpdate(); }
DiTransUnitPtr DiCullNode::DetachObject( const DiString& name ) { ObjectMap::iterator it = mObjectsByName.find(name); if (it == mObjectsByName.end()) { DI_ERROR("Cannot find the object : %s", name.c_str()); } DiTransUnitPtr ret = it->second; mObjectsByName.erase(it); if (ret->GetParentNode() == this) { ret->NotifyAttached((DiCullNode*)0); } NeedUpdate(); return ret; }
void DiCullNode::DetachObject(DiTransUnitPtr obj) { ObjectMap::iterator i, iend; iend = mObjectsByName.end(); for (i = mObjectsByName.begin(); i != iend; ++i) { if (i->second == obj) { mObjectsByName.erase(i); break; } } if (obj->GetParentNode() == this) { obj->NotifyAttached((DiCullNode*)0); } NeedUpdate(); }
void DiCullNode::DetachObject(DiTransUnitPtr obj) { bool found = false; for (auto i = mObjects.begin(); i != mObjects.end(); ++i) { if (*i == obj) { mObjects.erase(i); found = true; break; } } if (!found) return; if (obj->GetParentNode() == this) { obj->NotifyAttached(nullptr); } NeedUpdate(); }
DiTransUnitPtr DiCullNode::DetachObject( uint32 index ) { if (index < mObjects.size()) { DiTransUnitPtr ret = mObjects[index]; if (ret->GetParentNode() == this) { ret->NotifyAttached((DiCullNode*)0); } ObjectMap::iterator i = mObjects.begin() + index; mObjects.erase(i); NeedUpdate(); return ret; } else { DI_WARNING("Cannot detach object, invalid index"); return nullptr; } }