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”, at path /World/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. Drag and drop Torus from the Stage window onto the Action Graph editor, a dialog will appear with three choices. Choose Write Attribute, this will create a Write Prim Attribute node to read an attribute from the /World/Torus Prim.

  7. Drop down a Constant Double3 node.

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

  9. Wire constant_double3.outputs:value -> TorusWriteAttrib.inputs:value

  10. Wire on_keyboard_input.outputs:pressed -> TorusWriteAttrib.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 TorusWriteAttrib, toggle on the Use Path checkbox, and set Prim Path to /World/Torus

  3. Select TorusWriteAttrib 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 TorusWriteAttrib.

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

  • Finally TorusWriteAttrib 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_double3 and TorusWriteAttrib. 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_double3_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

  • 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.

  • 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.