#include <AssetCommon.h>
Inherited by AZ::ScriptAsset, and AZ::SliceAsset.
Public Types | |
enum class | AssetStatus : int { NotLoaded , Queued , StreamReady , Loading , LoadedPreReady , ReadyPreNotify , Ready , Error } |
Public Member Functions | |
AZ_CLASS_ALLOCATOR (AssetData, SystemAllocator) | |
AZ_RTTI (AssetData, "{AF3F7D32-1536-422A-89F3-A11E1F5B5A9C}") | |
AssetData (const AssetId &assetId=AssetId(), AssetStatus status=AssetStatus::NotLoaded) | |
void | Acquire () |
void | Release () |
void | AcquireWeak () |
void | ReleaseWeak () |
bool | IsReady () const |
bool | IsError () const |
bool | IsLoading (bool includeQueued=true) const |
AssetStatus | GetStatus () const |
const AssetId & | GetId () const |
AssetType | GetType () const |
int | GetUseCount () const |
int | GetCreationToken () const |
Static Public Member Functions | |
static void | Reflect (ReflectContext *context) |
Protected Types | |
enum class | AssetDataFlags : AZ::u32 { Requeue = 0 } |
Protected Member Functions | |
virtual bool | IsRegisterReadonlyAndShareable () |
virtual bool | HandleAutoReload () |
bool | GetFlag (const AssetDataFlags &checkFlag) const |
void | SetFlag (const AssetDataFlags &checkFlag, bool setValue) |
bool | GetRequeue () const |
void | SetRequeue (bool requeue) |
void | RegisterWithHandler (AssetHandler *assetHandler) |
void | UnregisterWithHandler () |
AssetData (const AssetData &)=delete | |
Protected Attributes | |
AZStd::atomic_int | m_useCount { 0 } |
AZStd::atomic_int | m_weakUseCount { 0 } |
AZStd::atomic< AssetStatus > | m_status |
AssetId | m_assetId |
AssetHandler * | m_registeredHandler { nullptr } |
int | m_creationToken = s_defaultCreationToken |
AZStd::bitset< 32 > | m_flags |
Friends | |
template<class T > | |
class | Asset |
class | AssetManager |
class | AssetHandler |
Base class for all asset types.
|
strong |
Enumerator | |
---|---|
NotLoaded | Asset has not been loaded, and is not in the process of loading. |
Queued | Asset has a job created for loading it which has not begun processing. |
StreamReady | Asset Stream loader has finished, ready for Job to begin loading. |
Loading | Asset is currently in the process of loading. |
LoadedPreReady | Asset data and preload dependencies are loaded. Handler init is about to be called and onassetready will be signaled. |
ReadyPreNotify | Asset is loaded and ready for use. AssetBus hasn't yet dispatched the OnAssetReady event on the main thread. |
Ready | Asset is loaded and ready for use. |
Error | Asset attempted to load, but it or a strict dependency failed. |
|
inlineprotectedvirtual |
Override this function to control automatic reload behavior. By default, the asset will reload automatically. Return false to disable automatic reload. Potential use cases include: 1, If an asset is dependent on a parent asset(i.e.both assets need to be reloaded as a group) the parent asset can explicitly reload the child. 2, The asset does not support reload. Note: Disabling an auto reload means that the asset in memory will be stale compared to what triggered the reload This moves the responsibility of loading the asset or editing/handling the stale asset onto the system that disabled the reload
Reimplemented in AZ::SliceAsset.
|
inline |
|
inline |
Asset is loaded and ready for use. Note that the asset may be ready for use before the OnAssetReady event has been dispatched by the AssetBus on the main thread.
|
inlineprotectedvirtual |
Override this function do create a new Asset Instance for each AssetDatababse::GetAsset(), Most assets should be read only and shared (thus registered in the database), make sure you understand the consequences of changing behavior. When this function returns false, this asset will NOT be added to the loaded assets map (which is why when we call AssetDatabase::GetAsset it will not be found a new will be create)