Skip to main content

AssetLibrary

AssetLibAdd AssetLibUpdate AssetLibGet AssetLibR...

Updated over 2 months ago

AssetLibAdd

Adds a new asset library that will be associated with the calling plugin.

Python C++ C#

Python

BwApi.AssetLibAdd(libraryInfo)

C++

BwApiAssetLibAdd(libraryInfo);

C#

BwApi.AssetLibAdd(libraryInfo);

Parameters

Param

Variable

Description

In

libraryInfo

AssetLibrary object as a JSON string (see schema/asset-library/library.json)

Out

assetLibraryId

Newely created asset library ID. This ID should be passed to all other asset library functions

error/success code (see BwApiErrorCodes enum).

The plugin can add only one asset library. Calling this function more than once will return an error.

AssetLibUpdate

Update the information of an existing asset library.

Python C++ C#

Python

BwApi.AssetLibUpdate(assetLibraryId, libraryInfo)

C++

BwApiAssetLibUpdate(assetLibraryId, libraryInfo);

C#

BwApi.AssetLibUpdate(assetLibraryId, libraryInfo);

Parameters

Param

Variable

Description

In

assetLibraryId

Existing asset library ID

In

libraryInfo

AssetLibrary object as a JSON string (see schema/asset-library/library.json)

error/success code (see BwApiErrorCodes enum).

AssetLibGet

Get an existing asset library information.

Python C++ C#

Python

BwApi.AssetLibGet(assetLibraryId)

C++

BwApiAssetLibGet(assetLibraryId);

C#

BwApi.AssetLibGet(assetLibraryId);

Parameters

Param

Variable

Description

In

assetLibraryId

Existing asset library ID

Out

libraryInfoJson

AssetLibrary object as a JSON string (see schema/asset-library/library.json)

error/success code (see BwApiErrorCodes enum).

AssetLibRemove

Remove an existing asset library.

Python C++ C#

Python

BwApi.AssetLibRemove(assetLibraryId)

C++

BwApiAssetLibRemove(assetLibraryId);

C#

BwApi.AssetLibRemove(assetLibraryId);

Parameters

Param

Variable

Description

In

assetLibraryId

Existing asset library ID

error/success code (see BwApiErrorCodes enum).

AssetLibEventRegister +(_C_API)

Register a plugin for specific Asset Library event type.

Python C++ C# C

Python

BwApi.AssetLibEventRegister(assetLibraryId, eventType, callbackObj, callBackID)

C++

BwApiAssetLibEventRegister(assetLibraryId, eventType, callbackObj, callBackID);

C#

BwApi.AssetLibEventRegister(assetLibraryId, eventType, callbackObj, callBackID);

C

BwApiAssetLibEventRegister_C_API(assetLibraryId, eventType, callbackObj, callBackID);

Parameters

Param

Variable

Description

In

assetLibraryId

Existing asset library ID

In

eventType

Asset library event type

In

callbackObj

Class derived from BwApi.CallbackBase

In

callBackID

Integer value that will be sent to the callback (callbackId parameter)

error/success code (see BwApiErrorCodes enum).

AssetLibCollectionIds

Get all collections provided by this plugin using BwApiAssetLibCollectionAdd (described later).

Python C++ C#

Python

BwApi.AssetLibCollectionIds(assetLibraryId)

C++

BwApiAssetLibCollectionIds(assetLibraryId);

C#

BwApi.AssetLibCollectionIds(assetLibraryId);

Parameters

Param

Variable

Description

In

assetLibraryId

Existing asset library ID

Out

collectionsIds

An array that represents all the collection IDs for this library

error/success code (see BwApiErrorCodes enum).

AssetLibCollectionGet

Get a specific collection's information.

Python C++ C#

Python

BwApi.AssetLibCollectionGet(assetLibraryId, collectionId)

C++

BwApiAssetLibCollectionGet(assetLibraryId, collectionId);

C#

BwApi.AssetLibCollectionGet(assetLibraryId, collectionId);

Parameters

Param

Variable

Description

In

assetLibraryId

Existing asset library ID

In

collectionId

Existing collection ID as returned from BwApiAssetLibCollectionAdd

Out

collectionJSON

Collection object as a JSON string (see schema/asset-library/collection.json)

error/success code (see BwApiErrorCodes enum).

The collection will be returned in JSON string as a collection object as described in schema/asset-library/collection.json schema.

AssetLibCollectionAdd

Add a new collection to the asset library.

Python C++ C#

Python

BwApi.AssetLibCollectionAdd(assetLibraryId, collectionJSON)

C++

BwApiAssetLibCollectionAdd(assetLibraryId, collectionJSON);

C#

BwApi.AssetLibCollectionAdd(assetLibraryId, collectionJSON);

Parameters

Param

Variable

Description

In

assetLibraryId

Existing asset library ID

In

collectionJSON

Collection JSON object as a string that represents the collection. (see schema/asset-library/collection.json)

Out

collectionId

Return the newly created collection ID

Error/success code (see errorCodes enum).

AssetLibCollectionRemove

Remove a collection from the asset library.

Python C++ C#

Python

BwApi.AssetLibCollectionRemove(assetLibraryId, collectionId)

C++

BwApiAssetLibCollectionRemove(assetLibraryId, collectionId);

C#

BwApi.AssetLibCollectionRemove(assetLibraryId, collectionId);

Parameters

Param

Variable

Description

In

assetLibraryId

Existing asset library ID

In

collectionId

Existing collection ID

Error/success code (see errorCodes enum).

Assets in the removed collection may be zombie assets.

AssetLibCollectionAssetIds

Get a list of all assets in the given collection.

