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, for example] 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.