AssetRegistry class
Public static functions
- static auto Get() -> AssetRegistry&
- static void RegisterPendingCheckout(TnxName name, AssetType type, AssetLoad onLoaded, AssetEvict onEvicted = {})
-
template<AssetType TType>static void RegisterPendingCheckout(TnxName name, AssetLoad onLoaded, AssetEvict onEvicted = {})
Public functions
- void SetContentRoot(const std::string& root)
- Sets the absolute content root and triggers ValidateAll() on any already-registered entries.
- auto GetContentRoot() const -> const std::string&
- auto ResolvePath(const AssetEntry& entry) const -> std::string
- auto ResolvePath(const AssetID& id) const -> std::string
- auto ResolvePathByTNameAndType(TnxName name, AssetType type) const -> std::string
- void Register(const AssetID& id, TnxName name, const std::string& path, AssetType type, uint32_t schemaVersion = 0, AssetFlags flags = AssetFlags::None)
- Registers the entry and validates it immediately if ContentRoot is set.
- auto Validate(const AssetID& id) -> bool
- void ValidateAll()
- Validates all registered entries. Called by SetContentRoot(); call again after a reconcile.
- void Unregister(const AssetID& id)
- Removes an entry from the registry entirely, including its name and slot mappings.
-
auto Find(const AssetID& id) const -> FORCE_
INLINE const AssetEntry* - auto FindByTNameAndType(TnxName name, AssetType type) const -> const AssetEntry*
- auto GetAssetsByName(TnxName name) const -> std::vector<const AssetEntry*>
- auto FindMutable(const AssetID& id) -> AssetEntry*
- auto IsLoaded(const AssetID& id) const -> bool
- auto IsStreaming(const AssetID& id) const -> bool
- auto IsPinned(const AssetID& id) const -> bool
-
template<typename T>auto GetAssetData(AssetID id) const -> AssetDataRef<T>
-
template<typename T>auto GetAssetData(TnxName name) const -> AssetDataRef<T>
-
template<typename T>auto GetAssetData(AssetType type, uint32_t slot) const -> AssetDataRef<T>
- void Pin(const AssetID& id)
- void Unpin(const AssetID& id)
- void LoadManifest(const char* contentRoot)
- void TriggerLoad(const AssetID& id)
-
template<AssetType TType>void TriggerLoad(TnxName name)
- void RegisterLoader(AssetType type, void(*)(void*, AssetID) fn, void* ctx)
- void RegisterUploadChecker(bool(*)(void*) fn, void* ctx)
- auto IsUploadComplete() const -> bool
- void Checkout(const AssetID& id, Callback<void, uint32_t> onLoaded, Callback<void> onEvicted = {})
- void Checkin(const AssetID& id, void* bindCtx)
- void CheckinBySlot(AssetType type, uint32_t slot, void* bindCtx)
- void RegisterSlot(AssetType type, uint32_t slot, const AssetID& id)
- void UnregisterSlot(AssetType type, uint32_t slot)
- void DrainPendingCheckouts()
- void Evict(const AssetID& id)
- void EvictUnpinned()
- void AddAlias(const AssetID& from, const AssetID& to)
- auto GetAllEntries() const -> const std::unordered_map<AssetID, AssetEntry, AssetIDHash>&
- void Clear()
Function documentation
void AssetRegistry:: LoadManifest(const char* contentRoot)
Load registry metadata from a cooked AssetDatabase.tnxdb in contentRoot. Does not load asset data — only registers name/path/type/UUID so assets can be found by name and demand-loaded via Checkout(). Safe to call in non-editor builds.
void AssetRegistry:: TriggerLoad(const AssetID& id)
Trigger demand load without pinning. Use for pre-warming assets before entity spawn. Has no effect if the asset is already loaded or no loader is registered for its type.