1 | /*
|
---|
2 | -----------------------------------------------------------------------------
|
---|
3 | This source file is part of OGRE
|
---|
4 | (Object-oriented Graphics Rendering Engine)
|
---|
5 | For the latest info, see http://www.ogre3d.org/
|
---|
6 |
|
---|
7 | Copyright (c) 2000-2005 The OGRE Team
|
---|
8 | Also see acknowledgements in Readme.html
|
---|
9 |
|
---|
10 | This program is free software; you can redistribute it and/or modify it under
|
---|
11 | the terms of the GNU Lesser General Public License as published by the Free Software
|
---|
12 | Foundation; either version 2 of the License, or (at your option) any later
|
---|
13 | version.
|
---|
14 |
|
---|
15 | This program is distributed in the hope that it will be useful, but WITHOUT
|
---|
16 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
---|
17 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
---|
18 |
|
---|
19 | You should have received a copy of the GNU Lesser General Public License along with
|
---|
20 | this program; if not, write to the Free Software Foundation, Inc., 59 Temple
|
---|
21 | Place - Suite 330, Boston, MA 02111-1307, USA, or go to
|
---|
22 | http://www.gnu.org/copyleft/lesser.txt.
|
---|
23 | -----------------------------------------------------------------------------
|
---|
24 | */
|
---|
25 | #include "OgreStableHeaders.h"
|
---|
26 | #include "OgreResourceGroupManager.h"
|
---|
27 | #include "OgreException.h"
|
---|
28 | #include "OgreArchive.h"
|
---|
29 | #include "OgreArchiveManager.h"
|
---|
30 | #include "OgreLogManager.h"
|
---|
31 | #include "OgreScriptLoader.h"
|
---|
32 | #include "OgreSceneManager.h"
|
---|
33 |
|
---|
34 | namespace Ogre {
|
---|
35 |
|
---|
36 | //-----------------------------------------------------------------------
|
---|
37 | template<> ResourceGroupManager* Singleton<ResourceGroupManager>::ms_Singleton = 0;
|
---|
38 | ResourceGroupManager* ResourceGroupManager::getSingletonPtr(void)
|
---|
39 | {
|
---|
40 | return ms_Singleton;
|
---|
41 | }
|
---|
42 | ResourceGroupManager& ResourceGroupManager::getSingleton(void)
|
---|
43 | {
|
---|
44 | assert( ms_Singleton ); return ( *ms_Singleton );
|
---|
45 | }
|
---|
46 | String ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME = "General";
|
---|
47 | String ResourceGroupManager::INTERNAL_RESOURCE_GROUP_NAME = "Internal";
|
---|
48 | String ResourceGroupManager::BOOTSTRAP_RESOURCE_GROUP_NAME = "Bootstrap";
|
---|
49 | String ResourceGroupManager::AUTODETECT_RESOURCE_GROUP_NAME = "Autodetect";
|
---|
50 | // A reference count of 3 means that only RGM and RM have references
|
---|
51 | // RGM has one (this one) and RM has 2 (by name and by handle)
|
---|
52 | size_t ResourceGroupManager::RESOURCE_SYSTEM_NUM_REFERENCE_COUNTS = 3;
|
---|
53 | //-----------------------------------------------------------------------
|
---|
54 | //-----------------------------------------------------------------------
|
---|
55 | ResourceGroupManager::ResourceGroupManager()
|
---|
56 | : mCurrentGroup(0)
|
---|
57 | {
|
---|
58 | // Create the 'General' group
|
---|
59 | createResourceGroup(DEFAULT_RESOURCE_GROUP_NAME);
|
---|
60 | // Create the 'Internal' group
|
---|
61 | createResourceGroup(INTERNAL_RESOURCE_GROUP_NAME);
|
---|
62 | // Create the 'Autodetect' group (only used for temp storage)
|
---|
63 | createResourceGroup(AUTODETECT_RESOURCE_GROUP_NAME);
|
---|
64 | // default world group to the default group
|
---|
65 | mWorldGroupName = DEFAULT_RESOURCE_GROUP_NAME;
|
---|
66 | }
|
---|
67 | //-----------------------------------------------------------------------
|
---|
68 | ResourceGroupManager::~ResourceGroupManager()
|
---|
69 | {
|
---|
70 | // delete all resource groups
|
---|
71 | ResourceGroupMap::iterator i, iend;
|
---|
72 | iend = mResourceGroupMap.end();
|
---|
73 | for (i = mResourceGroupMap.begin(); i != iend; ++i)
|
---|
74 | {
|
---|
75 | deleteGroup(i->second);
|
---|
76 | }
|
---|
77 | mResourceGroupMap.clear();
|
---|
78 | }
|
---|
79 | //-----------------------------------------------------------------------
|
---|
80 | void ResourceGroupManager::createResourceGroup(const String& name)
|
---|
81 | {
|
---|
82 | OGRE_LOCK_AUTO_MUTEX
|
---|
83 |
|
---|
84 | LogManager::getSingleton().logMessage("Creating resource group " + name);
|
---|
85 | if (getResourceGroup(name))
|
---|
86 | {
|
---|
87 | OGRE_EXCEPT(Exception::ERR_DUPLICATE_ITEM,
|
---|
88 | "Resource group with name '" + name + "' already exists!",
|
---|
89 | "ResourceGroupManager::createResourceGroup");
|
---|
90 | }
|
---|
91 | ResourceGroup* grp = new ResourceGroup();
|
---|
92 | grp->initialised = false;
|
---|
93 | grp->name = name;
|
---|
94 | grp->worldGeometrySceneManager = 0;
|
---|
95 | mResourceGroupMap.insert(
|
---|
96 | ResourceGroupMap::value_type(name, grp));
|
---|
97 | }
|
---|
98 | //-----------------------------------------------------------------------
|
---|
99 | void ResourceGroupManager::initialiseResourceGroup(const String& name)
|
---|
100 | {
|
---|
101 | OGRE_LOCK_AUTO_MUTEX
|
---|
102 | LogManager::getSingleton().logMessage("Initialising resource group " + name);
|
---|
103 | ResourceGroup* grp = getResourceGroup(name);
|
---|
104 | if (!grp)
|
---|
105 | {
|
---|
106 | OGRE_EXCEPT(Exception::ERR_ITEM_NOT_FOUND,
|
---|
107 | "Cannot find a group named " + name,
|
---|
108 | "ResourceGroupManager::parseResourceGroupScripts");
|
---|
109 | }
|
---|
110 | OGRE_LOCK_MUTEX(grp->OGRE_AUTO_MUTEX_NAME) // lock group mutex
|
---|
111 |
|
---|
112 | if (!grp->initialised)
|
---|
113 | {
|
---|
114 | // Set current group
|
---|
115 | mCurrentGroup = grp;
|
---|
116 | parseResourceGroupScripts(grp);
|
---|
117 | createDeclaredResources(grp);
|
---|
118 | grp->initialised = true;
|
---|
119 |
|
---|
120 | // Reset current group
|
---|
121 | mCurrentGroup = 0;
|
---|
122 | }
|
---|
123 | }
|
---|
124 | //-----------------------------------------------------------------------
|
---|
125 | void ResourceGroupManager::initialiseAllResourceGroups(void)
|
---|
126 | {
|
---|
127 | OGRE_LOCK_AUTO_MUTEX
|
---|
128 |
|
---|
129 | // Intialise all declared resource groups
|
---|
130 | ResourceGroupMap::iterator i, iend;
|
---|
131 | iend = mResourceGroupMap.end();
|
---|
132 | for (i = mResourceGroupMap.begin(); i != iend; ++i)
|
---|
133 | {
|
---|
134 | ResourceGroup* grp = i->second;
|
---|
135 | OGRE_LOCK_MUTEX(grp->OGRE_AUTO_MUTEX_NAME) // lock group mutex
|
---|
136 | if (!grp->initialised)
|
---|
137 | {
|
---|
138 | // Set current group
|
---|
139 | mCurrentGroup = grp;
|
---|
140 | parseResourceGroupScripts(grp);
|
---|
141 | createDeclaredResources(grp);
|
---|
142 | grp->initialised = true;
|
---|
143 | // Reset current group
|
---|
144 | mCurrentGroup = 0;
|
---|
145 | }
|
---|
146 | }
|
---|
147 | }
|
---|
148 | //-----------------------------------------------------------------------
|
---|
149 | void ResourceGroupManager::loadResourceGroup(const String& name,
|
---|
150 | bool loadMainResources, bool loadWorldGeom)
|
---|
151 | {
|
---|
152 | // Can only bulk-load one group at a time (reasonable limitation I think)
|
---|
153 | OGRE_LOCK_AUTO_MUTEX
|
---|
154 |
|
---|
155 | StringUtil::StrStreamType str;
|
---|
156 | str << "Loading resource group '" << name << "' - Resources: "
|
---|
157 | << loadMainResources << " World Geometry: " << loadWorldGeom;
|
---|
158 | LogManager::getSingleton().logMessage(str.str());
|
---|
159 | // load all created resources
|
---|
160 | ResourceGroup* grp = getResourceGroup(name);
|
---|
161 | if (!grp)
|
---|
162 | {
|
---|
163 | OGRE_EXCEPT(Exception::ERR_ITEM_NOT_FOUND,
|
---|
164 | "Cannot find a group named " + name,
|
---|
165 | "ResourceGroupManager::loadResourceGroup");
|
---|
166 | }
|
---|
167 |
|
---|
168 | OGRE_LOCK_MUTEX(grp->OGRE_AUTO_MUTEX_NAME) // lock group mutex
|
---|
169 | // Set current group
|
---|
170 | mCurrentGroup = grp;
|
---|
171 |
|
---|
172 | // Count up resources for starting event
|
---|
173 | ResourceGroup::LoadResourceOrderMap::iterator oi;
|
---|
174 | size_t resourceCount = 0;
|
---|
175 | if (loadMainResources)
|
---|
176 | {
|
---|
177 | for (oi = grp->loadResourceOrderMap.begin(); oi != grp->loadResourceOrderMap.end(); ++oi)
|
---|
178 | {
|
---|
179 | resourceCount += oi->second->size();
|
---|
180 | }
|
---|
181 | }
|
---|
182 | // Estimate world geometry size
|
---|
183 | if (grp->worldGeometrySceneManager && loadWorldGeom)
|
---|
184 | {
|
---|
185 | resourceCount +=
|
---|
186 | grp->worldGeometrySceneManager->estimateWorldGeometry(
|
---|
187 | grp->worldGeometry);
|
---|
188 | }
|
---|
189 |
|
---|
190 | fireResourceGroupLoadStarted(name, resourceCount);
|
---|
191 |
|
---|
192 | // Now load for real
|
---|
193 | if (loadMainResources)
|
---|
194 | {
|
---|
195 | for (oi = grp->loadResourceOrderMap.begin();
|
---|
196 | oi != grp->loadResourceOrderMap.end(); ++oi)
|
---|
197 | {
|
---|
198 | for (LoadUnloadResourceList::iterator l = oi->second->begin();
|
---|
199 | l != oi->second->end(); ++l)
|
---|
200 | {
|
---|
201 | // If loading one of these resources cascade-loads another resource,
|
---|
202 | // the list will get longer! But these should be loaded immediately
|
---|
203 | if (!(*l)->isLoaded())
|
---|
204 | {
|
---|
205 | fireResourceStarted(*l);
|
---|
206 | (*l)->load();
|
---|
207 | fireResourceEnded();
|
---|
208 | }
|
---|
209 | }
|
---|
210 | }
|
---|
211 | }
|
---|
212 | // Load World Geometry
|
---|
213 | if (grp->worldGeometrySceneManager && loadWorldGeom)
|
---|
214 | {
|
---|
215 | grp->worldGeometrySceneManager->setWorldGeometry(
|
---|
216 | grp->worldGeometry);
|
---|
217 | }
|
---|
218 | fireResourceGroupLoadEnded(name);
|
---|
219 |
|
---|
220 | // reset current group
|
---|
221 | mCurrentGroup = 0;
|
---|
222 |
|
---|
223 | LogManager::getSingleton().logMessage("Finished loading resource group " + name);
|
---|
224 | }
|
---|
225 | //-----------------------------------------------------------------------
|
---|
226 | void ResourceGroupManager::unloadResourceGroup(const String& name, bool reloadableOnly)
|
---|
227 | {
|
---|
228 | // Can only bulk-unload one group at a time (reasonable limitation I think)
|
---|
229 | OGRE_LOCK_AUTO_MUTEX
|
---|
230 |
|
---|
231 | LogManager::getSingleton().logMessage("Unloading resource group " + name);
|
---|
232 | ResourceGroup* grp = getResourceGroup(name);
|
---|
233 | if (!grp)
|
---|
234 | {
|
---|
235 | OGRE_EXCEPT(Exception::ERR_ITEM_NOT_FOUND,
|
---|
236 | "Cannot find a group named " + name,
|
---|
237 | "ResourceGroupManager::unloadResourceGroup");
|
---|
238 | }
|
---|
239 | // Set current group
|
---|
240 | mCurrentGroup = grp;
|
---|
241 |
|
---|
242 | // Count up resources for starting event
|
---|
243 | ResourceGroup::LoadResourceOrderMap::reverse_iterator oi;
|
---|
244 | // unload in reverse order
|
---|
245 | for (oi = grp->loadResourceOrderMap.rbegin(); oi != grp->loadResourceOrderMap.rend(); ++oi)
|
---|
246 | {
|
---|
247 | for (LoadUnloadResourceList::iterator l = oi->second->begin();
|
---|
248 | l != oi->second->end(); ++l)
|
---|
249 | {
|
---|
250 | Resource* resource = l->get();
|
---|
251 | if (!reloadableOnly || resource->isReloadable())
|
---|
252 | {
|
---|
253 | resource->unload();
|
---|
254 | }
|
---|
255 | }
|
---|
256 | }
|
---|
257 |
|
---|
258 | // reset current group
|
---|
259 | mCurrentGroup = 0;
|
---|
260 | LogManager::getSingleton().logMessage("Finished unloading resource group " + name);
|
---|
261 | }
|
---|
262 | //-----------------------------------------------------------------------
|
---|
263 | void ResourceGroupManager::unloadUnreferencedResourcesInGroup(
|
---|
264 | const String& name, bool reloadableOnly )
|
---|
265 | {
|
---|
266 | // Can only bulk-unload one group at a time (reasonable limitation I think)
|
---|
267 | OGRE_LOCK_AUTO_MUTEX
|
---|
268 |
|
---|
269 | LogManager::getSingleton().logMessage(
|
---|
270 | "Unloading unused resources in resource group " + name);
|
---|
271 | ResourceGroup* grp = getResourceGroup(name);
|
---|
272 | if (!grp)
|
---|
273 | {
|
---|
274 | OGRE_EXCEPT(Exception::ERR_ITEM_NOT_FOUND,
|
---|
275 | "Cannot find a group named " + name,
|
---|
276 | "ResourceGroupManager::unloadUnreferencedResourcesInGroup");
|
---|
277 | }
|
---|
278 | // Set current group
|
---|
279 | mCurrentGroup = grp;
|
---|
280 |
|
---|
281 | ResourceGroup::LoadResourceOrderMap::reverse_iterator oi;
|
---|
282 | // unload in reverse order
|
---|
283 | for (oi = grp->loadResourceOrderMap.rbegin(); oi != grp->loadResourceOrderMap.rend(); ++oi)
|
---|
284 | {
|
---|
285 | for (LoadUnloadResourceList::iterator l = oi->second->begin();
|
---|
286 | l != oi->second->end(); ++l)
|
---|
287 | {
|
---|
288 | // A use count of 3 means that only RGM and RM have references
|
---|
289 | // RGM has one (this one) and RM has 2 (by name and by handle)
|
---|
290 | if (l->useCount() == RESOURCE_SYSTEM_NUM_REFERENCE_COUNTS)
|
---|
291 | {
|
---|
292 | Resource* resource = l->get();
|
---|
293 | if (!reloadableOnly || resource->isReloadable())
|
---|
294 | {
|
---|
295 | resource->unload();
|
---|
296 | }
|
---|
297 | }
|
---|
298 | }
|
---|
299 | }
|
---|
300 |
|
---|
301 | // reset current group
|
---|
302 | mCurrentGroup = 0;
|
---|
303 | LogManager::getSingleton().logMessage(
|
---|
304 | "Finished unloading unused resources in resource group " + name);
|
---|
305 | }
|
---|
306 | //-----------------------------------------------------------------------
|
---|
307 | void ResourceGroupManager::clearResourceGroup(const String& name)
|
---|
308 | {
|
---|
309 | // Can only bulk-clear one group at a time (reasonable limitation I think)
|
---|
310 | OGRE_LOCK_AUTO_MUTEX
|
---|
311 |
|
---|
312 | LogManager::getSingleton().logMessage("Clearing resource group " + name);
|
---|
313 | ResourceGroup* grp = getResourceGroup(name);
|
---|
314 | if (!grp)
|
---|
315 | {
|
---|
316 | OGRE_EXCEPT(Exception::ERR_ITEM_NOT_FOUND,
|
---|
317 | "Cannot find a group named " + name,
|
---|
318 | "ResourceGroupManager::clearResourceGroup");
|
---|
319 | }
|
---|
320 | // set current group
|
---|
321 | mCurrentGroup = grp;
|
---|
322 | dropGroupContents(grp);
|
---|
323 | // clear initialised flag
|
---|
324 | grp->initialised = false;
|
---|
325 | // reset current group
|
---|
326 | mCurrentGroup = 0;
|
---|
327 | LogManager::getSingleton().logMessage("Finished clearing resource group " + name);
|
---|
328 | }
|
---|
329 | //-----------------------------------------------------------------------
|
---|
330 | void ResourceGroupManager::destroyResourceGroup(const String& name)
|
---|
331 | {
|
---|
332 | // Can only bulk-destroy one group at a time (reasonable limitation I think)
|
---|
333 | OGRE_LOCK_AUTO_MUTEX
|
---|
334 |
|
---|
335 | LogManager::getSingleton().logMessage("Destroying resource group " + name);
|
---|
336 | ResourceGroup* grp = getResourceGroup(name);
|
---|
337 | if (!grp)
|
---|
338 | {
|
---|
339 | OGRE_EXCEPT(Exception::ERR_ITEM_NOT_FOUND,
|
---|
340 | "Cannot find a group named " + name,
|
---|
341 | "ResourceGroupManager::destroyResourceGroup");
|
---|
342 | }
|
---|
343 | // set current group
|
---|
344 | mCurrentGroup = grp;
|
---|
345 | unloadResourceGroup(name, false); // will throw an exception if name not valid
|
---|
346 | dropGroupContents(grp);
|
---|
347 | deleteGroup(grp);
|
---|
348 | mResourceGroupMap.erase(mResourceGroupMap.find(name));
|
---|
349 | // reset current group
|
---|
350 | mCurrentGroup = 0;
|
---|
351 | }
|
---|
352 | //-----------------------------------------------------------------------
|
---|
353 | void ResourceGroupManager::addResourceLocation(const String& name,
|
---|
354 | const String& locType, const String& resGroup, bool recursive)
|
---|
355 | {
|
---|
356 | ResourceGroup* grp = getResourceGroup(resGroup);
|
---|
357 | if (!grp)
|
---|
358 | {
|
---|
359 | createResourceGroup(resGroup);
|
---|
360 | grp = getResourceGroup(resGroup);
|
---|
361 | }
|
---|
362 |
|
---|
363 | OGRE_LOCK_MUTEX(grp->OGRE_AUTO_MUTEX_NAME) // lock group mutex
|
---|
364 |
|
---|
365 | // Get archive
|
---|
366 | Archive* pArch = ArchiveManager::getSingleton().load( name, locType );
|
---|
367 | // Add to location list
|
---|
368 | ResourceLocation* loc = new ResourceLocation();
|
---|
369 | loc->archive = pArch;
|
---|
370 | loc->recursive = recursive;
|
---|
371 | grp->locationList.push_back(loc);
|
---|
372 | // Index resources
|
---|
373 | StringVectorPtr vec = pArch->find("*", recursive);
|
---|
374 | for( StringVector::iterator it = vec->begin(); it != vec->end(); ++it )
|
---|
375 | {
|
---|
376 | // Index under full name, case sensitive
|
---|
377 | grp->resourceIndexCaseSensitive[(*it)] = pArch;
|
---|
378 | if (!pArch->isCaseSensitive())
|
---|
379 | {
|
---|
380 | // Index under lower case name too for case insensitive match
|
---|
381 | String indexName = (*it);
|
---|
382 | StringUtil::toLowerCase(indexName);
|
---|
383 | grp->resourceIndexCaseInsensitive[indexName] = pArch;
|
---|
384 | }
|
---|
385 | }
|
---|
386 |
|
---|
387 | StringUtil::StrStreamType msg;
|
---|
388 | msg << "Added resource location '" << name << "' of type '" << locType
|
---|
389 | << "' to resource group '" << resGroup << "'";
|
---|
390 | if (recursive)
|
---|
391 | msg << " with recursive option";
|
---|
392 | LogManager::getSingleton().logMessage(msg.str());
|
---|
393 |
|
---|
394 | }
|
---|
395 | //-----------------------------------------------------------------------
|
---|
396 | void ResourceGroupManager::removeResourceLocation(const String& name,
|
---|
397 | const String& resGroup)
|
---|
398 | {
|
---|
399 | ResourceGroup* grp = getResourceGroup(resGroup);
|
---|
400 | if (!grp)
|
---|
401 | {
|
---|
402 | OGRE_EXCEPT(Exception::ERR_ITEM_NOT_FOUND,
|
---|
403 | "Cannot locate a resource group called '" + resGroup + "'",
|
---|
404 | "ResourceGroupManager::addResourceLocation");
|
---|
405 | }
|
---|
406 |
|
---|
407 | OGRE_LOCK_MUTEX(grp->OGRE_AUTO_MUTEX_NAME) // lock group mutex
|
---|
408 |
|
---|
409 | // Remove from location list
|
---|
410 | LocationList::iterator li, liend;
|
---|
411 | liend = grp->locationList.end();
|
---|
412 | for (li = grp->locationList.begin(); li != liend; ++li)
|
---|
413 | {
|
---|
414 | Archive* pArch = (*li)->archive;
|
---|
415 | if (pArch->getName() == name)
|
---|
416 | {
|
---|
417 | // Delete indexes
|
---|
418 | ResourceLocationIndex::iterator rit, ritend;
|
---|
419 | ritend = grp->resourceIndexCaseInsensitive.end();
|
---|
420 | for (rit = grp->resourceIndexCaseInsensitive.begin(); rit != ritend;)
|
---|
421 | {
|
---|
422 | if (rit->second == pArch)
|
---|
423 | {
|
---|
424 | ResourceLocationIndex::iterator del = rit++;
|
---|
425 | grp->resourceIndexCaseInsensitive.erase(del);
|
---|
426 | }
|
---|
427 | else
|
---|
428 | {
|
---|
429 | ++rit;
|
---|
430 | }
|
---|
431 | }
|
---|
432 | ritend = grp->resourceIndexCaseSensitive.end();
|
---|
433 | for (rit = grp->resourceIndexCaseSensitive.begin(); rit != ritend;)
|
---|
434 | {
|
---|
435 | if (rit->second == pArch)
|
---|
436 | {
|
---|
437 | ResourceLocationIndex::iterator del = rit++;
|
---|
438 | grp->resourceIndexCaseSensitive.erase(del);
|
---|
439 | }
|
---|
440 | else
|
---|
441 | {
|
---|
442 | ++rit;
|
---|
443 | }
|
---|
444 | }
|
---|
445 | // Erase list entry
|
---|
446 | delete *li;
|
---|
447 | grp->locationList.erase(li);
|
---|
448 | break;
|
---|
449 | }
|
---|
450 |
|
---|
451 | }
|
---|
452 |
|
---|
453 | LogManager::getSingleton().logMessage("Removed resource location " + name);
|
---|
454 |
|
---|
455 |
|
---|
456 | }
|
---|
457 | //-----------------------------------------------------------------------
|
---|
458 | void ResourceGroupManager::declareResource(const String& name,
|
---|
459 | const String& resourceType, const String& groupName,
|
---|
460 | const NameValuePairList& loadParameters)
|
---|
461 | {
|
---|
462 | declareResource(name, resourceType, groupName, 0, loadParameters);
|
---|
463 | }
|
---|
464 | //-----------------------------------------------------------------------
|
---|
465 | void ResourceGroupManager::declareResource(const String& name,
|
---|
466 | const String& resourceType, const String& groupName,
|
---|
467 | ManualResourceLoader* loader,
|
---|
468 | const NameValuePairList& loadParameters)
|
---|
469 | {
|
---|
470 | ResourceGroup* grp = getResourceGroup(groupName);
|
---|
471 | if (!grp)
|
---|
472 | {
|
---|
473 | OGRE_EXCEPT(Exception::ERR_ITEM_NOT_FOUND,
|
---|
474 | "Cannot find a group named " + groupName,
|
---|
475 | "ResourceGroupManager::declareResource");
|
---|
476 | }
|
---|
477 |
|
---|
478 | OGRE_LOCK_MUTEX(grp->OGRE_AUTO_MUTEX_NAME) // lock group mutex
|
---|
479 |
|
---|
480 | ResourceDeclaration dcl;
|
---|
481 | dcl.loader = loader;
|
---|
482 | dcl.parameters = loadParameters;
|
---|
483 | dcl.resourceName = name;
|
---|
484 | dcl.resourceType = resourceType;
|
---|
485 | grp->resourceDeclarations.push_back(dcl);
|
---|
486 | }
|
---|
487 | //-----------------------------------------------------------------------
|
---|
488 | void ResourceGroupManager::undeclareResource(const String& name,
|
---|
489 | const String& groupName)
|
---|
490 | {
|
---|
491 | ResourceGroup* grp = getResourceGroup(groupName);
|
---|
492 | if (!grp)
|
---|
493 | {
|
---|
494 | OGRE_EXCEPT(Exception::ERR_ITEM_NOT_FOUND,
|
---|
495 | "Cannot find a group named " + groupName,
|
---|
496 | "ResourceGroupManager::undeclareResource");
|
---|
497 | }
|
---|
498 |
|
---|
499 | OGRE_LOCK_MUTEX(grp->OGRE_AUTO_MUTEX_NAME) // lock group mutex
|
---|
500 |
|
---|
501 | for (ResourceDeclarationList::iterator i = grp->resourceDeclarations.begin();
|
---|
502 | i != grp->resourceDeclarations.end(); ++i)
|
---|
503 | {
|
---|
504 | if (i->resourceName == name)
|
---|
505 | {
|
---|
506 | grp->resourceDeclarations.erase(i);
|
---|
507 | break;
|
---|
508 | }
|
---|
509 | }
|
---|
510 | }
|
---|
511 | //-----------------------------------------------------------------------
|
---|
512 | DataStreamPtr ResourceGroupManager::openResource(
|
---|
513 | const String& resourceName, const String& groupName,
|
---|
514 | bool searchGroupsIfNotFound, Resource* resourceBeingLoaded)
|
---|
515 | {
|
---|
516 | // Try to find in resource index first
|
---|
517 | ResourceGroup* grp = getResourceGroup(groupName);
|
---|
518 | if (!grp)
|
---|
519 | {
|
---|
520 | OGRE_EXCEPT(Exception::ERR_ITEM_NOT_FOUND,
|
---|
521 | "Cannot locate a resource group called '" + groupName +
|
---|
522 | "' for resource '" + resourceName + "'" ,
|
---|
523 | "ResourceGroupManager::openResource");
|
---|
524 | }
|
---|
525 |
|
---|
526 | OGRE_LOCK_MUTEX(grp->OGRE_AUTO_MUTEX_NAME) // lock group mutex
|
---|
527 |
|
---|
528 | Archive* pArch = 0;
|
---|
529 | ResourceLocationIndex::iterator rit = grp->resourceIndexCaseSensitive.find(resourceName);
|
---|
530 | if (rit != grp->resourceIndexCaseSensitive.end())
|
---|
531 | {
|
---|
532 | // Found in the index
|
---|
533 | pArch = rit->second;
|
---|
534 | return pArch->open(resourceName);
|
---|
535 | }
|
---|
536 | else
|
---|
537 | {
|
---|
538 | // try case insensitive
|
---|
539 | String lcResourceName = resourceName;
|
---|
540 | StringUtil::toLowerCase(lcResourceName);
|
---|
541 | rit = grp->resourceIndexCaseInsensitive.find(lcResourceName);
|
---|
542 | if (rit != grp->resourceIndexCaseInsensitive.end())
|
---|
543 | {
|
---|
544 | // Found in the index
|
---|
545 | pArch = rit->second;
|
---|
546 | return pArch->open(resourceName);
|
---|
547 | }
|
---|
548 | else
|
---|
549 | {
|
---|
550 | // Search the hard way
|
---|
551 | LocationList::iterator li, liend;
|
---|
552 | liend = grp->locationList.end();
|
---|
553 | for (li = grp->locationList.begin(); li != liend; ++li)
|
---|
554 | {
|
---|
555 | Archive* arch = (*li)->archive;
|
---|
556 | if (arch->exists(resourceName))
|
---|
557 | {
|
---|
558 | DataStreamPtr ptr = arch->open(resourceName);
|
---|
559 | return ptr;
|
---|
560 | }
|
---|
561 | }
|
---|
562 | }
|
---|
563 | }
|
---|
564 |
|
---|
565 |
|
---|
566 | // Not found
|
---|
567 | if (searchGroupsIfNotFound)
|
---|
568 | {
|
---|
569 | ResourceGroup* grp = findGroupContainingResourceImpl(resourceName);
|
---|
570 | if (grp)
|
---|
571 | {
|
---|
572 | if (resourceBeingLoaded)
|
---|
573 | {
|
---|
574 | resourceBeingLoaded->changeGroupOwnership(grp->name);
|
---|
575 | }
|
---|
576 | return openResource(resourceName, grp->name, false);
|
---|
577 | }
|
---|
578 | else
|
---|
579 | {
|
---|
580 | OGRE_EXCEPT(Exception::ERR_FILE_NOT_FOUND,
|
---|
581 | "Cannot locate resource " + resourceName +
|
---|
582 | " in resource group " + groupName + " or any other group.",
|
---|
583 | "ResourceGroupManager::openResource");
|
---|
584 | }
|
---|
585 | }
|
---|
586 | OGRE_EXCEPT(Exception::ERR_FILE_NOT_FOUND, "Cannot locate resource " +
|
---|
587 | resourceName + " in resource group " + groupName + ".",
|
---|
588 | "ResourceGroupManager::openResource");
|
---|
589 |
|
---|
590 | // Keep compiler happy
|
---|
591 | return DataStreamPtr();
|
---|
592 |
|
---|
593 |
|
---|
594 | }
|
---|
595 | //-----------------------------------------------------------------------
|
---|
596 | DataStreamListPtr ResourceGroupManager::openResources(
|
---|
597 | const String& pattern, const String& groupName)
|
---|
598 | {
|
---|
599 | ResourceGroup* grp = getResourceGroup(groupName);
|
---|
600 | if (!grp)
|
---|
601 | {
|
---|
602 | OGRE_EXCEPT(Exception::ERR_ITEM_NOT_FOUND,
|
---|
603 | "Cannot locate a resource group called '" + groupName + "'",
|
---|
604 | "ResourceGroupManager::openResources");
|
---|
605 | }
|
---|
606 |
|
---|
607 | OGRE_LOCK_MUTEX(grp->OGRE_AUTO_MUTEX_NAME) // lock group mutex
|
---|
608 |
|
---|
609 | // Iterate through all the archives and build up a combined list of
|
---|
610 | // streams
|
---|
611 | DataStreamListPtr ret = DataStreamListPtr(new DataStreamList());
|
---|
612 |
|
---|
613 | LocationList::iterator li, liend;
|
---|
614 | liend = grp->locationList.end();
|
---|
615 | for (li = grp->locationList.begin(); li != liend; ++li)
|
---|
616 | {
|
---|
617 | Archive* arch = (*li)->archive;
|
---|
618 | // Find all the names based on whether this archive is recursive
|
---|
619 | StringVectorPtr names = arch->find(pattern, (*li)->recursive);
|
---|
620 |
|
---|
621 | // Iterate over the names and load a stream for each
|
---|
622 | for (StringVector::iterator ni = names->begin(); ni != names->end(); ++ni)
|
---|
623 | {
|
---|
624 | DataStreamPtr ptr = arch->open(*ni);
|
---|
625 | if (!ptr.isNull())
|
---|
626 | {
|
---|
627 | ret->push_back(ptr);
|
---|
628 | }
|
---|
629 | }
|
---|
630 | }
|
---|
631 | return ret;
|
---|
632 |
|
---|
633 | }
|
---|
634 | //-----------------------------------------------------------------------
|
---|
635 | void ResourceGroupManager::addResourceGroupListener(ResourceGroupListener* l)
|
---|
636 | {
|
---|
637 | OGRE_LOCK_AUTO_MUTEX
|
---|
638 |
|
---|
639 | mResourceGroupListenerList.push_back(l);
|
---|
640 | }
|
---|
641 | //-----------------------------------------------------------------------
|
---|
642 | void ResourceGroupManager::removeResourceGroupListener(ResourceGroupListener* l)
|
---|
643 | {
|
---|
644 | OGRE_LOCK_AUTO_MUTEX
|
---|
645 |
|
---|
646 | for (ResourceGroupListenerList::iterator i = mResourceGroupListenerList.begin();
|
---|
647 | i != mResourceGroupListenerList.end(); ++i)
|
---|
648 | {
|
---|
649 | if (*i == l)
|
---|
650 | {
|
---|
651 | mResourceGroupListenerList.erase(i);
|
---|
652 | break;
|
---|
653 | }
|
---|
654 | }
|
---|
655 | }
|
---|
656 | //-----------------------------------------------------------------------
|
---|
657 | void ResourceGroupManager::_registerResourceManager(
|
---|
658 | const String& resourceType, ResourceManager* rm)
|
---|
659 | {
|
---|
660 | OGRE_LOCK_AUTO_MUTEX
|
---|
661 |
|
---|
662 | LogManager::getSingleton().logMessage(
|
---|
663 | "Registering ResourceManager for type " + resourceType);
|
---|
664 | mResourceManagerMap[resourceType] = rm;
|
---|
665 | }
|
---|
666 | //-----------------------------------------------------------------------
|
---|
667 | void ResourceGroupManager::_unregisterResourceManager(
|
---|
668 | const String& resourceType)
|
---|
669 | {
|
---|
670 | OGRE_LOCK_AUTO_MUTEX
|
---|
671 |
|
---|
672 | LogManager::getSingleton().logMessage(
|
---|
673 | "Unregistering ResourceManager for type " + resourceType);
|
---|
674 |
|
---|
675 | ResourceManagerMap::iterator i = mResourceManagerMap.find(resourceType);
|
---|
676 | if (i != mResourceManagerMap.end())
|
---|
677 | {
|
---|
678 | mResourceManagerMap.erase(i);
|
---|
679 | }
|
---|
680 | }
|
---|
681 | //-----------------------------------------------------------------------
|
---|
682 | void ResourceGroupManager::_registerScriptLoader(ScriptLoader* su)
|
---|
683 | {
|
---|
684 | OGRE_LOCK_AUTO_MUTEX
|
---|
685 |
|
---|
686 | mScriptLoaderOrderMap.insert(
|
---|
687 | ScriptLoaderOrderMap::value_type(su->getLoadingOrder(), su));
|
---|
688 | }
|
---|
689 | //-----------------------------------------------------------------------
|
---|
690 | void ResourceGroupManager::_unregisterScriptLoader(ScriptLoader* su)
|
---|
691 | {
|
---|
692 | OGRE_LOCK_AUTO_MUTEX
|
---|
693 |
|
---|
694 | Real order = su->getLoadingOrder();
|
---|
695 | ScriptLoaderOrderMap::iterator oi = mScriptLoaderOrderMap.find(order);
|
---|
696 | while (oi != mScriptLoaderOrderMap.end() && oi->first == order)
|
---|
697 | {
|
---|
698 | if (oi->second == su)
|
---|
699 | {
|
---|
700 | // erase does not invalidate on multimap, except current
|
---|
701 | ScriptLoaderOrderMap::iterator del = oi++;
|
---|
702 | mScriptLoaderOrderMap.erase(del);
|
---|
703 | }
|
---|
704 | else
|
---|
705 | {
|
---|
706 | ++oi;
|
---|
707 | }
|
---|
708 | }
|
---|
709 | }
|
---|
710 | //-----------------------------------------------------------------------
|
---|
711 | void ResourceGroupManager::parseResourceGroupScripts(ResourceGroup* grp)
|
---|
712 | {
|
---|
713 |
|
---|
714 | LogManager::getSingleton().logMessage(
|
---|
715 | "Parsing scripts for resource group " + grp->name);
|
---|
716 |
|
---|
717 | // Count up the number of scripts we have to parse
|
---|
718 | typedef std::list<FileInfoListPtr> FileListList;
|
---|
719 | typedef SharedPtr<FileListList> FileListListPtr;
|
---|
720 | typedef std::pair<ScriptLoader*, FileListListPtr> LoaderFileListPair;
|
---|
721 | typedef std::list<LoaderFileListPair> ScriptLoaderFileList;
|
---|
722 | ScriptLoaderFileList scriptLoaderFileList;
|
---|
723 | size_t scriptCount = 0;
|
---|
724 | // Iterate over script users in loading order and get streams
|
---|
725 | ScriptLoaderOrderMap::iterator oi;
|
---|
726 | for (oi = mScriptLoaderOrderMap.begin();
|
---|
727 | oi != mScriptLoaderOrderMap.end(); ++oi)
|
---|
728 | {
|
---|
729 | ScriptLoader* su = oi->second;
|
---|
730 | FileListListPtr fileListList(new FileListList);
|
---|
731 |
|
---|
732 | // Get all the patterns and search them
|
---|
733 | const StringVector& patterns = su->getScriptPatterns();
|
---|
734 | for (StringVector::const_iterator p = patterns.begin(); p != patterns.end(); ++p)
|
---|
735 | {
|
---|
736 | FileInfoListPtr fileList = findResourceFileInfo(grp->name, *p);
|
---|
737 | scriptCount += fileList->size();
|
---|
738 | fileListList->push_back(fileList);
|
---|
739 | }
|
---|
740 | scriptLoaderFileList.push_back(
|
---|
741 | LoaderFileListPair(su, fileListList));
|
---|
742 | }
|
---|
743 | // Fire scripting event
|
---|
744 | fireResourceGroupScriptingStarted(grp->name, scriptCount);
|
---|
745 |
|
---|
746 | // Iterate over scripts and parse
|
---|
747 | // Note we respect original ordering
|
---|
748 | for (ScriptLoaderFileList::iterator slfli = scriptLoaderFileList.begin();
|
---|
749 | slfli != scriptLoaderFileList.end(); ++slfli)
|
---|
750 | {
|
---|
751 | ScriptLoader* su = slfli->first;
|
---|
752 | // Iterate over each list
|
---|
753 | for (FileListList::iterator flli = slfli->second->begin(); flli != slfli->second->end(); ++flli)
|
---|
754 | {
|
---|
755 | // Iterate over each item in the list
|
---|
756 | for (FileInfoList::iterator fii = (*flli)->begin(); fii != (*flli)->end(); ++fii)
|
---|
757 | {
|
---|
758 | LogManager::getSingleton().logMessage(
|
---|
759 | "Parsing script " + fii->filename);
|
---|
760 | fireScriptStarted(fii->filename);
|
---|
761 | {
|
---|
762 | DataStreamPtr stream = fii->archive->open(fii->filename);
|
---|
763 | if (!stream.isNull())
|
---|
764 | {
|
---|
765 | su->parseScript(stream, grp->name);
|
---|
766 | }
|
---|
767 | }
|
---|
768 | fireScriptEnded();
|
---|
769 | }
|
---|
770 | }
|
---|
771 | }
|
---|
772 |
|
---|
773 | fireResourceGroupScriptingEnded(grp->name);
|
---|
774 | LogManager::getSingleton().logMessage(
|
---|
775 | "Finished parsing scripts for resource group " + grp->name);
|
---|
776 | }
|
---|
777 | //-----------------------------------------------------------------------
|
---|
778 | void ResourceGroupManager::createDeclaredResources(ResourceGroup* grp)
|
---|
779 | {
|
---|
780 |
|
---|
781 | for (ResourceDeclarationList::iterator i = grp->resourceDeclarations.begin();
|
---|
782 | i != grp->resourceDeclarations.end(); ++i)
|
---|
783 | {
|
---|
784 | ResourceDeclaration& dcl = *i;
|
---|
785 | // Retrieve the appropriate manager
|
---|
786 | ResourceManager* mgr = _getResourceManager(dcl.resourceType);
|
---|
787 | // Create the resource
|
---|
788 | ResourcePtr res = mgr->create(dcl.resourceName, grp->name,
|
---|
789 | dcl.loader != 0, dcl.loader, &dcl.parameters);
|
---|
790 | // Add resource to load list
|
---|
791 | ResourceGroup::LoadResourceOrderMap::iterator li =
|
---|
792 | grp->loadResourceOrderMap.find(mgr->getLoadingOrder());
|
---|
793 | LoadUnloadResourceList* loadList;
|
---|
794 | if (li == grp->loadResourceOrderMap.end())
|
---|
795 | {
|
---|
796 | loadList = new LoadUnloadResourceList();
|
---|
797 | grp->loadResourceOrderMap[mgr->getLoadingOrder()] = loadList;
|
---|
798 | }
|
---|
799 | else
|
---|
800 | {
|
---|
801 | loadList = li->second;
|
---|
802 | }
|
---|
803 | loadList->push_back(res);
|
---|
804 |
|
---|
805 | }
|
---|
806 |
|
---|
807 | }
|
---|
808 | //-----------------------------------------------------------------------
|
---|
809 | void ResourceGroupManager::_notifyResourceCreated(ResourcePtr& res)
|
---|
810 | {
|
---|
811 | if (mCurrentGroup)
|
---|
812 | {
|
---|
813 | // Use current group (batch loading)
|
---|
814 | addCreatedResource(res, *mCurrentGroup);
|
---|
815 | }
|
---|
816 | else
|
---|
817 | {
|
---|
818 | // Find group
|
---|
819 | ResourceGroup* grp = getResourceGroup(res->getGroup());
|
---|
820 | if (grp)
|
---|
821 | {
|
---|
822 | addCreatedResource(res, *grp);
|
---|
823 | }
|
---|
824 | }
|
---|
825 | }
|
---|
826 | //-----------------------------------------------------------------------
|
---|
827 | void ResourceGroupManager::_notifyResourceRemoved(ResourcePtr& res)
|
---|
828 | {
|
---|
829 | if (mCurrentGroup)
|
---|
830 | {
|
---|
831 | // Do nothing - we're batch unloading so list will be cleared
|
---|
832 | }
|
---|
833 | else
|
---|
834 | {
|
---|
835 | // Find group
|
---|
836 | ResourceGroup* grp = getResourceGroup(res->getGroup());
|
---|
837 | if (grp)
|
---|
838 | {
|
---|
839 | OGRE_LOCK_MUTEX(grp->OGRE_AUTO_MUTEX_NAME) // lock group mutex
|
---|
840 | ResourceGroup::LoadResourceOrderMap::iterator i =
|
---|
841 | grp->loadResourceOrderMap.find(
|
---|
842 | res->getCreator()->getLoadingOrder());
|
---|
843 | if (i != grp->loadResourceOrderMap.end())
|
---|
844 | {
|
---|
845 | // Iterate over the resource list and remove
|
---|
846 | LoadUnloadResourceList* resList = i->second;
|
---|
847 | for (LoadUnloadResourceList::iterator l = resList->begin();
|
---|
848 | l != resList->end(); ++ l)
|
---|
849 | {
|
---|
850 | if ((*l).getPointer() == res.getPointer())
|
---|
851 | {
|
---|
852 | // this is the one
|
---|
853 | resList->erase(l);
|
---|
854 | break;
|
---|
855 | }
|
---|
856 | }
|
---|
857 | }
|
---|
858 | }
|
---|
859 | }
|
---|
860 | }
|
---|
861 | //-----------------------------------------------------------------------
|
---|
862 | void ResourceGroupManager::_notifyResourceGroupChanged(const String& oldGroup,
|
---|
863 | Resource* res)
|
---|
864 | {
|
---|
865 | OGRE_LOCK_AUTO_MUTEX
|
---|
866 |
|
---|
867 | // New group
|
---|
868 | ResourceGroup* newGrp = getResourceGroup(res->getGroup());
|
---|
869 | // find old entry
|
---|
870 | ResourceGroupMap::iterator grpi = mResourceGroupMap.find(oldGroup);
|
---|
871 |
|
---|
872 | assert(grpi != mResourceGroupMap.end());
|
---|
873 | ResourceGroup* grp = grpi->second;
|
---|
874 | Real order = res->getCreator()->getLoadingOrder();
|
---|
875 | ResourceGroup::LoadResourceOrderMap::iterator i =
|
---|
876 | grp->loadResourceOrderMap.find(order);
|
---|
877 | assert(i != grp->loadResourceOrderMap.end());
|
---|
878 | LoadUnloadResourceList* loadList = i->second;
|
---|
879 | for (LoadUnloadResourceList::iterator l = loadList->begin();
|
---|
880 | l != loadList->end(); ++l)
|
---|
881 | {
|
---|
882 | if ((*l).getPointer() == res)
|
---|
883 | {
|
---|
884 | addCreatedResource(*l, *newGrp);
|
---|
885 | loadList->erase(l);
|
---|
886 | break;
|
---|
887 | }
|
---|
888 | }
|
---|
889 |
|
---|
890 | }
|
---|
891 | //-----------------------------------------------------------------------
|
---|
892 | void ResourceGroupManager::_notifyAllResourcesRemoved(ResourceManager* manager)
|
---|
893 | {
|
---|
894 | OGRE_LOCK_AUTO_MUTEX
|
---|
895 |
|
---|
896 | // Iterate over all groups
|
---|
897 | for (ResourceGroupMap::iterator grpi = mResourceGroupMap.begin();
|
---|
898 | grpi != mResourceGroupMap.end(); ++grpi)
|
---|
899 | {
|
---|
900 | OGRE_LOCK_MUTEX(grpi->second->OGRE_AUTO_MUTEX_NAME)
|
---|
901 | // Iterate over all priorities
|
---|
902 | for (ResourceGroup::LoadResourceOrderMap::iterator oi = grpi->second->loadResourceOrderMap.begin();
|
---|
903 | oi != grpi->second->loadResourceOrderMap.end(); ++oi)
|
---|
904 | {
|
---|
905 | // Iterate over all resources
|
---|
906 | for (LoadUnloadResourceList::iterator l = oi->second->begin();
|
---|
907 | l != oi->second->end(); )
|
---|
908 | {
|
---|
909 | if ((*l)->getCreator() == manager)
|
---|
910 | {
|
---|
911 | // Increment first since iterator will be invalidated
|
---|
912 | LoadUnloadResourceList::iterator del = l++;
|
---|
913 | oi->second->erase(del);
|
---|
914 | }
|
---|
915 | else
|
---|
916 | {
|
---|
917 | ++l;
|
---|
918 | }
|
---|
919 | }
|
---|
920 | }
|
---|
921 |
|
---|
922 | }
|
---|
923 | }
|
---|
924 | //-----------------------------------------------------------------------
|
---|
925 | void ResourceGroupManager::addCreatedResource(ResourcePtr& res, ResourceGroup& grp)
|
---|
926 | {
|
---|
927 | OGRE_LOCK_MUTEX(grp.OGRE_AUTO_MUTEX_NAME)
|
---|
928 | Real order = res->getCreator()->getLoadingOrder();
|
---|
929 |
|
---|
930 | ResourceGroup::LoadResourceOrderMap::iterator i = grp.loadResourceOrderMap.find(order);
|
---|
931 | LoadUnloadResourceList* loadList;
|
---|
932 | if (i == grp.loadResourceOrderMap.end())
|
---|
933 | {
|
---|
934 | loadList = new LoadUnloadResourceList();
|
---|
935 | grp.loadResourceOrderMap[order] = loadList;
|
---|
936 | }
|
---|
937 | else
|
---|
938 | {
|
---|
939 | loadList = i->second;
|
---|
940 | }
|
---|
941 | loadList->push_back(res);
|
---|
942 | }
|
---|
943 | //-----------------------------------------------------------------------
|
---|
944 | ResourceGroupManager::ResourceGroup* ResourceGroupManager::getResourceGroup(const String& name)
|
---|
945 | {
|
---|
946 | OGRE_LOCK_AUTO_MUTEX
|
---|
947 |
|
---|
948 | ResourceGroupMap::iterator i = mResourceGroupMap.find(name);
|
---|
949 | if (i != mResourceGroupMap.end())
|
---|
950 | {
|
---|
951 | return i->second;
|
---|
952 | }
|
---|
953 | return 0;
|
---|
954 |
|
---|
955 | }
|
---|
956 | //-----------------------------------------------------------------------
|
---|
957 | ResourceManager* ResourceGroupManager::_getResourceManager(const String& resourceType)
|
---|
958 | {
|
---|
959 | OGRE_LOCK_AUTO_MUTEX
|
---|
960 |
|
---|
961 | ResourceManagerMap::iterator i = mResourceManagerMap.find(resourceType);
|
---|
962 | if (i == mResourceManagerMap.end())
|
---|
963 | {
|
---|
964 | OGRE_EXCEPT(Exception::ERR_ITEM_NOT_FOUND,
|
---|
965 | "Cannot locate resource manager for resource type '" +
|
---|
966 | resourceType + "'", "ResourceGroupManager::_getResourceManager");
|
---|
967 | }
|
---|
968 | return i->second;
|
---|
969 |
|
---|
970 | }
|
---|
971 | //-----------------------------------------------------------------------
|
---|
972 | void ResourceGroupManager::dropGroupContents(ResourceGroup* grp)
|
---|
973 | {
|
---|
974 | OGRE_LOCK_MUTEX(grp->OGRE_AUTO_MUTEX_NAME)
|
---|
975 |
|
---|
976 | bool groupSet = false;
|
---|
977 | if (!mCurrentGroup)
|
---|
978 | {
|
---|
979 | // Set current group to indicate ignoring of notifications
|
---|
980 | mCurrentGroup = grp;
|
---|
981 | groupSet = true;
|
---|
982 | }
|
---|
983 | // delete all the load list entries
|
---|
984 | ResourceGroup::LoadResourceOrderMap::iterator j, jend;
|
---|
985 | jend = grp->loadResourceOrderMap.end();
|
---|
986 | for (j = grp->loadResourceOrderMap.begin(); j != jend; ++j)
|
---|
987 | {
|
---|
988 | // Iterate over resources
|
---|
989 | for (LoadUnloadResourceList::iterator k = j->second->begin();
|
---|
990 | k != j->second->end(); ++k)
|
---|
991 | {
|
---|
992 | (*k)->getCreator()->remove((*k)->getHandle());
|
---|
993 | }
|
---|
994 | delete j->second;
|
---|
995 | }
|
---|
996 | grp->loadResourceOrderMap.clear();
|
---|
997 |
|
---|
998 | if (groupSet)
|
---|
999 | {
|
---|
1000 | mCurrentGroup = 0;
|
---|
1001 | }
|
---|
1002 | }
|
---|
1003 | //-----------------------------------------------------------------------
|
---|
1004 | void ResourceGroupManager::deleteGroup(ResourceGroup* grp)
|
---|
1005 | {
|
---|
1006 | OGRE_LOCK_MUTEX(grp->OGRE_AUTO_MUTEX_NAME)
|
---|
1007 | // delete all the load list entries
|
---|
1008 | ResourceGroup::LoadResourceOrderMap::iterator j, jend;
|
---|
1009 | jend = grp->loadResourceOrderMap.end();
|
---|
1010 | for (j = grp->loadResourceOrderMap.begin(); j != jend; ++j)
|
---|
1011 | {
|
---|
1012 | // Don't iterate over resources to drop with ResourceManager
|
---|
1013 | // Assume this is being done anyway since this is a shutdown method
|
---|
1014 | delete j->second;
|
---|
1015 | }
|
---|
1016 | // Drop location list
|
---|
1017 | for (LocationList::iterator ll = grp->locationList.begin();
|
---|
1018 | ll != grp->locationList.end(); ++ll)
|
---|
1019 | {
|
---|
1020 | delete *ll;
|
---|
1021 | }
|
---|
1022 |
|
---|
1023 | // delete ResourceGroup
|
---|
1024 | delete grp;
|
---|
1025 | }
|
---|
1026 | //-----------------------------------------------------------------------
|
---|
1027 | void ResourceGroupManager::fireResourceGroupScriptingStarted(const String& groupName, size_t scriptCount)
|
---|
1028 | {
|
---|
1029 | OGRE_LOCK_AUTO_MUTEX
|
---|
1030 | for (ResourceGroupListenerList::iterator l = mResourceGroupListenerList.begin();
|
---|
1031 | l != mResourceGroupListenerList.end(); ++l)
|
---|
1032 | {
|
---|
1033 | (*l)->resourceGroupScriptingStarted(groupName, scriptCount);
|
---|
1034 | }
|
---|
1035 | }
|
---|
1036 | //-----------------------------------------------------------------------
|
---|
1037 | void ResourceGroupManager::fireScriptStarted(const String& scriptName)
|
---|
1038 | {
|
---|
1039 | OGRE_LOCK_AUTO_MUTEX
|
---|
1040 | for (ResourceGroupListenerList::iterator l = mResourceGroupListenerList.begin();
|
---|
1041 | l != mResourceGroupListenerList.end(); ++l)
|
---|
1042 | {
|
---|
1043 | (*l)->scriptParseStarted(scriptName);
|
---|
1044 | }
|
---|
1045 | }
|
---|
1046 | //-----------------------------------------------------------------------
|
---|
1047 | void ResourceGroupManager::fireScriptEnded(void)
|
---|
1048 | {
|
---|
1049 | OGRE_LOCK_AUTO_MUTEX
|
---|
1050 | for (ResourceGroupListenerList::iterator l = mResourceGroupListenerList.begin();
|
---|
1051 | l != mResourceGroupListenerList.end(); ++l)
|
---|
1052 | {
|
---|
1053 | (*l)->scriptParseEnded();
|
---|
1054 | }
|
---|
1055 | }
|
---|
1056 | //-----------------------------------------------------------------------
|
---|
1057 | void ResourceGroupManager::fireResourceGroupScriptingEnded(const String& groupName)
|
---|
1058 | {
|
---|
1059 | OGRE_LOCK_AUTO_MUTEX
|
---|
1060 | for (ResourceGroupListenerList::iterator l = mResourceGroupListenerList.begin();
|
---|
1061 | l != mResourceGroupListenerList.end(); ++l)
|
---|
1062 | {
|
---|
1063 | (*l)->resourceGroupScriptingEnded(groupName);
|
---|
1064 | }
|
---|
1065 | }
|
---|
1066 | //-----------------------------------------------------------------------
|
---|
1067 | void ResourceGroupManager::fireResourceGroupLoadStarted(const String& groupName, size_t resourceCount)
|
---|
1068 | {
|
---|
1069 | OGRE_LOCK_AUTO_MUTEX
|
---|
1070 | for (ResourceGroupListenerList::iterator l = mResourceGroupListenerList.begin();
|
---|
1071 | l != mResourceGroupListenerList.end(); ++l)
|
---|
1072 | {
|
---|
1073 | (*l)->resourceGroupLoadStarted(groupName, resourceCount);
|
---|
1074 | }
|
---|
1075 | }
|
---|
1076 | //-----------------------------------------------------------------------
|
---|
1077 | void ResourceGroupManager::fireResourceStarted(const ResourcePtr& resource)
|
---|
1078 | {
|
---|
1079 | OGRE_LOCK_AUTO_MUTEX
|
---|
1080 | for (ResourceGroupListenerList::iterator l = mResourceGroupListenerList.begin();
|
---|
1081 | l != mResourceGroupListenerList.end(); ++l)
|
---|
1082 | {
|
---|
1083 | (*l)->resourceLoadStarted(resource);
|
---|
1084 | }
|
---|
1085 | }
|
---|
1086 | //-----------------------------------------------------------------------
|
---|
1087 | void ResourceGroupManager::fireResourceEnded(void)
|
---|
1088 | {
|
---|
1089 | OGRE_LOCK_AUTO_MUTEX
|
---|
1090 | for (ResourceGroupListenerList::iterator l = mResourceGroupListenerList.begin();
|
---|
1091 | l != mResourceGroupListenerList.end(); ++l)
|
---|
1092 | {
|
---|
1093 | (*l)->resourceLoadEnded();
|
---|
1094 | }
|
---|
1095 | }
|
---|
1096 | //-----------------------------------------------------------------------
|
---|
1097 | void ResourceGroupManager::_notifyWorldGeometryStageStarted(const String& desc)
|
---|
1098 | {
|
---|
1099 | OGRE_LOCK_AUTO_MUTEX
|
---|
1100 | for (ResourceGroupListenerList::iterator l = mResourceGroupListenerList.begin();
|
---|
1101 | l != mResourceGroupListenerList.end(); ++l)
|
---|
1102 | {
|
---|
1103 | (*l)->worldGeometryStageStarted(desc);
|
---|
1104 | }
|
---|
1105 | }
|
---|
1106 | //-----------------------------------------------------------------------
|
---|
1107 | void ResourceGroupManager::_notifyWorldGeometryStageEnded(void)
|
---|
1108 | {
|
---|
1109 | OGRE_LOCK_AUTO_MUTEX
|
---|
1110 | for (ResourceGroupListenerList::iterator l = mResourceGroupListenerList.begin();
|
---|
1111 | l != mResourceGroupListenerList.end(); ++l)
|
---|
1112 | {
|
---|
1113 | (*l)->worldGeometryStageEnded();
|
---|
1114 | }
|
---|
1115 | }
|
---|
1116 | //-----------------------------------------------------------------------
|
---|
1117 | void ResourceGroupManager::fireResourceGroupLoadEnded(const String& groupName)
|
---|
1118 | {
|
---|
1119 | OGRE_LOCK_AUTO_MUTEX
|
---|
1120 | for (ResourceGroupListenerList::iterator l = mResourceGroupListenerList.begin();
|
---|
1121 | l != mResourceGroupListenerList.end(); ++l)
|
---|
1122 | {
|
---|
1123 | (*l)->resourceGroupLoadEnded(groupName);
|
---|
1124 | }
|
---|
1125 | }
|
---|
1126 | //-----------------------------------------------------------------------
|
---|
1127 | void ResourceGroupManager::shutdownAll(void)
|
---|
1128 | {
|
---|
1129 | OGRE_LOCK_AUTO_MUTEX
|
---|
1130 |
|
---|
1131 | ResourceManagerMap::iterator i, iend;
|
---|
1132 | iend = mResourceManagerMap.end();
|
---|
1133 | for (i = mResourceManagerMap.begin(); i != iend; ++i)
|
---|
1134 | {
|
---|
1135 | i->second->removeAll();
|
---|
1136 | }
|
---|
1137 | }
|
---|
1138 | //-----------------------------------------------------------------------
|
---|
1139 | StringVectorPtr ResourceGroupManager::listResourceNames(const String& groupName)
|
---|
1140 | {
|
---|
1141 | OGRE_LOCK_AUTO_MUTEX
|
---|
1142 | StringVectorPtr vec(new StringVector());
|
---|
1143 |
|
---|
1144 | // Try to find in resource index first
|
---|
1145 | ResourceGroup* grp = getResourceGroup(groupName);
|
---|
1146 | if (!grp)
|
---|
1147 | {
|
---|
1148 | OGRE_EXCEPT(Exception::ERR_ITEM_NOT_FOUND,
|
---|
1149 | "Cannot locate a resource group called '" + groupName + "'",
|
---|
1150 | "ResourceGroupManager::listResourceNames");
|
---|
1151 | }
|
---|
1152 |
|
---|
1153 | OGRE_LOCK_MUTEX(grp->OGRE_AUTO_MUTEX_NAME) // lock group mutex
|
---|
1154 |
|
---|
1155 | // Iterate over the archives
|
---|
1156 | LocationList::iterator i, iend;
|
---|
1157 | iend = grp->locationList.end();
|
---|
1158 | for (i = grp->locationList.begin(); i != iend; ++i)
|
---|
1159 | {
|
---|
1160 | StringVectorPtr lst = (*i)->archive->list((*i)->recursive);
|
---|
1161 | vec->insert(vec->end(), lst->begin(), lst->end());
|
---|
1162 | }
|
---|
1163 |
|
---|
1164 | return vec;
|
---|
1165 |
|
---|
1166 |
|
---|
1167 | }
|
---|
1168 | //-----------------------------------------------------------------------
|
---|
1169 | FileInfoListPtr ResourceGroupManager::listResourceFileInfo(const String& groupName)
|
---|
1170 | {
|
---|
1171 | OGRE_LOCK_AUTO_MUTEX
|
---|
1172 | FileInfoListPtr vec(new FileInfoList());
|
---|
1173 |
|
---|
1174 | // Try to find in resource index first
|
---|
1175 | ResourceGroup* grp = getResourceGroup(groupName);
|
---|
1176 | if (!grp)
|
---|
1177 | {
|
---|
1178 | OGRE_EXCEPT(Exception::ERR_ITEM_NOT_FOUND,
|
---|
1179 | "Cannot locate a resource group called '" + groupName + "'",
|
---|
1180 | "ResourceGroupManager::listResourceFileInfo");
|
---|
1181 | }
|
---|
1182 |
|
---|
1183 | OGRE_LOCK_MUTEX(grp->OGRE_AUTO_MUTEX_NAME) // lock group mutex
|
---|
1184 |
|
---|
1185 | // Iterate over the archives
|
---|
1186 | LocationList::iterator i, iend;
|
---|
1187 | iend = grp->locationList.end();
|
---|
1188 | for (i = grp->locationList.begin(); i != iend; ++i)
|
---|
1189 | {
|
---|
1190 | FileInfoListPtr lst = (*i)->archive->listFileInfo((*i)->recursive);
|
---|
1191 | vec->insert(vec->end(), lst->begin(), lst->end());
|
---|
1192 | }
|
---|
1193 |
|
---|
1194 | return vec;
|
---|
1195 |
|
---|
1196 | }
|
---|
1197 | //-----------------------------------------------------------------------
|
---|
1198 | StringVectorPtr ResourceGroupManager::findResourceNames(const String& groupName,
|
---|
1199 | const String& pattern)
|
---|
1200 | {
|
---|
1201 | OGRE_LOCK_AUTO_MUTEX
|
---|
1202 | StringVectorPtr vec(new StringVector());
|
---|
1203 |
|
---|
1204 | // Try to find in resource index first
|
---|
1205 | ResourceGroup* grp = getResourceGroup(groupName);
|
---|
1206 | if (!grp)
|
---|
1207 | {
|
---|
1208 | OGRE_EXCEPT(Exception::ERR_ITEM_NOT_FOUND,
|
---|
1209 | "Cannot locate a resource group called '" + groupName + "'",
|
---|
1210 | "ResourceGroupManager::findResourceNames");
|
---|
1211 | }
|
---|
1212 |
|
---|
1213 | OGRE_LOCK_MUTEX(grp->OGRE_AUTO_MUTEX_NAME) // lock group mutex
|
---|
1214 |
|
---|
1215 | // Iterate over the archives
|
---|
1216 | LocationList::iterator i, iend;
|
---|
1217 | iend = grp->locationList.end();
|
---|
1218 | for (i = grp->locationList.begin(); i != iend; ++i)
|
---|
1219 | {
|
---|
1220 | StringVectorPtr lst = (*i)->archive->find(pattern, (*i)->recursive);
|
---|
1221 | vec->insert(vec->end(), lst->begin(), lst->end());
|
---|
1222 | }
|
---|
1223 |
|
---|
1224 | return vec;
|
---|
1225 | }
|
---|
1226 | //-----------------------------------------------------------------------
|
---|
1227 | FileInfoListPtr ResourceGroupManager::findResourceFileInfo(const String& groupName,
|
---|
1228 | const String& pattern)
|
---|
1229 | {
|
---|
1230 | OGRE_LOCK_AUTO_MUTEX
|
---|
1231 | FileInfoListPtr vec(new FileInfoList());
|
---|
1232 |
|
---|
1233 | // Try to find in resource index first
|
---|
1234 | ResourceGroup* grp = getResourceGroup(groupName);
|
---|
1235 | if (!grp)
|
---|
1236 | {
|
---|
1237 | OGRE_EXCEPT(Exception::ERR_ITEM_NOT_FOUND,
|
---|
1238 | "Cannot locate a resource group called '" + groupName + "'",
|
---|
1239 | "ResourceGroupManager::findResourceFileInfo");
|
---|
1240 | }
|
---|
1241 |
|
---|
1242 | OGRE_LOCK_MUTEX(grp->OGRE_AUTO_MUTEX_NAME) // lock group mutex
|
---|
1243 |
|
---|
1244 | // Iterate over the archives
|
---|
1245 | LocationList::iterator i, iend;
|
---|
1246 | iend = grp->locationList.end();
|
---|
1247 | for (i = grp->locationList.begin(); i != iend; ++i)
|
---|
1248 | {
|
---|
1249 | FileInfoListPtr lst = (*i)->archive->findFileInfo(pattern, (*i)->recursive);
|
---|
1250 | vec->insert(vec->end(), lst->begin(), lst->end());
|
---|
1251 | }
|
---|
1252 |
|
---|
1253 | return vec;
|
---|
1254 | }
|
---|
1255 | //-----------------------------------------------------------------------
|
---|
1256 | bool ResourceGroupManager::resourceExists(const String& groupName, const String& resourceName)
|
---|
1257 | {
|
---|
1258 | OGRE_LOCK_AUTO_MUTEX
|
---|
1259 |
|
---|
1260 | // Try to find in resource index first
|
---|
1261 | ResourceGroup* grp = getResourceGroup(groupName);
|
---|
1262 | if (!grp)
|
---|
1263 | {
|
---|
1264 | OGRE_EXCEPT(Exception::ERR_ITEM_NOT_FOUND,
|
---|
1265 | "Cannot locate a resource group called '" + groupName + "'",
|
---|
1266 | "ResourceGroupManager::resourceExists");
|
---|
1267 | }
|
---|
1268 |
|
---|
1269 | return resourceExists(grp, resourceName);
|
---|
1270 | }
|
---|
1271 | //-----------------------------------------------------------------------
|
---|
1272 | bool ResourceGroupManager::resourceExists(ResourceGroup* grp, const String& resourceName)
|
---|
1273 | {
|
---|
1274 |
|
---|
1275 | OGRE_LOCK_MUTEX(grp->OGRE_AUTO_MUTEX_NAME) // lock group mutex
|
---|
1276 |
|
---|
1277 | // Try indexes first
|
---|
1278 | ResourceLocationIndex::iterator rit = grp->resourceIndexCaseSensitive.find(resourceName);
|
---|
1279 | if (rit != grp->resourceIndexCaseSensitive.end())
|
---|
1280 | {
|
---|
1281 | // Found in the index
|
---|
1282 | return true;
|
---|
1283 | }
|
---|
1284 | else
|
---|
1285 | {
|
---|
1286 | // try case insensitive
|
---|
1287 | String lcResourceName = resourceName;
|
---|
1288 | StringUtil::toLowerCase(lcResourceName);
|
---|
1289 | rit = grp->resourceIndexCaseInsensitive.find(lcResourceName);
|
---|
1290 | if (rit != grp->resourceIndexCaseInsensitive.end())
|
---|
1291 | {
|
---|
1292 | // Found in the index
|
---|
1293 | return true;
|
---|
1294 | }
|
---|
1295 | else
|
---|
1296 | {
|
---|
1297 | // Search the hard way
|
---|
1298 | LocationList::iterator li, liend;
|
---|
1299 | liend = grp->locationList.end();
|
---|
1300 | for (li = grp->locationList.begin(); li != liend; ++li)
|
---|
1301 | {
|
---|
1302 | Archive* arch = (*li)->archive;
|
---|
1303 | if (arch->exists(resourceName))
|
---|
1304 | {
|
---|
1305 | return true;
|
---|
1306 | }
|
---|
1307 | }
|
---|
1308 | }
|
---|
1309 | }
|
---|
1310 |
|
---|
1311 | return false;
|
---|
1312 |
|
---|
1313 | }
|
---|
1314 | //-----------------------------------------------------------------------
|
---|
1315 | ResourceGroupManager::ResourceGroup*
|
---|
1316 | ResourceGroupManager::findGroupContainingResourceImpl(const String& filename)
|
---|
1317 | {
|
---|
1318 | OGRE_LOCK_AUTO_MUTEX
|
---|
1319 |
|
---|
1320 | // Iterate over resource groups and find
|
---|
1321 | for (ResourceGroupMap::iterator i = mResourceGroupMap.begin();
|
---|
1322 | i != mResourceGroupMap.end(); ++i)
|
---|
1323 | {
|
---|
1324 | ResourceGroup* grp = i->second;
|
---|
1325 |
|
---|
1326 | OGRE_LOCK_MUTEX(grp->OGRE_AUTO_MUTEX_NAME) // lock group mutex
|
---|
1327 |
|
---|
1328 | if (resourceExists(grp, filename))
|
---|
1329 | return grp;
|
---|
1330 | }
|
---|
1331 | // Not found
|
---|
1332 | return 0;
|
---|
1333 | }
|
---|
1334 | //-----------------------------------------------------------------------
|
---|
1335 | const String& ResourceGroupManager::findGroupContainingResource(const String& filename)
|
---|
1336 | {
|
---|
1337 | ResourceGroup* grp = findGroupContainingResourceImpl(filename);
|
---|
1338 | if (!grp)
|
---|
1339 | {
|
---|
1340 | OGRE_EXCEPT(Exception::ERR_ITEM_NOT_FOUND,
|
---|
1341 | "Unable to derive resource group for " +
|
---|
1342 | filename + " automatically since the resource was not "
|
---|
1343 | "found.",
|
---|
1344 | "ResourceGroupManager::findGroupContainingResource");
|
---|
1345 | }
|
---|
1346 | return grp->name;
|
---|
1347 | }
|
---|
1348 | //-----------------------------------------------------------------------
|
---|
1349 | void ResourceGroupManager::linkWorldGeometryToResourceGroup(const String& group,
|
---|
1350 | const String& worldGeometry, SceneManager* sceneManager)
|
---|
1351 | {
|
---|
1352 | OGRE_LOCK_AUTO_MUTEX
|
---|
1353 | ResourceGroup* grp = getResourceGroup(group);
|
---|
1354 | if (!grp)
|
---|
1355 | {
|
---|
1356 | OGRE_EXCEPT(Exception::ERR_ITEM_NOT_FOUND,
|
---|
1357 | "Cannot locate a resource group called '" + group + "'",
|
---|
1358 | "ResourceGroupManager::linkWorldGeometryToResourceGroup");
|
---|
1359 | }
|
---|
1360 |
|
---|
1361 | OGRE_LOCK_MUTEX(grp->OGRE_AUTO_MUTEX_NAME) // lock group mutex
|
---|
1362 |
|
---|
1363 | grp->worldGeometry = worldGeometry;
|
---|
1364 | grp->worldGeometrySceneManager = sceneManager;
|
---|
1365 | }
|
---|
1366 | //-----------------------------------------------------------------------
|
---|
1367 | void ResourceGroupManager::unlinkWorldGeometryFromResourceGroup(const String& group)
|
---|
1368 | {
|
---|
1369 | OGRE_LOCK_AUTO_MUTEX
|
---|
1370 | ResourceGroup* grp = getResourceGroup(group);
|
---|
1371 | if (!grp)
|
---|
1372 | {
|
---|
1373 | OGRE_EXCEPT(Exception::ERR_ITEM_NOT_FOUND,
|
---|
1374 | "Cannot locate a resource group called '" + group + "'",
|
---|
1375 | "ResourceGroupManager::unlinkWorldGeometryFromResourceGroup");
|
---|
1376 | }
|
---|
1377 |
|
---|
1378 | OGRE_LOCK_MUTEX(grp->OGRE_AUTO_MUTEX_NAME) // lock group mutex
|
---|
1379 | grp->worldGeometry = StringUtil::BLANK;
|
---|
1380 | grp->worldGeometrySceneManager = 0;
|
---|
1381 | }
|
---|
1382 | //-----------------------------------------------------------------------
|
---|
1383 | StringVector ResourceGroupManager::getResourceGroups(void)
|
---|
1384 | {
|
---|
1385 | OGRE_LOCK_AUTO_MUTEX
|
---|
1386 | StringVector vec;
|
---|
1387 | for (ResourceGroupMap::iterator i = mResourceGroupMap.begin();
|
---|
1388 | i != mResourceGroupMap.end(); ++i)
|
---|
1389 | {
|
---|
1390 | vec.push_back(i->second->name);
|
---|
1391 | }
|
---|
1392 | return vec;
|
---|
1393 | }
|
---|
1394 | //-----------------------------------------------------------------------
|
---|
1395 | ResourceGroupManager::ResourceDeclarationList
|
---|
1396 | ResourceGroupManager::getResourceDeclarationList(const String& group)
|
---|
1397 | {
|
---|
1398 | OGRE_LOCK_AUTO_MUTEX
|
---|
1399 | ResourceGroup* grp = getResourceGroup(group);
|
---|
1400 | if (!grp)
|
---|
1401 | {
|
---|
1402 | OGRE_EXCEPT(Exception::ERR_ITEM_NOT_FOUND,
|
---|
1403 | "Cannot locate a resource group called '" + group + "'",
|
---|
1404 | "ResourceGroupManager::unlinkWorldGeometryFromResourceGroup");
|
---|
1405 | }
|
---|
1406 |
|
---|
1407 | OGRE_LOCK_MUTEX(grp->OGRE_AUTO_MUTEX_NAME) // lock group mutex
|
---|
1408 | return grp->resourceDeclarations;
|
---|
1409 | }
|
---|
1410 | //-----------------------------------------------------------------------
|
---|
1411 | ScriptLoader::~ScriptLoader()
|
---|
1412 | {
|
---|
1413 | }
|
---|
1414 |
|
---|
1415 |
|
---|
1416 | }
|
---|