| 311 | } |
| 312 | |
| 313 | bool ShapeAsset::loadShape() |
| 314 | { |
| 315 | mMaterialAssets.clear(); |
| 316 | mMaterialAssetIds.clear(); |
| 317 | |
| 318 | //First, load any material, animation, etc assets we may be referencing in our asset |
| 319 | // Find any asset dependencies. |
| 320 | AssetManager::typeAssetDependsOnHash::Iterator assetDependenciesItr = mpOwningAssetManager->getDependedOnAssets()->find(mpAssetDefinition->mAssetId); |
| 321 | |
| 322 | // Does the asset have any dependencies? |
| 323 | if (assetDependenciesItr != mpOwningAssetManager->getDependedOnAssets()->end()) |
| 324 | { |
| 325 | // Iterate all dependencies. |
| 326 | while (assetDependenciesItr != mpOwningAssetManager->getDependedOnAssets()->end() && assetDependenciesItr->key == mpAssetDefinition->mAssetId) |
| 327 | { |
| 328 | StringTableEntry assetType = mpOwningAssetManager->getAssetType(assetDependenciesItr->value); |
| 329 | |
| 330 | if (assetType == StringTable->insert("MaterialAsset")) |
| 331 | { |
| 332 | mMaterialAssetIds.push_front(assetDependenciesItr->value); |
| 333 | |
| 334 | //Force the asset to become initialized if it hasn't been already |
| 335 | AssetPtr<MaterialAsset> matAsset = assetDependenciesItr->value; |
| 336 | |
| 337 | mMaterialAssets.push_front(matAsset); |
| 338 | } |
| 339 | else if (assetType == StringTable->insert("ShapeAnimationAsset")) |
| 340 | { |
| 341 | mAnimationAssetIds.push_back(assetDependenciesItr->value); |
| 342 | |
| 343 | //Force the asset to become initialized if it hasn't been already |
| 344 | AssetPtr<ShapeAnimationAsset> animAsset = assetDependenciesItr->value; |
| 345 | |
| 346 | mAnimationAssets.push_back(animAsset); |
| 347 | } |
| 348 | |
| 349 | // Next dependency. |
| 350 | assetDependenciesItr++; |
| 351 | } |
| 352 | } |
| 353 | |
| 354 | mShape = ResourceManager::get().load(mFilePath); |
| 355 | |
| 356 | if (!mShape) |
| 357 | { |
| 358 | Con::errorf("ShapeAsset::loadShape : failed to load shape file %s (%s)!", getAssetName(), mFilePath); |
| 359 | mLoadedState = BadFileReference; |
| 360 | return false; //if it failed to load, bail out |
| 361 | } |
| 362 | // Construct billboards if not done already |
| 363 | if (GFXDevice::devicePresent()) |
| 364 | mShape->setupBillboardDetails(mFilePath, mDiffuseImposterPath, mNormalImposterPath); |
| 365 | |
| 366 | //If they exist, grab our imposters here and bind them to our shapeAsset |
| 367 | |
| 368 | bool hasBlends = false; |
| 369 | |
| 370 | //Now that we've successfully loaded our shape and have any materials and animations loaded |
nothing calls this directly
no test coverage detected