omni::graph::core::IGraphContext
Defined in omni/graph/core/iComputeGraph.h
-
struct IGraphContext
Use this interface to pull data for compute node, and also push data to compute graph/cache.
Public Members
-
long int (*getStageId)(const GraphContextObj &contextObj)
Returns the stage id the context is currently attached to.
- Param context
[in] structure containing both the interface and underlying object
- Return
the USD stage id
-
GraphObj (*getGraph)(const GraphContextObj &context)
Returns the graph associated with this context.
- Param context
[in] structure containing both the interface and underlying object
- Return
GraphObj structure containing the graph
-
float (*getElapsedTime)(const GraphContextObj &contextObj)
Returns the time between last evaluation of the graph and “now”.
- Param context
[in] structure containing both the interface and underlying object
- Return
the elapsed time
-
float (*getTime)(const GraphContextObj &contextObj)
Returns the global playback time.
- Param context
[in] structure containing both the interface and underlying object
- Return
the global playback time in seconds
-
int64_t (*getElapsedTimeNS)(const GraphContextObj &contextObj)
Returns the time between last evaluation of the graph and “now”, in NS.
Note this will only return valid values if the update loop is using the void updateSimStep(int64_t timeNS, carb::tasking::Counter* counter, bool) interface As of this writing, this is limited to the DS project
- Param context
[in] structure containing both the interface and underlying object
- Return
the elapsed time in nano seconds
-
int64_t (*getTimeNS)(const GraphContextObj &contextObj)
Returns the global time in NS.
Note this will only return valid values if the update loop is using the void updateSimStep(int64_t timeNS, carb::tasking::Counter* counter, bool) interface As of this writing, this is limited to the DS project
- Param context
[in] structure containing both the interface and underlying object
- Return
the global time in nano seconds
-
const void *(*getDefault)(const GraphContextObj &context, const AttributeObj &attrObj)
Given an attribute, retrieves the default attribute value in system memory.
- Param context
[in] structure containing both the interface and underlying object
- Param attrObj
[in] The attribute object for which to retrieve the default value
- Return
the const void pointer to the data
-
float (*getFrame)(const GraphContextObj &contextObj)
Returns the global playback time in frames.
- Param context
[in] structure containing both the interface and underlying object
- Return
the global playback time in frames
-
bool (*getIsPlaying)(const GraphContextObj &contextObj)
Returns the state of global playback.
- Param context
[in] structure containing both the interface and underlying object
- Return
true if playback has started, false is playback is stopped
-
bool (*inspect)(const GraphContextObj &contextObj, inspect::IInspector *inspector)
Runs the inspector on the data in the given graph context.
- Param contextObj
[in] The graph context on which the inspector runs
- Param inspector
[in] The inspector class
- Return
true if the inspection ran successfully, false if the inspection type is not supported
-
double (*getTimeSinceStart)(const GraphContextObj &contextObj)
Returns the time since the App started.
- Param context
[in] structure containing both the interface and underlying object
- Return
the global time since the app started in seconds
-
bool (*isValid)(const GraphContextObj &contextObj)
Returns whether the graph context object is still valid or not.
- Param contextObj
[in] The context object for which to query
- Return
Whether the context is still valid
-
double (*getAbsoluteSimTime)(const GraphContextObj &contextObj)
Returns the accumulated total of elapsed times between rendered frames.
- Param contextObj
[in] structure containing both the interface and underlying object
- Return
the accumulated total of elapsed times between rendered frames
-
void (*registerForUSDWriteBack)(const GraphContextObj &contextObj, BundleHandle bundle, NameToken attrib)
Deprecated - do not use - removal scheduled for 106.
-
AttributeDataHandle (*getVariableInstanceDataHandle)(const GraphContextObj &contextObj, const IVariablePtr &variable, const char *instancePrimPath)
Given a variable and an instance path, returns a handle to access its data.
- Param contextObj
[in] The context object used to find the variable data
- Param variable
[in] The variable to retrieve the data from
- Param Path
[in] to the prim holding an instance of this graph
- Return
An attribute data handle that can be used to access the variable data. If the given prim does not contain an instance of the graph, the data handle returned will be invalid.
-
ConstAttributeDataHandle (*getVariableInstanceConstDataHandle)(const GraphContextObj &contextObj, const IVariablePtr &variable, const char *instancePrimPath)
Given a variable and an instance path, returns a constant handle to access its data as readonly.
- Param contextObj
[in] The context object used to find the variable data
- Param variable
[in] The variable to retrieve the data from
- Param Path
[in] to the prim holding an instance of this graph
- Return
An constant attribute data handle that can be used to access the variable data. If the given prim does not contain an instance of the graph, the data handle returned will be invalid.
-
NameToken const &(*getGraphTarget)(const GraphContextObj &contextObj, InstanceIndex instanceIndex)
Get the Prim path of the graph target.
The graph target is defined as the parent Prim of the compute graph, except during instancing - where OmniGraph executes a graph once for each Prim. In the case of instancing, the graph target will change at each execution to be the path of the instance. If this is called outside of graph execution, the path of the graph Prim is returned, or an empty token if the graph does not have a Prim associated with it.
- Param contextObj
[in] The context object used to find the data.
- Param instanceIndex
[in] In vectorized context, the instance index relative to the currently targeted graph
- Return
a token representing the path of the graph target primitive.
-
AttributeDataHandle (*getVariableDataHandle)(const GraphContextObj &contextObj, const IVariablePtr &variable, InstanceIndex instanceIndex)
Given a variable, returns a handle to access its data.
- Param contextObj
[in] The context object used to find the variable data
- Param variable
[in] The variable to retrieve the data from
- Param instanceIndex
[in] In vectorized context, the instance index relative to the currently targeted graph
- Return
An attribute data handle that can be used to access the variable data.
-
ConstAttributeDataHandle (*getVariableConstDataHandle)(const GraphContextObj &contextObj, const IVariablePtr &variable, InstanceIndex instanceIndex)
Given a variable, returns a constant handle to access its data as readonly.
- Param contextObj
[in] The context object used to find the variable data
- Param variable
[in] The variable to retrieve the data from
- Param instanceIndex
[in] In vectorized context, the instance index relative to the currently targeted graph
- Return
A constant attribute data handle that can be used to access the variable data.
-
void (*getAttributesByNameR)(ConstAttributeDataHandle *attrsOut, const GraphContextObj &contextObj, NodeContextHandle node, const NameToken *attrNames, size_t count, InstanceIndex instanceIndex)
Requests some input attributes of the specified compute node in the specified context.
If no input attribute with the given name exists on the node, the returned handle will return false from its isValid() function.
- Param [in/out]
attrsOut A pre-allocated array that will be filled with the requested handles
- Param contextObj
[in] The context object used to find the data
- Param node
[in] The node object to retrieve the data from
- Param attrNames
[in] An array of names of attributes on the given node to retrieve a data handle for
- Param count
[in] The size of the provided arrays (attrName and attrsOut)
- Param instanceIndex
[in] In vectorized context, the instance index relative to the currently targeted graph
-
void (*getAttributesByNameW)(AttributeDataHandle *attrsOut, const GraphContextObj &contextObj, NodeContextHandle node, const NameToken *attrNames, size_t count, InstanceIndex instanceIndex)
Requests some output attributes of the specified compute node in the specified context.
If no input attribute with the given name exists on the node, the returned handle will return false from its isValid() function.
- Param [in/out]
attrsOut A pre-allocated array that will be filled with the requested handles
- Param contextObj
[in] The context object used to find the data
- Param node
[in] The node object to retrieve the data from
- Param attrNames
[in] An array of names of attributes on the given node to retrieve a data handle for
- Param count
[in] The size of the provided arrays (attrName and attrsOut)
- Param instanceIndex
[in] In vectorized context, the instance index relative to the currently targeted graph
-
size_t *(*getArrayAttributeSize)(const GraphContextObj &context, const AttributeObj &attrObj, DataAccessFlags flags, InstanceIndex instanceIndex)
Given an attribute of array type, return a pointer to the number of elements in the array If flags is kWriteOnly or kReadAndWrite then writing to the dereferenced pointer resizes the array the next time it is accessed on CPU or GPU.
- Param context
[in] structure containing both the interface and underlying object
- Param attrObj
[in] The attribute object for which to retrieve the array size
- Param flags
[in] The data access flags indicating whether the array size is to be R, W, or RW
- Return
the pointer to the array size
-
size_t *(*getArrayAttributeSizeGPU)(const GraphContextObj &context, const AttributeObj &attrObj, DataAccessFlags flags, InstanceIndex instanceIndex)
Given an attribute of array type, return a GPU pointer to the number of elements in the array Flags must be kReadOnly, because currently we don’t allow GPU code to resize GPU arrays This restriction may be relaxed in the future If you want to resize a GPU array you can do it on the CPU using getArrayAttributeSize.
- Param context
[in] structure containing both the interface and underlying object
- Param attrObj
[in] The attribute object for which to retrieve the array size
- Param flags
[in] The data access flags indicating whether the array size is to be R, W, or RW
- Return
the pointer to the array size
-
BundleHandle (*getOutputBundle)(const GraphContextObj &contextObj, NodeContextHandle node, NameToken outputName, InstanceIndex instanceIndex)
Requests an output bundle of the specified compute node in the specified context.
If no output bundle with the given name exists on the node, the returned handle will return false from its isValid() function.
- Param contextObj
[in] The context object used to find the data
- Param node
[in] The node object to retrieve the data from
- Param outputName
[in] The name of the attribute on the given node that represent the output bundle
- Param instanceIndex
[in] In vectorized context, the instance index relative to the currently targeted graph
- Return
A handle to the requested prim
-
omni::fabric::PathC (*getInputTarget)(const GraphContextObj &contextObj, NodeContextHandle node, NameToken inputName, InstanceIndex instanceIndex)
Requests an input target path of the specified compute node in the specified context.
If no input target path with the given name exists on the node, the returned path will return uninitialized path.
- Param contextObj
[in] The context object used to find the data
- Param node
[in] The node object to retrieve the data from
- Param inputName
[in] The name of the attribute on the given node that represent the input bundle
- Param instanceIndex
[in] In vectorized context, the instance index relative to the currently targeted graph
- Return
A path to the requested target
-
size_t (*getInputTargetCount)(const GraphContextObj &contextObj, NodeContextHandle node, NameToken inputName, InstanceIndex instanceIndex)
Requests the number of input targets in the relationship with the given name on the specified compute node in the specified context.
This returns 0 if no relationship with the given name exists on the node or the relationship is empty.
- Param contextObj
[in] The context object used to find the data
- Param node
[in] The node object to retrieve the data from
- Param inputName
[in] The name of the relationship attribute on the given node that represent the input targets
- Param instanceIndex
[in] In vectorized context, the instance index relative to the currently targeted graph
- Return
The number of input targets under the provided relationship
-
void (*getInputTargets)(const GraphContextObj &contextObj, NodeContextHandle node, NameToken inputName, omni::fabric::PathC *targets, InstanceIndex instanceIndex)
Fills in the provided targets array with paths to all of the input targets(bundles or primitives) in the relationship with the given name on the specified compute node in the specified context.
The caller must first call getInputTargetCount to ensure that the targets array will be sufficiently large to receive all of the paths.
- Param contextObj
[in] The context object used to find the data
- Param node
[in] The node object to retrieve the data from
- Param inputName
[in] The name of the relationship attribute on the given node that represent the input targets
- Param targets
[inout] A pre-sized array that will be filled with the requested paths
- Param instanceIndex
[in] In vectorized context, the instance index relative to the currently targeted graph
-
BundleHandle (*copyBundleContentsIntoOutput)(const GraphContextObj &contextObj, NodeContextHandle node, NameToken outBundleName, ConstBundleHandle sourceBundleHandle, InstanceIndex instanceIndex)
Creates copies of all attributes from sourceBundleHandle in the output bundle with the specified name on the specified node.
This function is equivalent to: BundleHandle retBundle = iContext.getOutputBundle(context, node, outBundleName); iContext.copyBundleContentsInto(context, retBundle, sourceBundleHandle); return retBundle; but with a single function pointer call, instead of two.
- Param contextObj
[in] The context object used to find the data
- Param node
[in] The node object to retrieve the data from
- Param outBundleName
[in] The name of the attribute on the given node that represent the output bundle to write to
- Param sourceBundleHandle
[in] A handle to a bundle to copy content from
- Param instanceIndex
[in] In vectorized context, the instance index relative to the currently targeted graph
- Return
An handle to the targeted output bundle
-
void (*copyBundleContentsInto)(const GraphContextObj &contextObj, BundleHandle destBundleHandle, ConstBundleHandle sourceBundleHandle)
Creates copies of all attributes from sourceBundleHandle in the bundle corresponding with destBundleHandle.
- Param contextObj
The context object used to find the data
- Param destBundleHandle
A handle to a bundle to copy content to
- Param sourceBundleHandle
A handle to a bundle to copy content from
-
void (*clearBundleContents)(const GraphContextObj &contextObj, BundleHandle bundleHandle)
Removes all attributes from the prim corresponding with bundleHandle, but keeps the bundle itself.
- Param contextObj
The context object used to find the data
- Param bundleHandle
A handle to a bundle to clear content from
-
void (*registerForUSDWriteBacks)(const GraphContextObj &contextObj, AttributeDataHandle const *handles, size_t count)
Register provided attributes for USD write back at the end of the current frame.
- Param contextObj
[in] The context object used to find the data.
- Param handles
[in] An array of handles of the attributes that should be written back to usd
- Param count
[in] The size of the provided array
-
void (*registerForUSDWriteBacksToLayer)(const GraphContextObj &contextObj, AttributeDataHandle const *handles, size_t count, NameToken layerIdentifier)
Register provided attributes for USD write back at the end of the current frame to a specific layer.
- Param contextObj
[in] The context object used to find the data.
- Param handles
[in] An array of handles of the attributes that should be written back to usd
- Param count
[in] The size of the provided array
- Param layerIdentifier
[in] The unique name for the layer to be written
-
bool (*canCacheAttributePointers)(const GraphContextObj &graphObj)
Returns whether or not the graph associated with this context meets all the required condition that allows a user side system (such as OGN databases) to cache its node’s attribute pointers returned by the ABIs from frame to frame.
Note that when allowed to cache pointers, nodes using such system also need to listen to the various callbacks that can be implemented on the node-type-definition in order to be warned when those pointers needs to be discarded.
-
TargetPath const &(*getGraphTargetAsPath)(const GraphContextObj &contextObj, InstanceIndex instanceIndex)
Get the Prim path of the graph target.
The graph target is defined as the parent Prim of the compute graph, except during instancing - where OmniGraph executes a graph once for each Prim. In the case of instancing, the graph target will change at each execution to be the path of the instance. If this is called outside of graph execution, the path of the graph Prim is returned, or an empty path if the graph does not have a Prim associated with it.
- Param contextObj
[in] The context object used to find the data.
- Param instanceIndex
[in] In vectorized context, the instance index relative to the currently targeted graph
- Return
a path representing the path of the graph target primitive.
-
long int (*getStageId)(const GraphContextObj &contextObj)