User guide

123
If this function returns True, a delete menu option is added to the context menu when the item is right-clicked. The
method delete( self ) implements what happens when the delete option is selected.
Ignore Item
Similar to 'Delete item the function isIgnorable( self ) defines if the item can be ignored and adds the appropriate
context menu option if this method returns true.
The functions isIgnored( self ) and setIgnored( self ) are used to determine and set the ignore state. Function
isIgnored( self ) returns True or False depending on the defined ignore state.
Custom Actions
You can add custom actions to the context menu using the addToContextMenu function, which is only allowed in
GUI mode. A new action is added using menu.addAction( [QtGui.QAction] ). The class extending the QAction has
to be within a GUI scope, which is registered separately in the init file. See Registering the GUI for more information.
The custom action instantiates a QAction with the context menu description, and connects a listener to the signal,
which is triggered when the menu option is selected.
Registering the GUI
When GUI commands are needed, they are registered in a separate definition that contains a scoped import of the
QtGui and QtCore. This avoids illegal calls to these packages when running Katana in batch mode.
This is done using a tuple in the init file when registering the plug-in. The GUI registration class is the second item, as
shown here using the scenegraph XML module as a reference:
PluginRegistry=[ ]
import ScenegraphXmlAsset
PluginRegistry.append(
( "ImportomaticModule" , "0.0.1" , "ScenegraphXmlAsset" ,
( ScenegraphXmlAsset.Register, ScenegraphXmlAsset.RegisterGUI) ),
)
NOTE: ScenegraphXML is provided as a reference example only. It is not intended for production use, and
is not supported.
16 CREATING NEW IMPORTOMATIC MODULES | CUSTOM HIERARCHY STRUCTURES AND EXTENSIONS