Writing a SuperTool
SuperTools are provided as Python packages, and are loaded from the ‘SuperTools’ subdirectory of Katana Resources.
The package registers SuperTools as Katana plug-ins by defining a PluginRegistry list of plug-in definitions, each of which is a tuple containing the following:
• The plug-in type name, “SuperTool”.
• The plug-in type API version number, which is currently 2.
• Type-specific plug-in data, which is a tuple containing the following:
• The Node class
• A function that returns the Editor class.
For example: PluginRegistry = [("SuperTool", 2, "MySuperTool", (MySuperTool.MySuperToolNode, MySuperTool.GetEditor))]
The Node class is a NodegraphAPI.SuperTool, and is responsible for the SuperTool’s top-level parameters and internal node graph, typically presenting API for updating its properties programmatically. The Editor class provides the SuperTool’s GUI, as populated in the Parameters tab. It is a QWidget whose constructor accepts a parent widget and an instance of the Node class.
It is also possible to define a GetGenericAssignDirectory function that returns a directory path (as a str) containing GenericAssign node specifications (see Args Files for GenericAssign), allowing these files to exist within the SuperTool package, rather than a separate GenericAssign Katana Resource.
Katana ships with several example SuperTools for demonstration purposes. The relevant files can be found 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.