User guide

72
6. I make use of other SGGs, for example Alembic_In, at child locations created by my SGG. Is this a
problem?
Just swap the Op out at the child location, so for this example, to the Alembic_In Op. If you want it to be
deferred, use the Ops’ top-level group attr syntax and OpResolve. Some Ops have helper classes to assist in
building their args.
7. What about threading?
You need to pay attention to what you set in setup and make sure you thread-safe your code accordingly, or set
it to ThreadModeGlobalUnsafe.
8. How do I pass data to the Op that runs at a child location?
Due to the cook function being static, you can’t use the practice of passing data to the constructor for the
context that represents the child or sibling location. The way this is handled in Geolib3 is to update the OpArgs
that are available to the cook function when running at that location.
This can be done either by calling replaceChildTraversalOp for the generic case of all children, or by specifying
the new OpArgs when calling createChild. OpArgs should use CamelCase for their names, with the first letter set
in lowercase, for example, myOpArg”.
It is recommended to distinguish between ‘private’ internal OpArgs, only used for communication to child
locations, and ‘public top-level OpArgs by prefixing private names with an underscore. For example,
“numSubdivisions” would be public and _currentDepth” would be private.
9. How do I define a custom node that users can create in the node graph for my Op?
The Katana.Nodes3DAPI.NodeTypeBuilder is your friend. It greatly simplifies the process of defining a new
node, and ensures the Op network is suitably updated as parameters change. Refer to the chapter on the
NodeTypeBuilder on page198 for more info.
10. I want my Op to start running at /root/world/geo/some/location”, in the way that
ScenegraphGeneratorSetup allowed me to. How do I do this with an Op?
The GenericOp node can do this when applyWhen is set to “create new location”. If you are creating a custom
node using NodeTypeBuilder, instead of instantiating your Op, configure a StaticSceneCreate Op in the
buildOpChain function to run your Op at a sub-location, that is to say:
sscb = FnGeolibServices.OpArgsBuilders.StaticSceneCreate()
sscb.addSubOpAtLocation(locationNameFromParam, “MyOp”, myOpArgsBuilder.build())
interface.appendOp('StaticSceneCreate', sscb.build())
The SubdividedSpaceOp example makes use of this technique.
11. How do Nodes/Ops deal with the Inputs? Do I have to manage merging myself?
Ops have the ability to see the incoming scene, from one or more inputs. When using NodeTypeBuilder to
define a custom node, it is simple to control the default set of inputs present on the node when it's created.
In an ‘empty’ Op, the scene graph on the default input (first index) passes-through the Op unchanged. You do
not need to manually ‘copy input to output’.
If you don’t want children or attributes to pass through, you need to explicitly delete them.
If your Op creates a child that already exists, any attrSets you make simply update attributes at that location.
If your Op is connected to multiple inputs, then you have to explicitly query, and merge in data from the
additional inputs in your code.
9 PORTING PLUG-INS | FAQ FOR PLUG-IN PORTING