User guide

192
Integrating Custom Ops
At start up, Katana looks for .so files in every Ops sub-folder for each entry within the KATANA_RESOURCES
environment variable. If a .so file contains the declaration for one or more Ops, those Ops are added to the internal
registry of available Ops. There are two methods for integrating these custom Ops into Katana: the GenericOp node
and the Op Toolchain.
Building Ops
The .cpp files in the plugin_apis folder are needed when building an Op and, more generally, when building plug-ins.
These files provide a convenient C++ interface to access functionality exposed by Katana. This functionality is
implemented in different shared libraries and exposed to plug-ins through a C interface, which is wrapped in a 'suite'.
For example, the FnGeolibCookInterfaceSuite.h.cpp files provide a GeolibCookInterface class to manage the
interface object passed as an argument to the cook() methods in Ops. Looking at the class implementation, you'll
see that the methods aren't actually doing much more than calling through a 'suite'.
A 'suite' is a C struct, holding function pointers for the functions exposed from an internal library. In the
GeolibCookInterface case, the suite is defined in $KATANA_HOME/plugin_apis/include/FnGeolib/suite
/FnGeolibCookInterfaceSuite.h.
When plug-ins are loaded, Katana takes care of binding those pointers with the appropriate functions, implemented
in internal libraries. We basically expose a C API, but wrapped in a C++ interface on the client side. That's why the
.cpp files kept in plugin_apis/src/*/* are needed.
GenericOp
GenericOp is a fixed-function node useful for testing Ops during development and for use within Super Tools and
macros where the parameter UI isn't directly exposed. It's convenient because it doesn't require a node type, but it
also has a few limitations.
To run your Op through a GenericOp:
1. Create a GenericOp node in the Node Graph tab.
2. Enter the name of your Op in the opType field. Optionally, rename the node to something that accurately
describes its function.
3. Use the Add menu of the opArgs parameter to add arguments that your Op requires.
4. Use the wrench menu on each parameter to rename the parameter and configure how the UI is presented.
5. Configure the nodes inputs and outputs, as you would with any other node.
24 OP API | INTEGRATING CUSTOM OPS