OmniGraph Commands
==================

Like other extensions, the OmniGraph extensions expose undoable functionality through some basic commands. A lot
of the functionality of the commands can be accessed from the *og.Controller* object, described above.

OmniGraph has created a shortcut to allow more natural expression of command execution. The raw method of executing a
command is something like this:

.. code-block:: python

    import omni.graph.core as og
    graph = og.get_graph_by_path("/World/PushGraph")
    omni.kit.commands.execute("CreateNode", graph=graph, node_path="/World/PushGraph/TestSingleton", node_type="omni.graph.examples.python.TestSingleton", create_usd=True)

The abbreviated method, using the constructed *cmds* object looks like this:

.. code-block:: python

    import omni.graph.core as og
    graph = og.get_graph_by_path("/World/PushGraph")
    cmds.CreateNode(graph=graph, node_path="/World/PushGraph/TestSingleton", node_type="omni.graph.examples.python.TestSingleton", create_usd=True)

However for most operations you would use the controller class, which is a single line:

.. code-block:: python

    import omni.graph.core as og
    og.Controller.edit("/World/PushGraph", {
        og.Controller.Keys.CREATE_NODES: ("TestSingleton", "omni.graph.examples.python.TestSingleton")
    })

.. tip::

    Running the Python command *help(omni.graph.core.cmds)* in the script editor will give you a description of
    all available commands.
