User guide

207
Convert an Asset ID to a file path.
resolvePath()
Convert an Asset ID and a frame number to a file path.
Publishing an Asset
The methods for publishing an Asset in a custom Asset Management System are createAssetAndPath() and
postCreateAsset().
createAssetAndPath() creates or updates an asset entry, given a collection of fields and an asset type. It returns
the ID of the asset which resolves to a valid file path. It is invoked prior to writing an asset. The fields passed to
createAssetAndPath() may be the result of a decomposed Asset ID stored as a parameter on a node.
Both createAssetAndPath() and postCreateAsset() are used by Katana mechanisms that write assets. The Asset
ID returned from createAssetAndPath() is used to create the fields passed to postCreateAsset(). The result from
postCreateAsset() is used from that point onward (such as in the File > Open Recent menu or in any references
to that asset ID in the current scene):
assetFields1 = assetPlugin.getAssetFields(assetId, True)
id1 = assetPlugin.createAssetAndPath(..., assetFields1, ...)
[Write Katana project file, etc.]
assetFields2 = assetPlugin.getAssetFields(id1, True)
id2 = assetPlugin.postCreateAsset(..., assetFields2, ...)
This is done to allow a temporary file path to be used for the write operation. The LookFileBake node and the Render
node use these methods.
createAssetAndPath()
The arguments for createAssetAndPath() are:
txn
The Asset Transaction (implementation optional). Can be used to group create/publish operations together into
one cancelable operation. This transaction is created via the createTransaction method.
assetType
A string representing which of the supported asset types is published. See Asset Types and Contexts for a list of the
asset types, and contexts.
fields
A dictionary of strings containing the asset fields that represent the location of the asset. These are typically
produced by de-serializing an Asset ID stored as a parameter on a node (such as a LookFileBake node). These fields
are based on the Asset ID returned by createAssetAndPath().
args
27 ASSET MANAGEMENT SYSTEM PLUG-IN API | PUBLISHING AN ASSET