Class AssetSystem

Inheritance Relationships

Base Type

Class Documentation

class AssetSystem : public csp::systems::SystemBase

Public facing system that allows uploading/downloading and creation of assets.

Public Types

typedef std::function<void(const csp::multiplayer::AssetDetailBlobParams&)> AssetDetailBlobChangedCallbackHandler
typedef std::function<void(const csp::multiplayer::MaterialChangedParams&)> MaterialChangedCallbackHandler

Public Functions

void CreateAssetCollection(const csp::common::Optional<csp::common::String> &SpaceId, const csp::common::Optional<csp::common::String> &ParentAssetCollectionId, const csp::common::String &AssetCollectionName, const csp::common::Optional<csp::common::Map<csp::common::String, csp::common::String>> &Metadata, const EAssetCollectionType Type, const csp::common::Optional<csp::common::Array<csp::common::String>> &Tags, AssetCollectionResultCallback Callback)

Creates an asset collection.

Parameters
void DeleteAssetCollection(const AssetCollection &AssetCollection, NullResultCallback Callback)

Deletes a given asset collection.

Parameters
  • AssetCollection – AssectCollection : asset collection to delete

  • CallbackNullResultCallback : callback when asynchronous task finishes

void CopyAssetCollectionsToSpace(csp::common::Array<AssetCollection> &SourceAssetCollections, const csp::common::String &DestSpaceId, bool CopyAsync, AssetCollectionsResultCallback Callback)

Copies an array of asset collections to another space.

Note that all source asset collections must belong to the same space.

Parameters
void GetAssetCollectionById(const csp::common::String &AssetCollectionId, AssetCollectionResultCallback Callback)

Finds an asset collection by its Id.

Parameters
void GetAssetCollectionByName(const csp::common::String &AssetCollectionName, AssetCollectionResultCallback Callback)

Finds an asset collection by its Name.

Parameters
void FindAssetCollections(const csp::common::Optional<csp::common::Array<csp::common::String>> &Ids, const csp::common::Optional<csp::common::String> &ParentId, const csp::common::Optional<csp::common::Array<csp::common::String>> &Names, const csp::common::Optional<csp::common::Array<EAssetCollectionType>> &Types, const csp::common::Optional<csp::common::Array<csp::common::String>> &Tags, const csp::common::Optional<csp::common::Array<csp::common::String>> &SpaceIds, const csp::common::Optional<int> &ResultsSkipNumber, const csp::common::Optional<int> &ResultsMaxNumber, AssetCollectionsResultCallback Callback)

Retrieves asset collections based on the specified search criteria.

Results pagination is supported through the use of ResultsSkipNumber and ResultsMaxNumber.

Parameters
  • SpaceSpace : optional space to get asset collections associated with it

  • AssetCollectionParentIdcsp::common::String : optional asset collection parent id to get asset collections associated with it

  • AssetCollectionTypeEAssetCollectionType : type of the asset collection

  • AssetCollectionTagscsp::common::Array<csp::common::String> : optional array of strings representing asset collection tags

  • AssetCollectionNamescsp::common::Optional<csp::common::Array<csp::common::String>> : optional array of strings representing asset collection names

  • ResultsSkipNumber – int : optional param representing the number of result entries that will be skipped from the result. For no skip pass nullptr.

  • ResultsMaxNumber – int : optional param representing the maximum number of result entries to be retrieved. For all available result entries pass nullptr.

  • CallbackAssetCollectionsResultCallback : callback when asynchronous task finishes

void UpdateAssetCollectionMetadata(const AssetCollection &AssetCollection, const csp::common::Map<csp::common::String, csp::common::String> &NewMetadata, const csp::common::Optional<csp::common::Array<csp::common::String>> &Tags, AssetCollectionResultCallback Callback)

Updates the Metadata field of an Asset Collection.

Parameters
void CreateAsset(const AssetCollection &AssetCollection, const csp::common::String &Name, const csp::common::Optional<csp::common::String> &ThirdPartyPackagedAssetIdentifier, const csp::common::Optional<csp::systems::EThirdPartyPlatform> &ThirdPartyPlatform, EAssetType Type, AssetResultCallback Callback)

Creates a new asset.

Parameters
void UpdateAsset(const Asset &Asset, AssetResultCallback Callback)

Update a given asset.

Parameters
void DeleteAsset(const AssetCollection &AssetCollection, const Asset &Asset, NullResultCallback Callback)

Deletes a given asset.

Parameters
  • AssetCollectionAssetCollection : the parent collection that the asset is associated with

  • AssetAsset : asset to delete

  • CallbackNullResultCallback : callback when asynchronous task finishes

void GetAssetsInCollection(const AssetCollection &AssetCollection, AssetsResultCallback Callback)

