Class AssetsCache
Flax Game Engine assets cache container
Inheritance
Inherited Members
Assembly: FlaxEngine.dll
File: Engine/Content/Cache/AssetsCache.h
Syntax
public class AssetsCache
Methods
DeleteAsset(const Guid& id, AssetInfo* info)
Delete asset
Declaration
public bool DeleteAsset(const Guid& id, AssetInfo* info)
Parameters
Guid
id
Asset ID |
AssetInfo
info
Output asset info |
Returns
bool
True if asset has been deleted, otherwise false |
DeleteAsset(const StringView& path, AssetInfo* info)
Delete asset
Declaration
public bool DeleteAsset(const StringView& path, AssetInfo* info)
Parameters
StringView
path
Asset path |
AssetInfo
info
Output asset info |
Returns
bool
True if asset has been deleted, otherwise false |
FindAsset(const Guid& id, AssetInfo& info)
Finds the asset info by id.
Declaration
public bool FindAsset(const Guid& id, AssetInfo& info)
Parameters
Guid
id
The asset id. |
AssetInfo
info
The output asset info. Filled with valid values if method returns true. |
Returns
bool
True if found any asset, otherwise false. |
FindAsset(const StringView& path, AssetInfo& info)
Finds the asset info by path.
Declaration
public bool FindAsset(const StringView& path, AssetInfo& info)
Parameters
StringView
path
The asset path. |
AssetInfo
info
The output asset info. Filled with valid values if method returns true. |
Returns
bool
True if found any asset, otherwise false. |
GetAll(Array<Guid, HeapAllocation>& result)
Gets the asset ids.
Declaration
public void GetAll(Array<Guid, HeapAllocation>& result) const
Parameters
Array<Guid, HeapAllocation>
result
The result array. |
GetAllByTypeName(const StringView& typeName, Array<Guid, HeapAllocation>& result)
Gets the asset ids that match the given typename.
Declaration
public void GetAllByTypeName(const StringView& typeName, Array<Guid, HeapAllocation>& result) const
Parameters
StringView
typeName
The asset typename. |
Array<Guid, HeapAllocation>
result
The result array. |
GetEditorAssetPath(const Guid& id)
Finds the asset path by id. In editor it returns the actual asset path, at runtime it returns the mapped asset path.
Declaration
public String GetEditorAssetPath(const Guid& id) const
Parameters
Guid
id
The asset id. |
Returns
String
The asset path, or empty if failed to find. |
HasAsset(const Guid& id)
Checks if asset with given ID is in registry.
Declaration
public bool HasAsset(const Guid& id)
Parameters
Guid
id
The asset id. |
Returns
bool
True if asset is in cache, otherwise false. |
HasAsset(const StringView& path)
Checks if asset with given path is in registry.
Declaration
public bool HasAsset(const StringView& path)
Parameters
StringView
path
The asset path. |
Returns
bool
True if asset is in cache, otherwise false. |
Init()
Init registry
Declaration
public void Init()
IsEntryValid(Entry& e)
Determines whether cached asset entry is valid.
Declaration
public bool IsEntryValid(Entry& e)
Parameters
Entry
e
The asset entry. |
Returns
bool
True if is valid, otherwise false. |
RegisterAsset(const AssetHeader& header, const StringView& path)
Register asset in the cache
Declaration
public void RegisterAsset(const AssetHeader& header, const StringView& path)
Parameters
AssetHeader
header
Flax asset file header |
StringView
path
Asset path |
RegisterAsset(const Guid& id, const String& typeName, const StringView& path)
Register asset in the cache
Declaration
public void RegisterAsset(const Guid& id, const String& typeName, const StringView& path)
Parameters
Guid
id
Asset ID |
String
typeName
Asset type name |
StringView
path
Asset path |
RegisterAssets(const FlaxStorageReference& storage)
Register assets in the cache
Declaration
public void RegisterAssets(const FlaxStorageReference& storage)
Parameters
FlaxStorageReference
storage
Flax assets container reference |
RegisterAssets(FlaxStorage* storage)
Register assets in the cache
Declaration
public void RegisterAssets(FlaxStorage* storage)
Parameters
FlaxStorage
storage
Flax assets container |
RenameAsset(const StringView& oldPath, const StringView& newPath)
Rename asset
Declaration
public bool RenameAsset(const StringView& oldPath, const StringView& newPath)
Parameters
StringView
oldPath
Old path |
StringView
newPath
New path |
Returns
bool
True if has been deleted, otherwise false |
Save()
Save registry
Declaration
public bool Save()
Returns
bool
True if cannot save registry |
Save(const StringView& path, const Registry& entries, const PathsMapping& pathsMapping, const AssetsCacheFlags flags=AssetsCacheFlags::None)
Saves the registry to the given file.
Declaration
public static bool Save(const StringView& path, const Registry& entries, const PathsMapping& pathsMapping, const AssetsCacheFlags flags=AssetsCacheFlags::None)
Parameters
StringView
path
The output file path. |
Registry
entries
The registry entries. |
PathsMapping
pathsMapping
The assets paths mapping table. |
AssetsCacheFlags
flags
The custom flags. |
Returns
bool
True if failed, otherwise false. |
Size()
Gets amount of registered assets.
Declaration
public int32 Size() const
Returns
int32
|