Action Graph
This extension is a collection of functionality required for OmniGraph Action Graphs.
For a hands-on introduction to OmniGraph Action Graphs see Action Graph Quickstart
For more comprehensive and thorough documentation on various OmniGraph features see OGN User Guide
Action Graphs are comprised of any number of separate chains of nodes, like deformer graphs. However there are important differences which make Action graphs more suited to particular applications.
Event Sources
Action graphs are event driven, which means that each chain of nodes must start with an Event Source node. Each event source node can be thought of as an entry point of the graph.
Event Source nodes are named with an On prefix, they never have an execution input attribute, and always have at least one output execution attribute.
Many event nodes don’t need to compute every update. If that’s the case it is more efficient if the system can skip them
until they are ready. For example On Keyboard Input doesn’t need to
compute until a key press has been detected. These nodes can use the compute-on-request
OGN scheduling hint in
combination with omni.graph.core.Node.request_compute()
.
"scheduling": ["compute-on-request"]
See Scheduling Hints for OG Nodes for more details about scheduling hints generally.
Event Source Nodes |
---|
Execution Attributes
Action graphs make use of execution-type attributes.
The execution evaluator works by following execution connections downstream and computing nodes it encounters until there are no more downstream connections to follow. The entire chain is executed to completion. When there is no downstream node the execution terminates and the next node is popped off the execution stack
Note that if there is more than one downstream connection from an execution attribute, each path will be followed in an undetermined order. Multiple downstream chains can be executed in a fixed order either by chaining the end of one to the start of the other, or by using the Sequence node.
Flow Control
Many Action graphs will need to do different things depending on some state. In a python script you would use an if or while loop to accomplish this. Similarly in Action graph there are nodes which provide this branching functionality. Flow control nodes have more than one execution output attribute, which is used to branch the evaluation flow.
Flow Control Nodes |
---|
Latent Nodes (Computing over Time)
For some graphs it’s useful to have a node that does its work over several update cycles. In other words, when that node is reached in the graph the node does not need to complete what it is doing right away. For example a node that downloads a file may take a few seconds. One way to accomplish this is to arrange for a node to be ticked
every update so that it can start the download and then check for completion on subsequent computes.
However it’s also possible to put the node into a Latent
state in Action Graph. This allows the node to suspend the graph evaluation until it completes. An example of such a node is Delay, which suspends evaluation for some number of seconds. Note that if the event node triggers while the evaluation is suspended by a latent node, it will interrupt it. For example if a key press triggers a Delay node, if the key press subsequently triggers again it will effectively reset the delay.
Build Your Own
You can use the OmniGraph python or C++ APIs to implement your own nodes that are usable in Action graphs. The features that are particular to Action Graph are accessed in C++ through the omni::graph::action::IActionGraph_abi
interface. In Python the bindings
are available in omni.graph.action.IActionGraph
. Learn more about building your own Action Graph nodes in the Action Graph Code Samples - Python or Action Code Samples - C++.
Convert Legacy Nodes
Converting Action Graph Nodes to IActionGraph explains what might need to change in older node implementations.