Additional Methods

In addition to the core methods that need to be implemented by an Asset plug-in there are additional methods, many of which are variants.

reset()

Triggered when the user requests that Katana flush its caches. This is used to clear local Asset ID caches to allow retrieval of the latest version of an asset.

resolveAllAssets()

Used for expanding Asset IDs in a string containing a mix of Asset IDs and arbitrary tokens, such as a command. It takes a single string parameter, which may contain one or more Asset IDs, and replaces them with resolved file paths. resolveAllAssets() is used by:

Python expressions, which have access to a function called assetResolve() that resolves a string of Asset IDs split by white space.

String parameters, which has a method called getFileSequenceValue() that returns the value of the string with automatic expansion of Asset IDs into file paths.

ImageWrite node postScripts. An ImageWrite node can execute post scripts commands. The Asset IDs in these commands are automatically expanded.

resolvePath()

This resolves an Asset ID and frame number pair, where time is a factor in determining the asset resolution (such as a sequence of images). resolvePath() is called in place of resolveAsset() whenever time is a significant factor in asset resolution.

resolvePath() is used extensively for resolving procedural arguments in render plug-ins. It is used by the Material and RiProcedural resolvers, and the Look File Manager. It can be accessed in Attribute Scripts via the AssetResolve() function in an Attribute Script Util module.

resolveAssetVersion()

This accepts an Asset ID that references a tag or meta version such as latest or lighting and returns the version number that it corresponds to. It also accepts an Asset ID that contains no version information and an optional versionTag parameter, and produces the version number that corresponds to the versionTag argument.

This is used by the LookFile resolver, Katana in Batch mode, the Casting Sheet plug-in, and the Importomatic user interface.

createTransaction()

It allows Katana to create assets in bulk. If createTransaction is implemented to return a custom transaction object, then the object must have commit and cancel methods that take no arguments. The commit method should submit the operations accumulated in the transaction to the Asset Repository. The cancel method should rollback the publish operations accumulated in the transaction.

The transaction is passed by Katana to createAssetAndPath() and to postCreateAsset(). An example of this is in the Render node.

Note:  For Python asset plug-ins, this method must be implemented but it may return None. In C++, this method may be implemented; where it is, it must return an asset transaction object.

containsAssetId()

Reports if a string contains an Asset ID.

The string parameter uses this method prior to expanding the Asset IDs it may contain, when getFileSequenceValue() is called.

getAssetDisplayName()

Is used to produce a short name for an asset. For example, a name that can be used in the UI.

This is used by the Alembic Importomatic plug-in and the LookFileManager.

getAssetVersions()

Lists the versions that are available for an asset as a sequence of strings.

This is used by the Importomatic, to allow users to choose an asset version in the Importomatic versions column and by the CastingSheet plug-in.

getUniqueScenegraphLocationFromAssetId()

Provides a scene graph path for an asset, as a string, so that it can be placed easily in the Scene Graph tab, and is currently used by the LookFileManager.

getRelatedAssetId()

Given an Asset ID and a string representing a relationship or connection, returns another Asset ID. For example, with a shader file that has an Args file getRelatedAssetId() can be used to get the Asset ID of the Args file from the Asset ID of the shader. The contexts listed in Asset Types and Contexts are passed to getRelatedAssetId().

Note:  If getRelatedAssetId() returns either None, or an empty string, Katana looks up the Args file in the default fashion, relative to the .so file location.

Note:  If getRelatedAssetId() returns anything other than None or an empty string, Katana attempts to load the returned Asset ID. If, for any reason, that Asset ID is not valid, Katana does not fall back to the default behavior, but gives a load error.

getAssetIdForScope()

This truncates an Asset ID to the given scope, where the scope is an asset field.

For example:

getAssetIdForScope( "mock://myShow/myShot/myName/myVersion", "shot" )

Produces:

mock://myShow/myShot

The returned Asset ID no longer contains the name and version components.

This is used by the assetAttr() built-in function that Python expressions have access to, and by Katana internally.

setAssetAttributes()

Allows users to set additional metadata on an asset.

This is not used by anything in the Katana codebase. It is entirely up to the users to make use of this function.

getAssetAttributes()

Allows users to store additional metadata on an asset.

The casting sheet example plug-in uses this method and Python expressions have access to an assetAttr built-in method that retrieves asset attribute information.