Add Content.GetAllAssets to get all asset ids in project
This commit is contained in:
@@ -328,12 +328,17 @@ bool AssetsCache::FindAsset(const Guid& id, AssetInfo& info)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AssetsCache::GetAll(Array<Guid>& result) const
|
||||||
|
{
|
||||||
|
PROFILE_CPU();
|
||||||
|
ScopeLock lock(_locker);
|
||||||
|
_registry.GetKeys(result);
|
||||||
|
}
|
||||||
|
|
||||||
void AssetsCache::GetAllByTypeName(const StringView& typeName, Array<Guid>& result) const
|
void AssetsCache::GetAllByTypeName(const StringView& typeName, Array<Guid>& result) const
|
||||||
{
|
{
|
||||||
PROFILE_CPU();
|
PROFILE_CPU();
|
||||||
|
|
||||||
ScopeLock lock(_locker);
|
ScopeLock lock(_locker);
|
||||||
|
|
||||||
for (auto i = _registry.Begin(); i.IsNotEnd(); ++i)
|
for (auto i = _registry.Begin(); i.IsNotEnd(); ++i)
|
||||||
{
|
{
|
||||||
if (i->Value.Info.TypeName == typeName)
|
if (i->Value.Info.TypeName == typeName)
|
||||||
|
|||||||
@@ -173,6 +173,12 @@ public:
|
|||||||
return FindAsset(id, info);
|
return FindAsset(id, info);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the asset ids.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="result">The result array.</param>
|
||||||
|
void GetAll(Array<Guid, HeapAllocation>& result) const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the asset ids that match the given typename.
|
/// Gets the asset ids that match the given typename.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -322,6 +322,13 @@ bool Content::GetAssetInfo(const StringView& path, AssetInfo& info)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Array<Guid> Content::GetAllAssets()
|
||||||
|
{
|
||||||
|
Array<Guid> result;
|
||||||
|
Cache.GetAll(result);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
Array<Guid> Content::GetAllAssetsByType(const MClass* type)
|
Array<Guid> Content::GetAllAssetsByType(const MClass* type)
|
||||||
{
|
{
|
||||||
Array<Guid> result;
|
Array<Guid> result;
|
||||||
|
|||||||
@@ -73,6 +73,12 @@ public:
|
|||||||
/// <returns>True if found any asset, otherwise false.</returns>
|
/// <returns>True if found any asset, otherwise false.</returns>
|
||||||
API_FUNCTION() static bool GetAssetInfo(const StringView& path, API_PARAM(Out) AssetInfo& info);
|
API_FUNCTION() static bool GetAssetInfo(const StringView& path, API_PARAM(Out) AssetInfo& info);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Finds all the asset IDs. Uses asset registry.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>The list of all asset IDs.</returns>
|
||||||
|
API_FUNCTION() static Array<Guid, HeapAllocation> GetAllAssets();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Finds all the asset IDs by type (exact type, without inheritance checks). Uses asset registry.
|
/// Finds all the asset IDs by type (exact type, without inheritance checks). Uses asset registry.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
Reference in New Issue
Block a user