#include <AssetCommon.h>
Public Member Functions | |
| Asset (AssetLoadBehavior loadBehavior=AssetLoadBehavior::Default) | |
| Asset (AssetData *assetData, AssetLoadBehavior loadBehavior) | |
| Create an asset from a valid asset data (created asset), might not be loaded or currently loading. | |
| Asset (const AZ::Data::AssetId &id, AssetData *assetData, AssetLoadBehavior loadBehavior) | |
| Create an asset from a valid asset data (created asset) and set the asset id for both, might not be loaded or currently loading. | |
| Asset (const AZ::Data::AssetId &id, const AZ::Data::AssetType &type, const AZStd::string &hint=AZStd::string()) | |
| Initialize asset pointer with id, type, and hint. No data construction will occur until QueueLoad is called. | |
| Asset (const Asset &rhs) | |
| template<typename U > | |
| Asset (const Asset< U > &rhs) | |
| Asset (Asset &&rhs) | |
| Asset & | operator= (Asset &&rhs) |
| Asset & | operator= (const Asset &rhs) |
| operator bool () const | |
| T & | operator* () const |
| T * | operator-> () const |
| bool | IsReady () const |
| Is the asset data ready (loaded)? | |
| bool | IsError () const |
| Did an error occur when loading the asset? | |
| bool | IsLoading () const |
| Is the asset currently loading? | |
| AssetData::AssetStatus | GetStatus () const |
| What is the current load status of the asset? | |
| const AssetId & | GetId () const |
| Retrieve the Id of the referenced asset. | |
| const AssetType & | GetType () const |
| Retrieve the type of the referenced asset (if available). | |
| const AZStd::string & | GetHint () const |
| Retrieve the last known path to the asset Id this ref is bound to. | |
| void | SetHint (const AZStd::string &newHint) |
| AssetData * | GetData () const |
| Returns asset data - base class. | |
| T * | Get () const |
| Returns pointer to the asset type, or null if asset is not loaded. | |
| template<class U > | |
| U * | GetAs () const |
| Return asset data as T type, uses azrtti for the cast. | |
| bool | Create (const AssetId &id, bool queueLoad=false) |
| bool | Create (const AssetId &id, AssetLoadBehavior loadBehavior, bool queueLoad=false) |
| bool | QueueLoad (const AssetLoadParameters &loadParams={}) |
| AssetData::AssetStatus | BlockUntilLoadComplete () |
| bool | Reset () |
| bool | Release () |
| bool | Reload () |
| bool | Save () |
| void | SetAutoLoadBehavior (AssetLoadBehavior loadBehavior) |
| AssetLoadBehavior | GetAutoLoadBehavior () const |
| u8 | GetFlags () const |
| bool | SetFlags (u8 flags) |
| void | UpgradeAssetInfo () |
| template<class StringType > | |
| StringType | ToString () const |
| template<class StringType > | |
| void | ToString (StringType &result) const |
Protected Member Functions | |
| void | SetData (AssetData *assetData) |
| void | swap (Asset &rhs) |
Protected Attributes | |
| AssetId | m_assetId |
| Id of asset the pointer currently references. QueueLoad will acquire/load the actual asset. | |
| AssetType | m_assetType |
| Referenced asset type. | |
| AssetData * | m_assetData = nullptr |
| Pointer to the asset data, it's always present when we have bound an asset (it doesn't have to be loaded) | |
| AssetLoadBehavior | m_loadBehavior |
| Load behavior for the asset reference. | |
| AZStd::string | m_assetHint |
| Last known path to the asset m_assetId refers to. | |
Friends | |
| class | AssetManager |
| class | AZ::AssetSerializer |
| class | AZ::AssetEventHandler |
Asset is a smart pointer to an actual asset. Asset users should always refer to assets using this object.
| AZ::Data::Asset< T >::Asset | ( | AssetLoadBehavior | loadBehavior = AssetLoadBehavior::Default | ) |
Create asset with default params (no asset bounded) By default, referenced assets will be queued for load during serialization. Use AssetLoadBehavior to control this behavior.
Asset<T>
| bool AZ::Data::Asset< T >::Create | ( | const AssetId & | id, |
| AssetLoadBehavior | loadBehavior, | ||
| bool | queueLoad = false |
||
| ) |
Create an asset with an ID and loadBehavior (type is inferred). If there is a current asset it will be released.
| id | AssetId |
| loadBehavior | AssetLoadBehavior |
| queueLoad | if true it will call "QueueLoad" to load the asset data. |
Create an asset with an ID (type is inferred). If there is a current asset it will be released.
| id | AssetId |
| queueLoad | if true it will call "QueueLoad" to load the asset data. |
| AssetLoadBehavior AZ::Data::Asset< T >::GetAutoLoadBehavior | ( | ) | const |
| u8 AZ::Data::Asset< T >::GetFlags | ( | ) | const |
Returns asset instance flags Deprecated - use GetAutoLoadBehavior
| bool AZ::Data::Asset< T >::QueueLoad | ( | const AssetLoadParameters & | loadParams = {} | ) |
If the asset is not loaded and has a valid id, it will be queued for load.
| bool AZ::Data::Asset< T >::Release | ( | ) |
Releases reference on asset data, if one is held. The asset ID, hint, etc are all still preserved.
| bool AZ::Data::Asset< T >::Reload | ( | ) |
Reloads an asset if an asset is create.
| bool AZ::Data::Asset< T >::Reset | ( | ) |
Fully resets the Asset to a clean initialized state. The asset data is released, the asset ID is reset, the hint is cleared, etc.
| bool AZ::Data::Asset< T >::Save | ( | ) |
Save asset, triggers a SaveAsset of possible AssetDatabase::SaveAsset.
| void AZ::Data::Asset< T >::SetAutoLoadBehavior | ( | AssetLoadBehavior | loadBehavior | ) |
Sets the auto load behavior for the asset reference.
ref AssetLoadBehavior
| bool AZ::Data::Asset< T >::SetFlags | ( | u8 | flags | ) |
You can change the flags only when we don't have an asset bound (ie. GetData() == null) Deprecated - use SetAutoLoadBehavior
|
inline |
for debugging purposes - creates a string that represents the assets id, subid, hint, and name. You should use this function for any time you want to show the full details of an asset in a log message as it will always produce a consistent output string. By convention, don't surround the output of this call with any kind of decorator, (for example, don't format like [s]) because decorators are built-in.
|
inline |
for debugging purposes only - updates a string that represents the asset's id, subid, hint and name. see comment details on StringType ToString() above.
| void AZ::Data::Asset< T >::UpgradeAssetInfo | ( | ) |
Upgrades legacy Ids/hints with the new canonical Ids/hints. This will search for the assetId and hint in the catalog and if found, will update it to be the new, canonical one(s)