User guide
118
Importomatic Camera Asset Example
In this example, the main asset file is CameraAsset.py into which we need to import the Nodegraph API and plug-
ins from Katana. We also include OS, solely to acquire the current path when referencing the asset icon.
from Katana import NodegraphAPI, Plugins
import os
Next, we define the registration function, which is called from the init file in order to register the callback and module
type for the plug-in.
def Register( ):
ImportomaticAPI.AssetModule.RegisterCreateCallback('Add Camera', AddCamera)
ImportomaticAPI.AssetModule.RegisterType('CameraCreate' , CameraModule( ) )
The callback comes into play when the user clicks the plus sign with the intent of instantiating a new module
within an Importomatic. The first string specifies the text shown in the menu command.
If the Add Camera module is selected from the dropdown list, the AddCamera function is called, which
communicates with the Nodegraph API and creates a Camera node. The output of the Camera node is automatically
connected to the input of a Merge node, within the Importomatic.
def AddCamera( importomaticNode ):
node = NodegraphAPI.CreateNode( 'CameraCreate' )
node.setName( "CameraCreate" )
return node
16 CREATING NEW IMPORTOMATIC MODULES |