Add Content.GetEditorAssetPath

This commit is contained in:
Wojciech Figat
2022-08-08 11:48:16 +02:00
parent a4cdca80fc
commit 0eba11f1eb
3 changed files with 13 additions and 0 deletions

View File

@@ -235,6 +235,7 @@ bool AssetsCache::Save(const StringView& path, const Registry& entries, const Pa
const String& AssetsCache::GetEditorAssetPath(const Guid& id) const
{
ScopeLock lock(_locker);
#if USE_EDITOR
auto e = _registry.TryGet(id);
return e ? e->Info.Path : String::Empty;

View File

@@ -320,6 +320,11 @@ bool Content::GetAssetInfo(const StringView& path, AssetInfo& info)
#endif
}
String Content::GetEditorAssetPath(const Guid& id)
{
return Cache.GetEditorAssetPath(id);
}
Array<Guid> Content::GetAllAssets()
{
Array<Guid> result;

View File

@@ -70,6 +70,13 @@ public:
/// <returns>True if found any asset, otherwise false.</returns>
API_FUNCTION() static bool GetAssetInfo(const StringView& path, API_PARAM(Out) AssetInfo& info);
/// <summary>
/// Finds the asset path by id. In editor it returns the actual asset path, at runtime it returns the mapped asset path.
/// </summary>
/// <param name="id">The asset id.</param>
/// <returns>The asset path, or empty if failed to find.</returns>
API_FUNCTION() static String GetEditorAssetPath(const Guid& id);
/// <summary>
/// Finds all the asset IDs. Uses asset registry.
/// </summary>