MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / load

Method load

Engine/source/core/resourceManager.cpp:53–86  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

51}
52
53ResourceBase ResourceManager::load(const Torque::Path &path)
54{
55#ifdef TORQUE_DEBUG_RES_MANAGER
56 Con::printf( "ResourceManager::load : [%s]", path.getFullPath().c_str() );
57#endif
58
59 ResourceHeaderMap::Iterator iter = mResourceHeaderMap.findOrInsert( path.getFullPath() );
60
61 ResourceHeaderMap::Pair &pair = *iter;
62
63 if ( pair.value == NULL )
64 {
65 pair.value = new ResourceBase::Header;
66
67 // TODO: This can fail if the file doesn't exist
68 // at all which is possible.
69 //
70 // The problem is the templated design in ResourceManager
71 // keeps me from checking to see if the resource load failed
72 // before adding a notification.
73 //
74 // IMO the resource manager is overly templateized and
75 // we should refactor it so that its not so.
76 //
77 FS::AddChangeNotification( path, this, &ResourceManager::notifiedFileChanged );
78 }
79
80 ResourceBase::Header *header = pair.value;
81
82 if (header->getSignature() == 0)
83 header->mPath = path;
84
85 return ResourceBase( header );
86}
87
88ResourceBase ResourceManager::find(const Torque::Path &path)
89{

Callers

nothing calls this directly

Calls 6

printfFunction · 0.85
AddChangeNotificationFunction · 0.85
ResourceBaseClass · 0.85
findOrInsertMethod · 0.80
c_strMethod · 0.45
getSignatureMethod · 0.45

Tested by

no test coverage detected