| 176 | //----------------------------------------------------------------------------- |
| 177 | |
| 178 | bool 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 | |
| 223 | bool AssetManager::loadModuleAutoLoadAssets(ModuleDefinition* pModuleDefinition) |
| 224 | { |
no test coverage detected