#include <assets.h>
An AssetLink is a symbolic link to an asset identified by its id and version. The asset's origin data can also be included in the link to allow tracking and debugging of missing assets. Also an ASSET_UPDATE_POLICY is stored to control the behavior of the link when newer versions of the linked asset exists.
Alternatively an AssetLink can also just wrap a Url from which an asset can be loaded directly.
Public Member Functions | |
MAXON_ATTRIBUTE_CLASS (String, NAME, "net.maxon.assetlink.origin.name") | |
MAXON_ATTRIBUTE_CLASS (decltype(maxon::ASSETMETADATA::ASSET_VERSIONTAG)::ValueType, VERSIONTAG, "net.maxon.assetlink.origin.versiontag") | |
MAXON_ATTRIBUTE_CLASS (Id, Category, "net.maxon.assetlink.origin.category") | |
MAXON_ATTRIBUTE_CLASS (String, REPOSITORYNAME, "net.maxon.assetlink.origin.reponame") | |
MAXON_ATTRIBUTE_CLASS (Id, REPOSITORYID, "net.maxon.assetlink.origin.repoid") | |
MAXON_ATTRIBUTE_CLASS (Data, INSTANCEDATA, "net.maxon.assetlink.origin.instancedata") | |
MAXON_METHOD const Url & | GetUrl () const |
MAXON_METHOD Result< AssetDescription > | Resolve (const AssetRepositoryRef &context) const |
MAXON_METHOD ASSET_UPDATE_POLICY | GetUpdatePolicy () const |
MAXON_METHOD void | SetUpdatePolicy (ASSET_UPDATE_POLICY up) |
MAXON_METHOD Result< void > | SetUrl (const Url &url) |
MAXON_METHOD Result< void > | SetIdAndVersion (const IdAndVersion &aid) |
MAXON_METHOD Result< DataDictionary > | GetOriginData () const |
MAXON_METHOD Result< void > | SetOriginData (const DataDictionary &originData) |
Static Public Member Functions | |
static MAXON_METHOD Result< AssetLink > | Create (const AssetDescription &asset, ASSET_UPDATE_POLICY up) |
static MAXON_METHOD Result< AssetLink > | Create (const Id &type, const IdAndVersion &aid, ASSET_UPDATE_POLICY up) |
static MAXON_METHOD Result< AssetLink > | Create (const Id &type, const Url &url) |
Static Public Attributes | |
static constexpr ASSET_UPDATE_POLICY | DEFAULT_LINK_POLICY |
Private Member Functions | |
MAXON_INTERFACE (AssetLinkInterface, MAXON_REFERENCE_COPY_ON_WRITE, "net.maxon.interface.assetlink", MAXON_IMPLEMENTATION_MODULE("net.maxon.asset")) | |
Private Attributes | |
MAXON_INTERFACE_SINGLE_IMPLEMENTATION | |
|
private |
MAXON_ATTRIBUTE_CLASS | ( | String | , |
NAME | , | ||
"net.maxon.assetlink.origin.name" | |||
) |
Original name of the asset (default language). Won't prevent resolving links if an asset was renamed.
MAXON_ATTRIBUTE_CLASS | ( | decltype(maxon::ASSETMETADATA::ASSET_VERSIONTAG)::ValueType | , |
VERSIONTAG | , | ||
"net.maxon.assetlink.origin.versiontag" | |||
) |
Original ASSETMETADATA::ASSET_VERSIONTAG (default language).
MAXON_ATTRIBUTE_CLASS | ( | Id | , |
Category | , | ||
"net.maxon.assetlink.origin.category" | |||
) |
Original category of the asset. Won't prevent resolving links if an asset was changed to a new category.
MAXON_ATTRIBUTE_CLASS | ( | String | , |
REPOSITORYNAME | , | ||
"net.maxon.assetlink.origin.reponame" | |||
) |
Original repository name of the asset. Won't prevent resolving links if an asset was moved to a different repository, this is just to help handling missing assets.
MAXON_ATTRIBUTE_CLASS | ( | Id | , |
REPOSITORYID | , | ||
"net.maxon.assetlink.origin.repoid" | |||
) |
Original repository identifier of the asset. Won't prevent resolving links if an asset was moved to a different repository, this is just to help handling missing assets.
MAXON_ATTRIBUTE_CLASS | ( | Data | , |
INSTANCEDATA | , | ||
"net.maxon.assetlink.origin.instancedata" | |||
) |
Asset instance data. Content varies per asset type. All the data required to reinstate a broken asset link should be included. I.e. any additional data needed to fix a scene that was saved with missing assets.
|
static |
Creates a new link to the given asset with requested update policy.
[in] | asset | The asset to link to. Asset type, identifier and version will be read from it to create the link. |
[in] | up | The update policy which the created link shall use. |
|
static |
Creates a new link to the given asset with requested update policy.
[in] | type | The expected type of the asset. |
[in] | aid | Identifier and version of the asset. |
[in] | up | The update policy which the created link shall use. |
|
static |
Creates a new link for the given Url. This is for assets which aren't stored in a repository, but shall be read directly from a Url such as a local image file. Url links use policy ASSET_UPDATE_POLICY::NEVER.
[in] | type | The expected type of the asset. |
[in] | url | The Url where the asset can be read from. |
MAXON_METHOD const Url& GetUrl | ( | ) | const |
MAXON_METHOD Result<AssetDescription> Resolve | ( | const AssetRepositoryRef & | context | ) | const |
Resolves this AssetLink to an AssetDescription in the given context. The asset identifier of this link is used to find the asset in context, and if this link uses the policy ASSET_UPDATE_POLICY::IMPLICIT the latest version of the asset is used, otherwise the version recorded in this link.
[in] | context | The repository to use for the asset lookup. |
MAXON_METHOD ASSET_UPDATE_POLICY GetUpdatePolicy | ( | ) | const |
Returns the update policy which this link uses.
MAXON_METHOD void SetUpdatePolicy | ( | ASSET_UPDATE_POLICY | up | ) |
Sets the update policy for this link.
[in] | up | The new update policy for this link. |
MAXON_METHOD Result<void> SetUrl | ( | const Url & | url | ) |
MAXON_METHOD Result<void> SetIdAndVersion | ( | const IdAndVersion & | aid | ) |
Sets the asset link's identifier. This will clear the Url. One might want to update the asset link's update policy afterwards.
[in] | aid | The asset identifier and version. |
MAXON_METHOD Result<DataDictionary> GetOriginData | ( | ) | const |
Gets the asset link's origin informations.
MAXON_METHOD Result<void> SetOriginData | ( | const DataDictionary & | originData | ) |
Sets the asset link's origin data informations.
[in] | originData | The new origin informations (will overwrite existing). |
|
private |
|
staticconstexpr |
Default update policy used in AssetLink.