Retrieves all assets in a given asset collection.

Parameters
void GetAssetById(const csp::common::String &AssetCollectionId, const csp::common::String &AssetId, AssetResultCallback Callback)

Retrieves the asset specified by the Id.

Parameters
void GetAssetsByCollectionIds(const csp::common::Array<csp::common::String> &AssetCollectionIds, AssetsResultCallback Callback)

Retrieves all assets that belong to the asset collections with the give Ids.

Parameters
void GetAssetsByCriteria(const csp::common::Array<csp::common::String> &AssetCollectionIds, const csp::common::Optional<csp::common::Array<csp::common::String>> &AssetIds, const csp::common::Optional<csp::common::Array<csp::common::String>> &AssetNames, const csp::common::Optional<csp::common::Array<EAssetType>> &AssetTypes, AssetsResultCallback Callback)

Retrieves assets based on the specified search criteria.

Parameters
void UploadAssetData(const AssetCollection &AssetCollection, const Asset &Asset, const AssetDataSource &AssetDataSource, UriResultCallback Callback)

Uploads data for the given asset to CHS from the given source.

Parameters
void UploadAssetDataEx(const AssetCollection &AssetCollection, const Asset &Asset, const AssetDataSource &AssetDataSource, csp::common::CancellationToken &CancellationToken, UriResultCallback Callback)

Uploads data for the given asset to CHS from the given source, taking a CancellationToken to allow cancelling the request.

Parameters
void DownloadAssetData(const Asset &Asset, AssetDataResultCallback Callback)

Downloads data for a given Asset from CHS.

Parameters
  • AssetAsset : asset to download data for

  • Callback – DataResultCallback : callback when asynchronous task finishes

void DownloadAssetDataEx(const Asset &Asset, csp::common::CancellationToken &CancellationToken, AssetDataResultCallback Callback)

Downloads data for a given Asset from CHS, taking a CancellationToken to allow cancelling the request.

Parameters
void GetAssetDataSize(const Asset &Asset, UInt64ResultCallback Callback)

Get the size of the data associated with an Asset.

Parameters
void GetLODChain(const AssetCollection &AssetCollection, LODChainResultCallback Callback)

Gets a LOD chain within the given AssetCollection.

Parameters
void RegisterAssetToLODChain(const AssetCollection &AssetCollection, const Asset &Asset, int LODLevel, AssetResultCallback Callback)

Registers an asset to the LOD chain.

Parameters
void CreateMaterial(const csp::common::String &Name, const csp::systems::EShaderType ShaderType, const csp::common::String &SpaceId, csp::common::Map<csp::common::String, csp::common::String> &Metadata, const csp::common::Array<csp::common::String> &AssetTags, MaterialResultCallback Callback)

Creates a new material backed by an AssetCollection/Asset.

Parameters
void UpdateMaterial(const Material &Material, NullResultCallback Callback)

Updates an existing material’s properties.

The material should be retrieved through GetMaterials or GetMaterial. If the material doesn’t exist, EResultCode::Failed will be returned. If the material hasn’t changed, EResultCode::Success will still be returned.

Parameters
  • Material – const Material& : The material to update

  • CallbackNullResultCallback : Callback when asynchronous task finishes.

void DeleteMaterial(const Material &Material, NullResultCallback Callback)

Deletes a given material.

The material should be retrieved through GetMaterials or GetMaterial.

Parameters
  • Material – const Material& : The material to delete

  • CallbackNullResultCallback : Callback when asynchronous task finishes.

void GetMaterials(const csp::common::String &SpaceId, MaterialsResultCallback Callback)

Gets all materials associated with the given space.

Parameters
void GetMaterial(const csp::common::String &AssetCollectionId, const csp::common::String &AssetId, MaterialResultCallback Callback)

Gets a material using its AssetCollection and Asset Id.

Parameters
void SetAssetDetailBlobChangedCallback(AssetDetailBlobChangedCallbackHandler Callback)

Sets a callback for an asset changed event.

Triggered when assets, such as textures or meshes, are modified

Parameters

CallbackAssetDetailBlobChangedCallbackHandler: Callback to receive data for the asset that has been changed.

void SetMaterialChangedCallback(MaterialChangedCallbackHandler Callback)

Sets a callback for a material changed event.

Parameters

CallbackMaterialChangedCallbackHandler: Callback to receive data for the material that has been changed.

virtual void RegisterSystemCallback() override

Registers the system to listen for the named event.

virtual void DeregisterSystemCallback() override

Deregisters the system from listening for the named event.

virtual void OnEvent(const std::vector<signalr::value> &EventValues) override

Deserialises the event values of the system.

Parameters

EventValues – std::vector<signalr::value> : event values to deserialise