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

Method removeAssetReferences

Engine/source/assets/assetManager.cpp:2804–2854  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2802//-----------------------------------------------------------------------------
2803
2804void AssetManager::removeAssetReferences( StringTableEntry assetId )
2805{
2806 // Debug Profiling.
2807 PROFILE_SCOPE(AssetManager_RemoveAssetReferences);
2808
2809 // Sanity!
2810 AssertFatal( assetId != NULL, "Cannot rename asset references using NULL asset Id." );
2811
2812 // Finish if the asset is not referenced.
2813 if ( !mReferencedAssets.count( assetId ) )
2814 return;
2815
2816 // Setup referenced update visitor.
2817 TamlAssetReferencedUpdateVisitor assetReferencedUpdateVisitor;
2818 assetReferencedUpdateVisitor.setAssetIdFrom( assetId );
2819 assetReferencedUpdateVisitor.setAssetIdTo( StringTable->EmptyString() );
2820
2821 // Find first referenced asset Id.
2822 typeReferencedAssetsHash::Iterator referencedAssetItr = mReferencedAssets.find(assetId);
2823
2824 // Iterate references.
2825 while( true )
2826 {
2827 // Finish if end of references.
2828 if ( referencedAssetItr == mReferencedAssets.end() || referencedAssetItr->key != assetId )
2829 break;
2830
2831 // Info.
2832 if ( mEchoInfo )
2833 {
2834 Con::printf( "Asset Manager: Removing Asset Id '%s' references from file '%s'",
2835 assetId,
2836 referencedAssetItr->value );
2837 }
2838
2839 // Update asset file declaration.
2840 if ( !mTaml.parse( referencedAssetItr->value, assetReferencedUpdateVisitor ) )
2841 {
2842 // No, so warn.
2843 Con::warnf("Asset Manager: Cannot remove referenced asset Id '%s' as the referenced asset file could not be parsed: %s",
2844 assetId,
2845 referencedAssetItr->value );
2846 }
2847
2848 // Move to next reference.
2849 referencedAssetItr++;
2850 }
2851
2852 // Remove asset references.
2853 mReferencedAssets.erase( assetId );
2854}
2855
2856//-----------------------------------------------------------------------------
2857

Callers

nothing calls this directly

Calls 10

printfFunction · 0.85
EmptyStringMethod · 0.80
warnfFunction · 0.50
countMethod · 0.45
setAssetIdFromMethod · 0.45
setAssetIdToMethod · 0.45
findMethod · 0.45
endMethod · 0.45
parseMethod · 0.45
eraseMethod · 0.45

Tested by

no test coverage detected