Classes

Assets

Brief descriptions

Structures

nau::IAssetContainer

Provides an interface for granting access to the loaded assets.

nau::IAssetContainerLoader

Provides an interface for loading assets into containers.

nau::IAssetContainerBuilder

nau::IAssetDB

nau::AssetViewDescription

nau::IAssetDescriptor

Provides interface for retrieving asset views.

nau::IAssetDescriptorFactory

nau::IAssetListener

API to receive assets system events.

nau::IAssetManager

nau::AssetMetaInfoBase

nau::assets::GenericAssetTag

nau::RuntimeAssetRefValue

nau::IImportSettingsProvider

nau::ReloadableAssetView

Classes

nau::AssetPath

nau::IAssetPathResolver

nau::AssetRefBase

Provides asset reference generic functionality.

nau::AssetRef

Encapsulates a reference to an asset.

nau::ser_detail::RuntimeAssetRefValueImpl

Detailed information

IAssetContainer

engine/core/modules/assets/include/nau/assets/asset_container.h

struct IAssetContainer : public virtual IRefCounted

Provides an interface for granting access to the loaded assets.

Public Types

using Ptr = nau::Ptr<IAssetContainer>

Public Functions

virtual nau::Ptr getAsset(eastl::string_view path = {}) = 0
virtual eastl::vector<eastl::string> getContent() const = 0

Retrieves a collection of names of the contained assets.

Returns:

A collection of contained assets names.


IAssetContainerLoader

engine/core/modules/assets/include/nau/assets/asset_container.h

struct IAssetContainerLoader

Public Functions

virtual ~IAssetContainerLoader() = default

Destructor.

virtual eastl::vector<eastl::string_view> getSupportedAssetKind() const

Retrieves a collection of asset kinds supported by the implementation.

Returns:

A collection of asset kind names supported by the interface implementation.

virtual async::Task<IAssetContainer::Ptr> loadFromStream(io::IStreamReader::Ptr, AssetContentInfo info) = 0

Schedules asset load from a byte stream into a container.

Parameters:
  • stream[in] A pointer to the byte stream to load the asset from.

  • info[in] Additional asset information.

Returns:

Task object providing access to the operation status as well as the resulted asset container.

virtual RuntimeReadonlyDictionary::Ptr getDefaultImportSettings() const = 0

Retrieves the default settings applied when loading an asset.

Returns:

A pointer to the retrieved object.


IAssetContainerBuilder

engine/core/modules/assets/include/nau/assets/asset_container_builder.h

struct IAssetContainerBuilder

Public Functions

virtual ~IAssetContainerBuilder() = default
virtual bool isAcceptable(nau::Ptr<> asset) const = 0
virtual Result writeAssetToStream(io::IStreamWriter::Ptr stream, nau::Ptr<> asset) = 0

IAssetDB

engine/core/modules/assets/include/nau/assets/asset_db.h

struct IAssetDB

Public Functions

virtual void addAssetDB(io::FsPath dbPath) = 0
virtual void reloadAssetDB(io::FsPath dbPath) = 0
virtual AssetMetaInfoBase findAssetMetaInfoByUid(const Uid &uid) const = 0
virtual eastl::vector<AssetMetaInfoBase> findAssetMetaInfoByKind(const eastl::string &kind) const = 0
virtual eastl::string getNausdPathFromUid(const Uid &uid) const = 0
virtual Uid getUidFromNausdPath(const eastl::string &nausdPath) const = 0
virtual eastl::string getSourcePathFromUid(const Uid &uid) const = 0
virtual Uid getUidFromSourcePath(const eastl::string &sourcePath) const = 0
virtual eastl::string getSourcePathFromNausdPath(const eastl::string &nausdPath) const = 0
virtual eastl::string getNausdPathFromSourcePath(const eastl::string &sourcePath) const = 0

AssetViewDescription

engine/core/modules/assets/include/nau/assets/asset_descriptor.h

struct AssetViewDescription

Public Functions

AssetViewDescription() = default
inline AssetViewDescription(const rtti::TypeInfo &api)

Public Members

const rtti::TypeInfo *viewApi = nullptr

IAssetDescriptor

engine/core/modules/assets/include/nau/assets/asset_descriptor.h

struct IAssetDescriptor : public virtual IRefCounted

Provides interface for retrieving asset views.

Public Types

enum class UnloadResult

Values:

enumerator Unloaded
enumerator UnloadedHasReferences
enum class LoadState

Values:

enumerator None
enumerator InProgress
enumerator Ready
using Ptr = nau::Ptr<IAssetDescriptor>
using AssetId = uint64_t

Public Functions

virtual AssetId getAssetId() const = 0
virtual AssetPath getAssetPath() const = 0
virtual async::Task<IAssetView::Ptr> getAssetView(const AssetViewDescription& = {}) = 0

