mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-04-05 04:25:16 +00:00
Adds function for sceneObjects to report utilized assets
Add reporting of used assets to tsStatics and TerrData When saving a Scene, it will write static object asset dependencies to it's levelAsset Shifted level loader logic to pass up the levelAsset rather than full level path Made it so when level is loading, the levelAsset loads its dependencies. When the level is ended, as part of cleanup, they are unloaded Shifts defaultEditorLevel to be an actual asset and made the ToolsModule load assets Fixes the Save As action to correctly save out to the new level asset Fixed the autoLoadAssets logic to be cleaner and not manually check types Removed extra, unused DefaultEditorFile file
This commit is contained in:
parent
f7dbfff42d
commit
40dd926873
21 changed files with 263 additions and 255 deletions
|
|
@ -330,9 +330,52 @@ void LevelAsset::setNavmeshFile(const char* pNavmeshFile)
|
|||
refreshAsset();
|
||||
}
|
||||
|
||||
void LevelAsset::loadDependencies()
|
||||
{
|
||||
//First, load any material, animation, etc assets we may be referencing in our asset
|
||||
// Find any asset dependencies.
|
||||
AssetManager::typeAssetDependsOnHash::Iterator assetDependenciesItr = mpOwningAssetManager->getDependedOnAssets()->find(mpAssetDefinition->mAssetId);
|
||||
|
||||
// Does the asset have any dependencies?
|
||||
if (assetDependenciesItr != mpOwningAssetManager->getDependedOnAssets()->end())
|
||||
{
|
||||
// Iterate all dependencies.
|
||||
while (assetDependenciesItr != mpOwningAssetManager->getDependedOnAssets()->end() && assetDependenciesItr->key == mpAssetDefinition->mAssetId)
|
||||
{
|
||||
//Force it to be loaded by acquiring it
|
||||
StringTableEntry assetId = assetDependenciesItr->value;
|
||||
mAssetDependencies.push_back(AssetDatabase.acquireAsset<AssetBase>(assetId));
|
||||
|
||||
// Next dependency.
|
||||
assetDependenciesItr++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void LevelAsset::unloadDependencies()
|
||||
{
|
||||
for (U32 i = 0; i < mAssetDependencies.size(); i++)
|
||||
{
|
||||
AssetBase* assetDef = mAssetDependencies[i];
|
||||
AssetDatabase.releaseAsset(assetDef->getAssetId());
|
||||
}
|
||||
}
|
||||
|
||||
DefineEngineMethod(LevelAsset, getLevelFile, const char*, (),,
|
||||
"Creates a new script asset using the targetFilePath.\n"
|
||||
"@return The bool result of calling exec")
|
||||
{
|
||||
return object->getLevelPath();
|
||||
}
|
||||
|
||||
DefineEngineMethod(LevelAsset, loadDependencies, void, (), ,
|
||||
"Initiates the loading of asset dependencies for this level.")
|
||||
{
|
||||
return object->loadDependencies();
|
||||
}
|
||||
|
||||
DefineEngineMethod(LevelAsset, unloadDependencies, void, (), ,
|
||||
"Initiates the unloading of previously loaded asset dependencies for this level.")
|
||||
{
|
||||
return object->unloadDependencies();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue