User guide

186
If you specify optype as an empty string, the same Op that called create child is evaluated at the child location.
However, you can specify any other optype and that is run instead.
NOTE: Multiple calls to createChild() for the same named child location causes the last specified optype
to be used, that is to say, successive calls to createChild() mask prior calls.
The resetRoot parameter takes one of three values:
ResetRootTrue - the root location of the Op evaluated at the new location is reset to the new location path.
ResetRootAuto (the default) - the root location is reset only if optype is different to the Op calling createChild().
ResetRootFalse - the root location of the Op evaluated at the new location is inherited from the Op that called
createChild().
This parameter controls what is used as the rootLocation for the Op when it is run at the child location.
The execOp() Function
void execOp(const std::string& opType,
const FnAttribute::GroupAttribute& args);
By the time the Geolib3 Runtime comes to evaluating the OpTree, it is static and fixed. The cook interface provides a
number of functions, which allow you to request that Ops which were not declared when the OpTree was
constructed, be executed during evaluation time of the OpTree.
We have already seen how createChild() allows you to do this by allowing you to specify which Op is run at the child
location. The execOp() function allows an Op to directly call the execution of another Op, providing another
mechanism to evaluate Ops, which are not directly declared in the original OpTree. This differs from the createChild
() behavior, where we declare a different Op to run at child locations in a number of ways, including that:
It should be thought of as a one-shot execution of another Op, and
The Op specified in the execOp() call is evaluated as if it were being run at the same location with the same root
location as the caller.
You can see execOp() in action in the StaticSceneCreate Op, where Op types are specified in the x argument:
// Exec some ops?
FnAttribute::GroupAttribute opGroups = interface.getOpArg("x");
if (opGroups.isValid())
{
for (int childindex = 0; childindex < opGroups.getNumberOfChildren();
++childindex)
{
...
if (!opType.isValid() || !opArgs.isValid())
{
continue;
24 OP API | THE OP API EXPLAINED