Python C++ C#

Python

BwApi.AssetLibCollectionAssetIds(assetLibraryId, collectionId)

C++

BwApiAssetLibCollectionAssetIds(assetLibraryId, collectionId);

C#

BwApi.AssetLibCollectionAssetIds(assetLibraryId, collectionId);

Parameters

Param

Variable

Description

In

assetLibraryId

Existing asset library ID

In

collectionId

Existing collection ID

Out

assetIds

List of Asset IDs that are linked to the given collection ID. (see schema/asset-library/asset.json)

Error/success code (see errorCodes enum).

Same asset may exist in multiple collections.

AssetLibCollectionAssetAdd

Adds an existing asset to an existing collection.

Python C++ C#

Python

BwApi.AssetLibCollectionAssetAdd(assetLibraryId, collectionId)

C++

BwApiAssetLibCollectionAssetAdd(assetLibraryId, collectionId);

C#

BwApi.AssetLibCollectionAssetAdd(assetLibraryId, collectionId);

Parameters

Param

Variable

Description

In

assetLibraryId

Existing asset library ID

In

collectionId

Existing collection ID

Out

assetId

Existing asset ID as returned from BwApiAssetLibAssetAdd

Error/success code (see errorCodes enum).

Same asset may exist in multiple collections.

AssetLibCollectionAssetRemove

Remove an existing asset from an existing collection.

Python C++ C#

Python

BwApi.AssetLibCollectionAssetRemove(assetLibraryId, collectionId, assetId)

C++

BwApiAssetLibCollectionAssetRemove(assetLibraryId, collectionId, assetId);

C#

BwApi.AssetLibCollectionAssetRemove(assetLibraryId, collectionId, assetId);

Parameters

Param

Variable

Description

In

assetLibraryId

Existing asset library ID

In

collectionId

Existing collection ID

In

assetId

Existing asset ID as returned from BwApiAssetLibAssetAdd

Error/success code (see errorCodes enum).

AssetLibAssetIds

Get a list of all assets in this asset library.

Python C++ C#

Python

BwApi.AssetLibAssetIds(assetLibraryId)

C++

BwApiAssetLibAssetIds(assetLibraryId);

C#

BwApi.AssetLibAssetIds(assetLibraryId);

Parameters

Param

Variable

Description

In

assetLibraryId

Existing asset library ID

Out

assetIds

List of all asset IDs within this library

Error/success code (see errorCodes enum).

AssetLibAssetAdd

Adding an asset to the asset library.

Python C++ C#

Python

BwApi.AssetLibAssetAdd(assetLibraryId, assetJSON)

C++

BwApiAssetLibAssetAdd(assetLibraryId, assetJSON);

C#

BwApi.AssetLibAssetAdd(assetLibraryId, assetJSON);

Parameters

Param

Variable

Description

In

assetLibraryId

Existing asset library ID

In

assetJSON

Asset JSON object as a string that represents the asset to add to this library. (see schema/asset-library/asset.json)

Out

assetId

Return the newly created asset ID

Error/success code (see errorCodes enum).

The asset won't be available on the UI until it will be added to a collection using BwApiAssetLibCollectionAssetAdd.

You may add the asset to multiple collections.

AssetLibAssetRemove

Remove an asset from the asset library.

Python C++ C#

Python

BwApi.AssetLibAssetRemove(assetLibraryId, assetId)

C++

BwApiAssetLibAssetRemove(assetLibraryId, assetId);

C#

BwApi.AssetLibAssetRemove(assetLibraryId, assetId);

Parameters

Param

Variable

Description

In

assetLibraryId

Existing asset library ID

In

assetId

Existing asset ID

Error/success code (see errorCodes enum).

The asset will be removed from all the collections.

AssetLibAssetGet

Get an asset's JSON object as a string that represent the asset in the asset library.

Python C++ C#

Python

BwApi.AssetLibAssetGet(assetLibraryId, assetId)

C++

BwApiAssetLibAssetGet(assetLibraryId, assetId);

C#

BwApi.AssetLibAssetGet(assetLibraryId, assetId);

Parameters

Param

Variable

Description

In

assetLibraryId

Existing asset library ID

In

assetId

Existing asset ID

Out

assetJSON

Asset JSON object as a string that represents the asset in the asset library. (see schema/asset-library/asset.json)

Error/success code (see errorCodes enum).

AssetLibAssetStateGet

Get an asset's library state.

Python C++ C#

Python

BwApi.AssetLibAssetStateGet(assetLibraryId, assetId)

C++

BwApiAssetLibAssetStateGet(assetLibraryId, assetId);

C#

BwApi.AssetLibAssetStateGet(assetLibraryId, assetId);

Parameters

Param

Variable

Description

In

assetLibraryId

Existing asset library ID

In

assetId

Existing asset ID

Out

assetStateJSON

Asset JSON object as a string that represents the asset state in the asset library. (see schema/asset-library/state.json)

Error/success code (see errorCodes enum).

AssetLibAssetStateSet

Set an asset's library state.

Python C++ C#

Python

BwApi.AssetLibAssetStateSet(assetLibraryId, assetId, assetStateJSON)

C++

BwApiAssetLibAssetStateSet(assetLibraryId, assetId, assetStateJSON);

C#

BwApi.AssetLibAssetStateSet(assetLibraryId, assetId, assetStateJSON);

Parameters

Param

Variable

Description

In

assetLibraryId

Existing asset library ID

In

assetId

Existing asset ID

In

assetStateJSON

Asset JSON object as a string that represents the asset state in the asset library. (see schema/asset-library/state.json)

Error/success code (see errorCodes enum).

Did this answer your question?