MORE INFORMATION

A common stumbling block when implementing custom Ops is that cook interface functions returning current time (shutterOpen or shutterClose values) or the number of time samples, may not return the correct result unless the node whose Op chain the custom Op is part of, is set up correctly.

To be able to get the expected return value from these functions it’s necessary to add the System Op Args. It's typically the responsibility of the node (or hosting Op via interface.execOp) to provide these.

If the Op is instantiated via the GenericOp node, its addSystemOpArgs parameter needs to be set to Yes.

If the Op is registered via a custom NodeTypeBuilder, the interface object sent to buildOpChain() has an addOpSystemArgs() method which will add a 'system' GroupAttribute to the Op args. The Op can retrieve and use this.

EXAMPLE IMPLEMENTATION

Attached is an example of a simple NodeTypeBuilder based node type, that creates a single location at /root/world/geo/hello_world of type "hello world", and runs the HelloWorld Op on it. (In this example setting some attributes at /root).

The Op source needs to be compiled before it is ready to use. To do this, please follow the instructions in the $KATANA_ROOT/plugins/Src/README.md file included in the Katana installation directory.

Once the C++ source is compiled into a .so file, this file needs to be placed in an Ops sub-folder of a KATANA_RESOURCES directory, and NTB.py needs to be placed in a Plugins sub-folder of a KATANA_RESOURCES directory.

TECHNICAL EXPLANATION

GraphState::getOpSystemArgs() returns a group containing the 'timeslice' group ('currentTime', 'shutterOpen', 'shutterClose', 'numSamples') and the 'variables' group (graph state variables). This group should be set as the 'system' Op arg: CookInterface calls such as GetCurrentTime and GetGraphStateVariables are convenience functions that call getOpArg("system.[...]").

FURTHER HELP

If you are encountering any issues with the information contained in this article, then please open a Support ticket and let us know the issue you are encountering and the troubleshooting steps you have taken so far.