Action Graph Quickstart

Getting Started

The following are step by step instructions to set up an Action Graph which moves a shape in response to a keyboard press event.

  1. Ensure that the following extension bundle is loaded: omni.graph.bundle.action

  2. Drop down a Torus by clicking on Create -> Mesh -> Torus, it will be named “Torus”

  3. Open up the graph editor UI by clicking on Window -> Visual Scripting -> Action Graph

  4. In the new window, click on New Action Graph to create an empty action graph at the default path

  5. Drop down an On Keyboard Input node. This can be done using the search box on the left.

  6. Drop down a Write Prim Attribute node, and a Constant Vec3d node.

  7. Expand all the nodes to the 3rd level of detail. This can be done using the lod3icon button on the editor toolbar.

  8. Wire constant_vec3d.outputs:value -> write_prim_attribute.inputs:value

  9. Wire on_keyboard_input.outputs:pressed -> write_prim_attribute.inputs:execIn

../../_images/ext_omnigraph_quickstart_02.png
  1. Select on_keyboard_input and set Key In to J using the Property window

  2. Select write_prim_attribute, toggle on the Use Path checkbox, and set Prim Path to /World/Torus

  3. Select write_prim_attribute and set Attribute Name to xformOp:translate

../../_images/ext_omnigraph_quickstart_03.png

Finally, click on the Play button on the far left side. Move the torus away from the origin using the viewport. Now press the J key. Notice that the torus will snap back to the origin.

Congratulations! You have executed your first Action network. Lets look at how it works.

Action Graph Evaluation

  • The execution evaluator works by following execution connections downstream and computing nodes it encounters until there are no more downstream connections to follow.

  • on_keyboard_input is an event-source node. It will be listening for the indicated key J pressed event. When the key is pressed the outputs:pressed attribute will be enabled.

  • The next time the network is evaluated it will execute the network downstream from outputs:pressed attribute, which is write_prim_attribute.

  • Before write_prim_attribute can be computed, the evaluator will evaluate its upstream data-dependencies, which is constant_vec3d.

  • Finally write_prim_attribute is computed, which sets Torus.xformOp:translate to (0, 0, 0)

Flip Flop Flow Control

Let’s make this network a little more interesting by having the key event cycle the location of the Torus. Flip Flop is a node which alternates activating one of 2 downstream networks each time it is computed. We can use this to provide the cycling behavior.

../../_images/ext_omnigraph_quickstart_04.gif
  1. Duplicate constant_vec3d and write_prim_attribute. You can do this by marquee-selecting those 2 nodes, and pressing Ctrl-D. Note that the duplicated nodes may be stacked on top of the old nodes, so you will have to move the nodes off of the stack.

  2. Drop down a Flip Flop node

  3. Select constant_vec3d_01 and set inputs:y to 250.0 using the Property window

../../_images/ext_omnigraph_quickstart_05.png
  1. Wire up the nodes like so. Note that you can cut any extra connections by right clicking on the connected port.

../../_images/ext_omnigraph_quickstart_06.png

Now when you press J the torus will jump between (0, 0, 0) and (0, 250.0, 0) (assuming the play button is still in effect)

Common Problems and Caveats

  • The Property window doesn’t show any values for intermediate nodes.

    • The OmniGraph Settings window in the OmniGraph menu has an option Update Terminal Nodes Only, which if disabled, will cause intermediate outputs to be visible to the window.

  • The editor won’t let you connect to a node input due to incompatible types

    • Try totally disconnecting the target node and re-connecting. When extended types are resolved the node has to be disconnected in order to reset the types.

  • The Property window shows “token” as the type of attributes instead of the actual type and what are all these “__resolved” attributes?

    • For nodes with extended-attributes it will show such attributes like “__resolved_outputs:tuple”. The widget is faithfully showing the underlying implementation in the file, however in future we will provide a cleaner interface for extended-type attributes so that values and types can be inspected.

  • It’s set up correctly but isn’t working

    • Check the Console panel for error or warning messages

    • Try saving and reloading the scene

    • Ensure that the extensions listed in step 1 are loaded.

  • What about subgraphs with different evaluation? (push, pull, dirty_push)

    • An action subgraph in an action graph will work as a way to organize nodes but has no further semantics

    • You can add a push subgraph to an action/execution graph, and visa-versa. The system will tick each graph, but connections between them are not supported at this point. You can instead use shared data to communicate between the two graphs. For example a prim attribute.