Skip to content
Peter Shinners edited this page Apr 18, 2021 · 5 revisions
AssetTransaction * createTransaction()

When Katana prepares to render it may create several assets at once for multiple Render nodes. It will wrap this operation in a transaction.

This method does not need to be implemented by subclasses. Unlike other asset methods which are abstract and required.

If implemented, the method must return a heap allocated subclass of AssetTransaction allocated with the new operator. Otherwise the method can return NULL to indicate no transaction.

The resulting transaction is passed to the create methods createAssetAndPaths or PostCreateAsset. Katana will call the cancel or commit method this provides as needed.

The base transaction class is defined like this:

    class FNASSET_API AssetTransaction
    {
    public:
      AssetTransaction() { }
      virtual ~AssetTransaction() { }
      virtual void cancel() = 0;
      virtual bool commit() = 0;
    };

Creating and using transactions is entirely optional for an asset plugin. It is simplest to not bother. The downside to not implementing a transaction is that Katana could leave behind unused created assets in the case of a failure partway through preparing to render.

Render nodes have separate "Pre-Render Publish Asset" and "Post-Render Publish Asset" actions available in the API and context menus. These are run independently and will each create their own transaction for all related Render nodes.