Class AssetSystem
Defined in File AssetSystem.h
Inheritance Relationships
Base Type
public csp::systems::SystemBase
(Class SystemBase)
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
Space – Space : optional space to associate the asset collection with
ParentAssetCollectionId – csp::common::String : optional parent asset collection Id
AssetCollectionName – csp::common::String : name of the asset collection
Metadata – csp::common::StringMap : optional metadata info to be associated with the asset collection
Type – EAssetCollectionType : type of the new asset collection
Tags – csp::common::Array<csp::common::String> : optional array of strings to add to the asset collection as tags
Callback – AssetCollectionResultCallback : callback when asynchronous task finishes
-
void DeleteAssetCollection(const AssetCollection &AssetCollection, NullResultCallback Callback)
Deletes a given asset collection.
- Parameters
AssetCollection – AssectCollection : asset collection to delete
Callback – NullResultCallback : 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
SourceAssetCollections – csp::common::Array<AssetCollection> : The array of asset collections to copy. They must all belong to the same space.
DestSpaceId – const csp::common::String : The unique identifier of the space to copy these asset collections to.
CopyAsync – const csp::common::Optional<bool> : Whether to instruct the services to perform the copy of the asset collections asynchronously.
Callback – NullResultCallback : callback when asynchronous task finishes
-
void GetAssetCollectionById(const csp::common::String &AssetCollectionId, AssetCollectionResultCallback Callback)
Finds an asset collection by its Id.
- Parameters
AssetCollectionId – csp::common::String : asset collection to delete
Callback – AssetCollectionResultCallback : callback when asynchronous task finishes
-
void GetAssetCollectionByName(const csp::common::String &AssetCollectionName, AssetCollectionResultCallback Callback)
Finds an asset collection by its Name.
- Parameters
AssetCollectionName – csp::common::String : name of the asset collection to be retrieved
Callback – AssetCollectionResultCallback : callback when asynchronous task finishes
-
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
Space – Space : optional space to get asset collections associated with it
AssetCollectionParentId – csp::common::String : optional asset collection parent id to get asset collections associated with it
AssetCollectionType – EAssetCollectionType : type of the asset collection
AssetCollectionTags – csp::common::Array<csp::common::String> : optional array of strings representing asset collection tags
AssetCollectionNames – csp::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.
Callback – AssetCollectionsResultCallback : 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
AssetCollection – AssetCollection : asset collection to be updated
NewMetadata – csp::common::StringMap : the new metadata information that will replace the previous
Tags – csp::common::Array<csp::common::String : optional array of strings to replace the tags
Callback – AssetCollectionResultCallback : callback when asynchronous task finishes
-
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
AssetCollection – AssetCollection : the parent collection for the asset to be associated with
Name – csp::common::String : name of the asset collection
ThirdPartyPackagedAssetIdentifier – csp::common::String : optional id to a third party packaged asset identifier
ThirdPartyPlatform – EThirdPartyPlatform : optional enum class for Third Part Platform
Type – csp::systems::EAssetType : type of the asset
Callback – AssetResultCallback : callback when asynchronous task finishes
-
void UpdateAsset(const Asset &Asset, AssetResultCallback Callback)
Update a given asset.
- Parameters
Asset – Asset : asset to update
Callback – AssetResultCallback : callback when asynchronous task finishes
-
void DeleteAsset(const AssetCollection &AssetCollection, const Asset &Asset, NullResultCallback Callback)
Deletes a given asset.
- Parameters
AssetCollection – AssetCollection : the parent collection that the asset is associated with
Asset – Asset : asset to delete
Callback – NullResultCallback : callback when asynchronous task finishes
-
void GetAssetsInCollection(const AssetCollection &AssetCollection, AssetsResultCallback Callback)
Retrieves all assets in a given asset collection.
- Parameters
AssetCollection – AssetCollection : collection to get all assets from
Callback – AssetsResultCallback : callback when asynchronous task finishes
-
void GetAssetById(const csp::common::String &AssetCollectionId, const csp::common::String &AssetId, AssetResultCallback Callback)
Retrieves the asset specified by the Id.
- Parameters
AssetCollectionId – csp::common::String : the Id of the asset collection containing the asset
AssetId – csp::common::String : the Id of the asset to retrieve
Callback – AssetResultCallback : callback when asynchronous task finishes
-
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
AssetCollectionIds – csp::common::Array<csp::common::String> : collection of asset collection Ids get all assets from
Callback – AssetsResultCallback : callback when asynchronous task finishes
-
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
AssetCollectionIds – csp::common::Array<csp::common::String> : the asset collection Ids that will be used as search criteria. Note that you have to pass at least one Id.
AssetIds – csp::common::Array<csp::common::String> : optional array of strings representing asset ids
AssetNames – csp::common::Array<csp::common::String> : optional array of strings representing asset names
AssetTypes – csp::common::Array<EAssetType> : optional array of asset types
Callback – AssetsResultCallback : callback when asynchronous task finishes
-
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
AssetCollection – AssetCollection : collection the asset is associated to
Asset – Asset : asset to upload data for
AssetDataSource – AssetDataSource : asset data to upload AssetDataSource is an interface. A derived class must be passed.
Callback – UriResultCallback : callback when asynchronous task finishes
-
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
AssetCollection – AssetCollection : collection the asset is associated to
Asset – Asset : asset to upload data for
AssetDataSource – AssetDataSource : asset data to upload AssetDataSource is an interface. A derived class must be passed.
CancellationToken – csp::common::CancellationToken : token for cancelling upload
Callback – UriResultCallback : callback when asynchronous task finishes
-
void DownloadAssetData(const Asset &Asset, AssetDataResultCallback Callback)
Downloads data for a given Asset from CHS.
- Parameters
Asset – Asset : 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
Asset – Asset : asset to download data for
CancellationToken – csp::common::CancellationToken : token for cancelling download
Callback – AssetDataResultCallback : callback when asynchronous task finishes
-
void GetAssetDataSize(const Asset &Asset, UInt64ResultCallback Callback)
Get the size of the data associated with an Asset.
- Parameters
Asset – Asset : asset to get data size for
Callback – UInt64ResultCallback : callback when asynchronous task finishes
-
void GetLODChain(const AssetCollection &AssetCollection, LODChainResultCallback Callback)
Gets a LOD chain within the given AssetCollection.
- Parameters
AssetCollection – AssetCollection : AssetCollection which contains the LOD chain.
Callback – LODChainResultCallback : callback when asynchronous task finishes
-
void RegisterAssetToLODChain(const AssetCollection &AssetCollection, const Asset &Asset, int LODLevel, AssetResultCallback Callback)
Registers an asset to the LOD chain.
- Parameters
AssetCollection – AssetCollection : AssetCollection which contains the LOD chain.
Asset – int : LOD level for Asset to be registered to
Callback – AssetResultCallback : callback when asynchronous task finishes
-
void CreateMaterial(const csp::common::String &Name, const csp::common::String &SpaceId, GLTFMaterialResultCallback Callback)
Creates a new material backed by an AssetCollection/Asset.
- Parameters
Name – const csp::common::String& : The name of the new material.
SpaceId – const csp::common::String& : The space id this material is associated with.
Callback – GLTFMaterialResultCallback : Callback when asynchronous task finishes.
-
void UpdateMaterial(const GLTFMaterial &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 GLTFMaterial& : The material to update
Callback – NullResultCallback : Callback when asynchronous task finishes.
-
void DeleteMaterial(const GLTFMaterial &Material, NullResultCallback Callback)
Deletes a given material.
The material should be retrieved through GetMaterials or GetMaterial.
- Parameters
Material – const GLTFMaterial& : The material to delete
Callback – NullResultCallback : Callback when asynchronous task finishes.
-
void GetMaterials(const csp::common::String &SpaceId, GLTFMaterialsResultCallback Callback)
Gets all materials associated with the given space.
- Parameters
SpaceId – const csp::common::String& : The space id the material is associated with.
Callback – GLTFMaterialsResultCallback : Callback when asynchronous task finishes.
-
void GetMaterial(const csp::common::String &AssetCollectionId, const csp::common::String &AssetId, GLTFMaterialResultCallback Callback)
Gets a material using its AssetCollection and Asset Id.
- Parameters
AssetCollectionId – const csp::common::String& : The asset collection id this material is associated with.
AssetId – const csp::common::String& : The asset id this material is associated with.
Callback – GLTFMaterialResultCallback : Callback when asynchronous task finishes.
-
void SetAssetDetailBlobChangedCallback(AssetDetailBlobChangedCallbackHandler Callback)
Sets a callback for an asset changed event.
- Parameters
Callback – AssetDetailBlobChangedCallbackHandler: Callback to receive data for the asset that has been changed.
-
void SetMaterialChangedCallback(MaterialChangedCallbackHandler Callback)
Sets a callback for a material changed event.
- Parameters
Callback – MaterialChangedCallbackHandler: 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
-
typedef std::function<void(const csp::multiplayer::AssetDetailBlobParams&)> AssetDetailBlobChangedCallbackHandler