Skip to main content

AssetLibrary

AssetLibrary

This file contains all the asset library functionality, you can create categories, materials etc...

BwApiAssetLibAdd

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

Python

BwApi.AssetLibAdd(libraryInfo)

C++

BwApiAssetLibAdd(libraryInfo, assetLibraryId);

C#

BwApi.AssetLibAdd(libraryInfo);

Parameters

Param

Variable

Description

In

libraryInfo

AssetLibrary object as a JSON string (see library.json).

Out

assetLibraryId

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

Returns: error/success code (see BwApiErrorCodes enum).

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

---

BwApiAssetLibUpdate

Update the information of an existing asset library.

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 library.json).

Returns: error/success code (see BwApiErrorCodes enum).

---

BwApiAssetLibGet

Get an existing asset library information.

Python

BwApi.AssetLibGet(assetLibraryId)

C++

BwApiAssetLibGet(assetLibraryId, libraryInfoJson);

C#

BwApi.AssetLibGet(assetLibraryId);

Parameters

Param

Variable

Description

In

assetLibraryId

Existing asset library ID.

Out

libraryInfoJson

AssetLibrary object as a JSON string (see library.json).

Returns: error/success code (see BwApiErrorCodes enum).

---

BwApiAssetLibRemove

Remove an existing asset library.

Python

BwApi.AssetLibRemove(assetLibraryId)

C++

BwApiAssetLibRemove(assetLibraryId);

C#

BwApi.AssetLibRemove(assetLibraryId);

Parameters

Param

Variable

Description

In

assetLibraryId

Existing asset library ID.

Returns: error/success code (see BwApiErrorCodes enum).

---

BwApiAssetLibEventRegister

Register a plugin for specific Asset Library event type.

Python

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

C++

BwApiAssetLibEventRegister(assetLibraryId, eventType, callbackObj, callBackID);

C#

BwApi.AssetLibEventRegister(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).

Returns: error/success code (see BwApiErrorCodes enum).

---

BwApiAssetLibCollectionIds

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

Python

BwApi.AssetLibCollectionIds(assetLibraryId)

C++

BwApiAssetLibCollectionIds(assetLibraryId, collectionsIds);

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.

Returns: error/success code (see BwApiErrorCodes enum).

---

BwApiAssetLibCollectionGet

Get a specific collection's information.

Python

BwApi.AssetLibCollectionGet(assetLibraryId, collectionId)

C++

BwApiAssetLibCollectionGet(assetLibraryId, collectionId, collectionJSON);

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 collection.json).

Returns: error/success code (see BwApiErrorCodes enum).

Note: The collection will be returned in JSON string as a collection object as described in collection.json schema.

---

BwApiAssetLibCollectionAdd

Add a new collection to the asset library.

Python

BwApi.AssetLibCollectionAdd(assetLibraryId, collectionJSON)

C++

BwApiAssetLibCollectionAdd(assetLibraryId, collectionJSON, collectionId);

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 collection.json).

Out

collectionId

Return the newly created collection ID.

Returns: Error/success code (see errorCodes enum).

---

BwApiAssetLibCollectionRemove

Remove a collection from the asset library.

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.

Returns: Error/success code (see errorCodes enum).

Note: Assets in the removed collection may be zombie assets.

---

BwApiAssetLibCollectionAssetIds

Get a list of all assets in the given collection.

Python

BwApi.AssetLibCollectionAssetIds(assetLibraryId, collectionId)

C++

BwApiAssetLibCollectionAssetIds(assetLibraryId, collectionId, assetIds);

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 asset.json).

Returns: Error/success code (see errorCodes enum).

Note: Same asset may exist in multiple collections.

---

BwApiAssetLibCollectionAssetAdd

Adds an existing asset to an existing collection.

Python

BwApi.AssetLibCollectionAssetAdd(assetLibraryId, collectionId)

C++

BwApiAssetLibCollectionAssetAdd(assetLibraryId, collectionId, assetId);

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.

Returns: Error/success code (see errorCodes enum).

Note: Same asset may exist in multiple collections.

---

BwApiAssetLibCollectionAssetRemove

Remove an existing asset from an existing collection.

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.

Returns: Error/success code (see errorCodes enum).

---

BwApiAssetLibAssetIds

Get a list of all assets in this asset library.

Python

BwApi.AssetLibAssetIds(assetLibraryId)

C++

BwApiAssetLibAssetIds(assetLibraryId, assetIds);

C#

BwApi.AssetLibAssetIds(assetLibraryId);

Parameters

Param

Variable

Description

In

assetLibraryId

Existing asset library ID.

Out

assetIds

List of all asset IDs within this library.

Returns: Error/success code (see errorCodes enum).

---

BwApiAssetLibAssetAdd

Adding an asset to the asset library.

Python

BwApi.AssetLibAssetAdd(assetLibraryId, assetJSON)

C++

BwApiAssetLibAssetAdd(assetLibraryId, assetJSON, assetId);

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 asset.json).

Out

assetId

Return the newly created asset ID.

Returns: Error/success code (see errorCodes enum).

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

---

BwApiAssetLibAssetRemove

Remove an asset from the asset library.

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.

Returns: Error/success code (see errorCodes enum).

Note: The asset will be removed from all the collections.

---

BwApiAssetLibAssetGet

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

Python

BwApi.AssetLibAssetGet(assetLibraryId, assetId)

C++

BwApiAssetLibAssetGet(assetLibraryId, assetId, assetJSON);

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 asset.json).

Returns: Error/success code (see errorCodes enum).

---

BwApiAssetLibAssetStateGet

Get an asset's library state.

Python

BwApi.AssetLibAssetStateGet(assetLibraryId, assetId)

C++

BwApiAssetLibAssetStateGet(assetLibraryId, assetId, assetStateJSON);

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 state.json).

Returns: Error/success code (see errorCodes enum).

---

BwApiAssetLibAssetStateSet

Set an asset's library state.

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 state.json).

Returns: Error/success code (see errorCodes enum).

---

Did this answer your question?