Add Content.Stats for assets statistics (replaces Content.AssetCount)
This commit is contained in:
@@ -360,6 +360,25 @@ String Content::CreateTemporaryAssetPath()
|
||||
return Globals::TemporaryFolder / (Guid::New().ToString(Guid::FormatType::N) + ASSET_FILES_EXTENSION_WITH_DOT);
|
||||
}
|
||||
|
||||
ContentStats Content::GetStats()
|
||||
{
|
||||
ContentStats stats;
|
||||
AssetsLocker.Lock();
|
||||
stats.AssetsCount = Assets.Count();
|
||||
for (auto& e : Assets)
|
||||
{
|
||||
if (e.Value->IsLoaded())
|
||||
stats.LoadedAssetsCount++;
|
||||
else if (e.Value->LastLoadFailed())
|
||||
stats.LoadingAssetsCount++;
|
||||
if (e.Value->IsVirtual())
|
||||
stats.VirtualAssetsCount++;
|
||||
}
|
||||
stats.LoadingAssetsCount = stats.AssetsCount - stats.LoadingAssetsCount - stats.LoadedAssetsCount;
|
||||
AssetsLocker.Unlock();
|
||||
return stats;
|
||||
}
|
||||
|
||||
Asset* Content::LoadAsyncInternal(const StringView& internalPath, MClass* type)
|
||||
{
|
||||
CHECK_RETURN(type, nullptr);
|
||||
@@ -430,11 +449,6 @@ Asset* Content::LoadAsync(const StringView& path, const ScriptingTypeHandle& typ
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
int32 Content::GetAssetCount()
|
||||
{
|
||||
return Assets.Count();
|
||||
}
|
||||
|
||||
Array<Asset*> Content::GetAssets()
|
||||
{
|
||||
Array<Asset*> assets;
|
||||
|
||||
Reference in New Issue
Block a user