Schedules asset view retrieval.

Parameters:

assetViewDesc[in] Description of the asset view to retrieve (first of all, its type).

Returns:

Task object providing the operation status as well as a pointer to the retrieved view.

virtual async::Task<ReloadableAssetView::Ptr> getReloadableAssetView(const AssetViewDescription& = {}) = 0
virtual async::Task<nau::Ptr<>> getRawAsset() = 0
virtual void load() = 0

Requests asset load.

Current implementation supports asset load at the first getAssetView invokation. However, a ‘pre-load’ can be requested using load method.

virtual UnloadResult unload() = 0

Clears resource cache.

Returns:

Unloading result.

virtual LoadState getLoadState() const = 0

Retrieves asset loading operation status.

Returns:

Loading status value.

template<std::derived_from<IAssetView> ViewType>
async::Task<nau::Ptr<ViewType>> getAssetViewTyped()

Schedules asset view retrieval.

Template Parameters:

ViewType – Type of the asset view to retrieve. It has to be a subclass of IAssetView.

Returns:

Task object providing the operation status as well as a pointer to the retrieved view.


IAssetDescriptorFactory

engine/core/modules/assets/include/nau/assets/asset_descriptor_factory.h

struct IAssetDescriptorFactory

Public Functions

virtual IAssetDescriptor::Ptr createAssetDescriptor(IAssetContainer &container, eastl::string_view innerPath) = 0
virtual void addAssetContainer(const AssetPath &assetPath, nau::Ptr<IAssetContainer> container) = 0
virtual void removeAssetContainer(const AssetPath &assetPath) = 0

IAssetListener

engine/core/modules/assets/include/nau/assets/asset_listener.h

struct IAssetListener

API to receive assets system events.

Public Types

using LockAssetFunctor = Functor<async::Task<>()>

Public Functions

NAU_TYPEID(nau::IAssetListener)
virtual void onAssetLoad(IAssetDescriptor::AssetId assetId) = 0
virtual void onAssetUnload(IAssetDescriptor::AssetId assetId) = 0
virtual async::Task onAssetViewUpdate(IAssetDescriptor::AssetId assetId, IAssetView::Ptr oldAssetView, IAssetView::Ptr newAssetView) = 0

Is called by the system when the asset view needs to be updated.


IAssetManager

engine/core/modules/assets/include/nau/assets/asset_manager.h

struct IAssetManager

Public Functions

virtual IAssetDescriptor::Ptr openAsset(const AssetPath &assetPath) = 0
virtual IAssetDescriptor::Ptr preLoadAsset(const AssetPath &assetPath) = 0
virtual IAssetDescriptor::Ptr findAssetById(IAssetDescriptor::AssetId) = 0
virtual IAssetDescriptor::Ptr findAsset(const AssetPath &assetPath) = 0
virtual void removeAsset(const AssetPath &assetPath) = 0
virtual void unload(UnloadAssets flag = UnloadAssets::OnlyUnused) = 0
virtual Result<AssetPath> resolvePath(const AssetPath &assetPath) = 0

AssetMetaInfoBase

engine/core/modules/assets/include/nau/assets/asset_meta_info.h

struct AssetMetaInfoBase

Public Members

Uid uid
eastl::string dbPath
eastl::string kind
eastl::string sourceType
eastl::string sourcePath
eastl::string nausdPath
uid
dbPath
kind
sourceType
sourcePath

assets::GenericAssetTag

engine/core/modules/assets/include/nau/assets/asset_ref.h

struct GenericAssetTag

Temporary generic asset tags.


RuntimeAssetRefValue

engine/core/modules/assets/include/nau/assets/asset_ref.h

struct RuntimeAssetRefValue : public virtual RuntimePrimitiveValue

Public Functions

virtual RuntimePrimitiveValue bool isAssignable (const AssetRefBase &assetRef)=0
virtual bool setAssetRef(AssetRefBase assetRef) = 0
virtual AssetRefBase getAssetRef() const = 0

IImportSettingsProvider

engine/core/modules/assets/include/nau/assets/import_settings_provider.h

struct IImportSettingsProvider

Public Functions

virtual ~IImportSettingsProvider() = default
virtual RuntimeReadonlyDictionary::Ptr getAssetImportSettings(const io::FsPath &assetPath, const struct IAssetContainerLoader&) = 0

ReloadableAssetView

engine/core/modules/assets/include/nau/assets/reloadable_asset_view.h

struct ReloadableAssetView : public virtual IRefCounted

Public Types

using Ptr = nau::Ptr<nau::ReloadableAssetView>
using AssetViewPtr = nau::Ptr<IAssetView>

Public Functions

