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

Method unloadResourceGroup

OgreMain/src/OgreResourceGroupManager.cpp:350–386  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

348 }
349 //-----------------------------------------------------------------------
350 void ResourceGroupManager::unloadResourceGroup( const String &name, bool reloadableOnly )
351 {
352 // Can only bulk-unload one group at a time (reasonable limitation I think)
353 OGRE_LOCK_AUTO_MUTEX;
354
355 LogManager::getSingleton().logMessage( "Unloading resource group " + name );
356 ResourceGroup *grp = getResourceGroup( name );
357 if( !grp )
358 {
359 OGRE_EXCEPT( Exception::ERR_ITEM_NOT_FOUND, "Cannot find a group named " + name,
360 "ResourceGroupManager::unloadResourceGroup" );
361 }
362 // Set current group
363 mCurrentGroup = grp;
364 OGRE_LOCK_MUTEX( grp->OGRE_AUTO_MUTEX_NAME ); // lock group mutex
365
366 // Count up resources for starting event
367 ResourceGroup::LoadResourceOrderMap::reverse_iterator oi;
368 // unload in reverse order
369 for( oi = grp->loadResourceOrderMap.rbegin(); oi != grp->loadResourceOrderMap.rend(); ++oi )
370 {
371 for( LoadUnloadResourceSet::iterator l = oi->second->begin(); l != oi->second->end(); ++l )
372 {
373 Resource *resource = l->get();
374 if( !reloadableOnly || resource->isReloadable() )
375 {
376 resource->unload();
377 }
378 }
379 }
380
381 grp->groupStatus = ResourceGroup::INITIALISED;
382
383 // reset current group
384 mCurrentGroup = 0;
385 LogManager::getSingleton().logMessage( "Finished unloading resource group " + name );
386 }
387 //-----------------------------------------------------------------------
388 void ResourceGroupManager::unloadUnreferencedResourcesInGroup( const String &name,
389 bool reloadableOnly )

Callers

nothing calls this directly

Calls 8

isReloadableMethod · 0.80
logMessageMethod · 0.45
rbeginMethod · 0.45
rendMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
getMethod · 0.45
unloadMethod · 0.45

Tested by

no test coverage detected