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

Method addModuleDeclaredAssets

Engine/source/assets/assetManager.cpp:178–221  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

176//-----------------------------------------------------------------------------
177
178bool AssetManager::addModuleDeclaredAssets( ModuleDefinition* pModuleDefinition )
179{
180 // Debug Profiling.
181 PROFILE_SCOPE(AssetManager_AddDeclaredAssets);
182
183 // Sanity!
184 AssertFatal( pModuleDefinition != NULL, "Cannot add declared assets using a NULL module definition" );
185
186 // Does the module have any assets associated with it?
187 if ( pModuleDefinition->getModuleAssets().size() > 0 )
188 {
189 // Yes, so warn.
190 Con::warnf( "Asset Manager: Cannot add declared assets to module '%s' as it already has existing assets.", pModuleDefinition->getSignature() );
191 return false;
192 }
193
194 // Iterate the module definition children.
195 for( SimSet::iterator itr = pModuleDefinition->begin(); itr != pModuleDefinition->end(); ++itr )
196 {
197 // Fetch the declared assets.
198 DeclaredAssets* pDeclaredAssets = dynamic_cast<DeclaredAssets*>( *itr );
199
200 // Skip if it's not a declared assets location.
201 if ( pDeclaredAssets == NULL )
202 continue;
203
204 // Expand asset manifest location.
205 char filePathBuffer[1024], extensionBuffer[256];
206 String mdldfpth = pModuleDefinition->getModulePath();
207 String astfpth = pDeclaredAssets->getPath();
208
209 dSprintf(filePathBuffer, sizeof(filePathBuffer), "%s/%s", pModuleDefinition->getModulePath(), pDeclaredAssets->getPath());
210 dSprintf(extensionBuffer, sizeof(extensionBuffer), "*.%s", pDeclaredAssets->getExtension());
211
212 // Scan declared assets at location.
213 if ( !scanDeclaredAssets( filePathBuffer, extensionBuffer, pDeclaredAssets->getRecurse(), pModuleDefinition ) )
214 {
215 // Warn.
216 Con::warnf( "AssetManager::addModuleDeclaredAssets() - No assets found at location '%s' with extension '%s'.", filePathBuffer, pDeclaredAssets->getExtension() );
217 }
218 }
219
220 return true;
221}
222
223bool AssetManager::loadModuleAutoLoadAssets(ModuleDefinition* pModuleDefinition)
224{

Callers 1

Calls 10

dSprintfFunction · 0.85
getModulePathMethod · 0.80
warnfFunction · 0.50
sizeMethod · 0.45
getSignatureMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
getPathMethod · 0.45
getExtensionMethod · 0.45
getRecurseMethod · 0.45

Tested by

no test coverage detected