ReloadableAssetView(nullptr_t)
ReloadableAssetView(const ReloadableAssetView &reloadableAssetView) = delete
ReloadableAssetView(ReloadableAssetView &&reloadableAssetView) = delete
~ReloadableAssetView() = default
AssetViewPtr get()
template<std::derived_from<IAssetView> AssetViewType>
inline void getTyped(nau::Ptr<AssetViewType> &ptr)

Private Functions

ReloadableAssetView() = default
ReloadableAssetView(AssetViewPtr assetView)
void reloadAssetView(AssetViewPtr newAssetView)

Private Members

threading::SpinLock m_mutex
nau::Ptr<IAssetView> m_assetView = nullptr
friend AssetDescriptorImpl
friend AssetViewEntry

Friends

friend struct ::nau::rtti_detail::RttiClassStorage

AssetPath

engine/core/modules/assets/include/nau/assets/asset_path.h

class AssetPath

Public Functions

AssetPath()
AssetPath(const AssetPath&)
AssetPath(AssetPath&&)
AssetPath(eastl::string_view fullAssetPath)
AssetPath(eastl::string_view scheme, eastl::string_view assetContainerPath, eastl::string_view assetInnerPath = {})
AssetPath &operator=(const AssetPath&)
AssetPath &operator=(AssetPath&&)
eastl::string_view getScheme() const
eastl::string_view getContainerPath() const
eastl::string_view getSchemeAndContainerPath() const
eastl::string_view getAssetInnerPath() const
AssetPath &setScheme(eastl::string_view)
AssetPath &setContainerPath(eastl::string_view)
AssetPath &setAssetInnerPath(eastl::string_view)
bool isEmpty() const
bool hasScheme(eastl::string_view scheme) const
eastl::string toString() const
Result<AssetPath> resolve() const
explicit operator bool() const
std::strong_ordering operator<=>(const AssetPath &other) const
bool operator==(const AssetPath &other) const
bool operator==(eastl::string_view right) const

Public Static Functions

static bool isValid(eastl::string_view fullAssetPath)

Private Functions

inline size_t getHashCode() const

Private Members

eastl::string m_assetFullPath

Friends

friend struct ::std::hash
friend struct ::eastl::hash
friend Result parse(std::string_view str, AssetPath &assetPath)
friend std::string toString(const AssetPath &assetPath)

IAssetPathResolver

engine/core/modules/assets/include/nau/assets/asset_path_resolver.h

class IAssetPathResolver

Private Functions

virtual ~IAssetPathResolver() = default
virtual eastl::tuple<AssetPath, AssetContentInfo> resolvePath(const AssetPath &assetPath) = 0
virtual eastl::vector<eastl::string_view> getSupportedSchemes() const = 0

AssetRefBase

engine/core/modules/assets/include/nau/assets/asset_ref.h

class AssetRefBase

Provides asset reference generic functionality.

Subclassed by nau::AssetRef< assets::AnimationAssetTag >, nau::AssetRef< assets::SkeletonAssetTag >, nau::AssetRef< assets::MaterialAssetTag >, nau::AssetRef< assets::SkinnedMeshAssetTag >, nau::AssetRef< assets::StaticMeshAssetTag >, nau::AssetRef< assets::TextureAssetTag >, nau::AssetRef< assets::UiSceneAssetTag >, nau::AssetRef< T >

Public Functions

virtual ~AssetRefBase()

Destructor.

explicit operator bool() const

Checks whether.

Returns:

template<std::derived_from<IAssetView> ViewType>
async::Task<nau::Ptr<ViewType>> getAssetViewTyped()

Schedules asset view retrieval.

Template Parameters:

ViewType – Type of the asset view to retrieve. It has to be a subclass of IAssetView.

Returns:

Task object that provides operation status info as well as access to the retrieved view.

template<std::derived_from<IAssetView> ViewType>
async::Task<ReloadableAssetView::Ptr> getReloadableAssetViewTyped()
inline virtual bool isAssignable(const AssetRefBase&) const

Checks whether an asset reference can be bound to a different asset.

Parameters:

assetRef[in] Reference to an asset to bind.

Returns:

true if assignment is possible, false otherwise.

AssetRefBase() noexcept = default

Default constructor.

AssetRefBase(AssetPath assetPath, bool loadOnDemand = false) noexcept

Initialization constructor.

Parameters:

Path[in] to the asset to bind.

AssetRefBase(eastl::string_view assetPathStr, bool loadOnDemand = false) noexcept
AssetRefBase(IAssetDescriptor::Ptr) noexcept

Initialization constructor.

Parameters:

Description[in] of the asset to bind.

AssetRefBase(const AssetRefBase&) noexcept

Copy constructor.

Parameters:

assetRef[in] Reference to the asset to bind.

AssetRefBase(AssetRefBase&&) noexcept

