User guide
189
WARNING: It is worth noting that, given the deferred processing model of Geolib3, the “get” functions,
such as getAttr(), getPotentialChildren(), doesInputExist(), may ask for scene graph information that
has not yet been computed.
In such this instance, your Op’s execution is aborted (using an exception) and re-scheduled when the
requested location is ready. Thus, Op writers should not attempt to blindly catch all exceptions with “(...)”
and, furthermore, should attempt to write exception-safe code.
If a user Op does accidentally catch one of these exceptions, the runtime detects this and considers the
results invalid, generating an error in the scene graph.
If your Op is only reading from its default input location (and index) or its parents, “recooks” are unlikely to
occur. However, for scattered access queries, either on the input location path or on the input index,
"recooks" are likely. If an Op needs to do scattered access queries from a multitude of locations, which
would otherwise have unfortunate performance characteristics, an API call - prefetch() - is available and is
discussed in further detail later on.
The getAttr() Function
FnAttribute::Attribute getAttr(
const std::string& attrName,
const std::string& inputLocationPath = std::string(),
int inputIndex = kFnKatGeolibDefaultInput) const;
It is often necessary to perform some action or compute a value based on the result stored in another attribute. The
getAttr() function allows you to interrogate any part of the incoming scene graph by providing the attribute name
and a scene graph location path (either absolute or relative). Additionally, you can specify a particular input index to
obtain the attribute value from, which must be smaller than the result of getNumInputs(). It is important to note
that getAttr always returns the value as seen at the input to the Op. If you wish to consider any setAttrs already
made, either by yourself or another Op invoked with execOp, you must use getOutputAttr.
The following diagram illustrates some of the subtleties of this and, most importantly, that getAttr in an execOp Op,
only sees the results of the calling Op when the query location is the current location, otherwise you see the input to
the calling Op’s ‘slot’ in the Op graph.
24 OP API | THE OP API EXPLAINED