Search Tips

Search is based on keyword.

`Ex: "Procedures"`

Do not search with natural language

`Ex: "How do I write a new procedure?"`

Give Feedback Support Portal

# Writing a SuperTool

SuperTools in Katana are written in Python and the suggested convention is that form and function are defined by two separate classes: xxxNode and xxxEditor respectively (where xxx is the tool's name, for example, GafferThree). The Editor class offers a UI to modify the internal network using the API functions, whereas the Node class defines the node itself and the public scripting API.

Most of the information on SuperTools can be found in SuperTools, however, continue for the basics on writing a SuperTool.

Following the suggested convention, the internal file structure of a SuperTool could look something like this:

HelloSuperTool

    ├─ __init__.py
    └─ v1
        ├─ __init__.py
        ├─ Editor.py
        ├─ Node.py
        ├─ ScriptActions.py
        └─ Upgrade.py

The files in a SuperTool are as follows:

• Node.py - the node itself and the public scripting API, which you can test if you get a reference to the node in the Python tab.

• Editor.py - the Qt4 UI (this is only imported in the interactive GUI, not in batch or scripting modes).

• ScriptActions.py - useful functions that are not part of the node API. Since this node is imported by both node and editor, it cannot contain any GUI code.

• Upgrade.py - stub for upgrading the node. This allows compatibility with older versions of the node.

Note: The clean separation between the node and the UI is important for being able to script the node in Script mode.

There is no namespacing of nodes inside groups or SuperTools. To reliably get access to nodes with an initial name, you should use expressions such as:

getNode('Merge').getName()

If the node gets renamed, Katana looks for all getNode('xxx') calls and renames them appropriately.

You can also find example source code, which demonstrates the creation of a SuperTool in:

$KATANA_HOME/plugins/Resources/Examples/SuperTools/.

• PonyStack

• ImageCoordinate

• ExamplePackageSuperTool

• PonyFarm

• AttributeWedge

Image Coordinate for example demonstrates the SuperTool making use of a custom Qt widget, and interacting with Katana's Model-View-Controller system. It also presents a simple SuperTool that allows you to load an image (.jpg or .gif) and select a coordinate within the image. The coordinate is then fed back into the scene graph using the SuperTool's internal node network.

For more information, see How to Write a SuperTool in the Katana Developer Guide.