Move constructor.

Parameters:

assetRef[in] Reference to the asset to bind.

AssetRefBase &operator=(const AssetRefBase&) noexcept

Assignment operator.

Parameters:

assetRef[in] Reference to the asset to bind.

Returns:

Resulted reference object.

AssetRefBase &operator=(AssetRefBase&&) noexcept

Move-assignment operator.

Parameters:

assetRef[in] Reference to the asset to bind.

Returns:

Resulted reference object.

AssetRefBase &operator=(std::nullptr_t) noexcept

Protected Attributes

IAssetDescriptor::Ptr m_assetDescriptor

Private Functions

async::Task<IAssetView::Ptr> getAssetView(const AssetViewDescription& = {})

Schedules asset view retrieval.

Parameters:

viewDescription[in] Encapsulates asset information.

Returns:

Task object that provides operation status info as well as access to the retrieved view.

async::Task<ReloadableAssetView::Ptr> getReloadableAssetView(const AssetViewDescription = {})

Friends

friend Result parse(std::string_view assetPath, AssetRefBase &assetRef)
friend std::string toString(const AssetRefBase &assetRef)

AssetRef

engine/core/modules/assets/include/nau/assets/asset_ref.h

template<typename T = assets::GenericAssetTag>
class AssetRef : public nau::AssetRefBase

Encapsulates a reference to an asset.

Template Parameters:

T – Type of the asset the reference is bound to.

Public Functions

AssetRef(const AssetRef<T>&) noexcept

Copy constructor.

Parameters:

other[in] Reference to the asset to bind.

AssetRef(AssetRef<T>&&) noexcept

Move constructor.

Parameters:

other[in] Reference to the asset to bind.

AssetRef &operator=(std::nullptr_t) noexcept
AssetRef &operator=(const AssetRef&) noexcept

Assignment operator.

Parameters:

assetRef[in] Reference to the asset to bind.

Returns:

Resulted reference object.

AssetRef &operator=(AssetRef&&) noexcept

Move-assignment operator.

Parameters:

assetRef[in] Reference to the asset to bind.

Returns:

Resulted reference object.

AssetRef &operator=(const AssetRefBase&) noexcept

Assignment operator.

Parameters:

assetRef[in] Reference to the asset to bind.

Returns:

Resulted reference object.

AssetRef &operator=(AssetRefBase&&) noexcept

Move-assignment operator.

Parameters:

assetRef[in] Reference to the asset to bind.

Returns:

Resulted reference object.

inline bool operator==(const AssetRef &other) noexcept
inline virtual bool isAssignable(const AssetRefBase&) const override

Checks whether an asset reference can be bound to a different asset.

Parameters:

assetRef[in] Reference to an asset to bind.

Returns:

true if assignment is possible, false otherwise.

AssetRefBase() noexcept = default

Default constructor.

AssetRefBase(AssetPath assetPath, bool loadOnDemand = false) noexcept

Initialization constructor.

Parameters:

Path[in] to the asset to bind.

AssetRefBase(eastl::string_view assetPathStr, bool loadOnDemand = false) noexcept
AssetRefBase(IAssetDescriptor::Ptr) noexcept

Initialization constructor.

Parameters:

Description[in] of the asset to bind.

AssetRefBase(const AssetRefBase&) noexcept

Copy constructor.

Parameters:

assetRef[in] Reference to the asset to bind.

AssetRefBase(AssetRefBase&&) noexcept

Move constructor.

Parameters:

assetRef[in] Reference to the asset to bind.

Public Static Attributes

static constexpr bool HasOwnRuntimeValue = true

ser_detail::RuntimeAssetRefValueImpl

engine/core/modules/assets/include/nau/assets/asset_ref.h

template<typename T>
class RuntimeAssetRefValueImpl : public NativePrimitiveRuntimeValueBase<RuntimeAssetRefValue>, public virtual RuntimeStringValue

Public Functions

inline RuntimeAssetRefValueImpl(T assetRef)
inline RuntimeAssetRefValueImpl(ValueType &&assetRef)
inline RuntimeAssetRefValueImpl(const ValueType &assetRef)
inline bool isMutable() const override
inline bool isAssignable(const AssetRefBase &assetRef) override
inline bool setAssetRef(AssetRefBase assetRef) override
inline AssetRefBase getAssetRef() const override
inline Result setString(std::string_view str) override
inline std::string getString() const override

Private Types

using Base = NativePrimitiveRuntimeValueBase<RuntimeAssetRefValue>
using ValueType = std::decay_t<T>

Private Members

T m_assetRef

Private Static Attributes

static constexpr bool IsMutable = !std::is_const_v<std::remove_reference_t<T>>
static constexpr bool IsReference = std::is_lvalue_reference_v<T>