Skip to content

runAssetPluginCommand

Peter Shinners edited this page Apr 16, 2021 · 6 revisions
bool runAssetPluginCommand(
    const std::string &assetId, 
    const std::string &command, 
    const StringMap &commandArgs
)

This arbitrary function is used by Katana to artist operations on LiveGroup nodes. There are only two possible values Katana will use for the command argument.

The command argument will be "acquireLock" when a LiveGroup node is switching to an editable state.

The command argument will be "releaseLock" when a LiveGroup node is switching from editable to a locked state.

This function can return False to specify that the operation failed or is not allowed. Katana will not change the state of the LiveGroup node when this happens, but this function cannot provide any details to the caller about why the operation failed. This makes returning False of limited value, as the artist will often be stuck with no information or way to proceed. A dialog with generic information will be shown to the user if either operation returns False.

The commandArgs provides a theoretical way to pass additional named arguments, but it unused by Katana.

The 'checkPermissions' function fills a similar role for Katana.

Be aware that there can be multiple "releaseLock" commands be sent for a single node when unlocking. It seems Katana will only acquire the lock for a LiveGroup once.

Katana will do a respectable job of releasing locks on edited LiveGroup nodes when shutting down or closing the current scene. Opening a new Katana scene should never start the session with LiveGroups already editable.

TODO are there exposed functions to call custom commands? Probably, but who would ever use them and why?