Graph

class omni.graph.core.Graph

Bases: pybind11_object

Object containing everything necessary to execute a connected set of nodes.

Methods

__init__(*args, **kwargs)

change_pipeline_stage(self, newPipelineStage)

Change the pipeline stage that this graph is in (simulation, pre-render, post-render, on-demand)

create_graph_as_node(self, name, path, ...)

Creates a graph that is wrapped by a node in the current graph.

create_node(self, path, node_type, use_usd)

Given the path to the node and the type of the node, creates a node of that type at that path.

create_subgraph(self, subgraphPath[, ...])

Given the path to the subgraph, create the subgraph at that path.

create_variable(self, name, type)

Creates a variable on the graph.

deregister_error_status_change_callback(...)

De-registers the error status change callback to be invoked when the error status of nodes change during evaluation.

destroy_node(self, node_path, update_usd)

Given the path to the node, destroys the node at that path.

evaluate(self)

Tick the graph by causing it to evaluate.

find_variable(self, name)

Find the variable with the given name in the graph.

get_context(self)

Gets the context associated to the graph

get_default_graph_context(self)

Gets the default context associated with this graph

get_evaluator_name(self)

Gets the name of the evaluator being used on this graph

get_event_stream(self)

Get the event stream the graph uses for notification of changes.

get_graph_backing_type(self)

Gets the data type backing this graph

get_handle(self)

Gets a unique handle identifier for this graph

get_instance_count(self)

Gets the number of instances this graph has

get_node(self, path)

Given a path to the node, returns the object for the node.

get_nodes(self)

Gets the list of nodes currently in this graph

get_owning_compound_node(self)

Returns the compound node for which this graph is the compound subgraph of.

get_parent_graph(self)

Gets the immediate parent graph of this graph

get_path_to_graph(self)

Gets the path to this graph

get_pipeline_stage(self)

Gets the pipeline stage to which this graph belongs

get_subgraph(self, path)

Gets the subgraph living at the given path below this graph

get_subgraphs(self)

Gets the list of subgraphs under this graph

get_variables(self)

Returns the list of variables defined on the graph.

inspect(self, inspector)

Runs the inspector on the graph

is_auto_instanced(self)

Returns whether this graph is an auto instance or not.

is_compound_graph(self)

Returns whether this graph is a compound graph.

is_disabled(self)

Checks to see if the graph is disabled

is_valid(self)

Checks to see if the graph object is valid

register_error_status_change_callback(self, ...)

Registers a callback to be invoked after graph evaluation for all the nodes whose error status changed during the evaluation.

reload_from_stage(self)

Force the graph to reload by deleting it and re-parsing from the stage.

reload_settings(self)

Reload the graph settings.

remove_variable(self, variable)

Removes the given variable from the graph.

rename_node(self, path, new_path)

Given the path to the node, renames the node at that path.

rename_subgraph(self, path, new_path)

Renames the path of a subgraph

set_auto_instancing_allowed(self, arg0)

Allows (or not) this graph to be an auto-instance, ie.

set_disabled(self, disable)

Sets whether this graph object is to be disabled or not.

set_prim_view(self, view)

Apply a view to a graph: a view is a way to dynamically maintain a list of instances for a graph.

set_usd_notice_handling_enabled(self, enable)

Sets whether this graph object has USD notice handling enabled.

usd_notice_handling_enabled(self)

Checks whether this graph has USD notice handling enabled.

Attributes

CURRENT_FILE_FORMAT_VERSION

evaluation_mode

The evaluation mode sets how the graph will be evaluated.

__init__(*args, **kwargs)
change_pipeline_stage(self: omni.graph.core._omni_graph_core.Graph, newPipelineStage: omni.graph.core._omni_graph_core.GraphPipelineStage) None

Change the pipeline stage that this graph is in (simulation, pre-render, post-render, on-demand)

Parameters

newPipelineStage (omni.graph.core.GraphPipelineStage) – The new pipeline stage of the graph

create_graph_as_node(self: omni.graph.core._omni_graph_core.Graph, name: str, path: str, evaluator: str, is_global_graph: bool, is_backed_by_usd: bool, backing_type: omni.graph.core._omni_graph_core.GraphBackingType, pipeline_stage: omni.graph.core._omni_graph_core.GraphPipelineStage, evaluation_mode: omni.graph.core._omni_graph_core.GraphEvaluationMode = <GraphEvaluationMode.GRAPH_EVALUATION_MODE_AUTOMATIC: 0>) omni.graph.core._omni_graph_core.Node

Creates a graph that is wrapped by a node in the current graph.

Parameters
  • name (str) – The name of the node

  • path (str) – The path to the graph

  • evaluator (str) – The name of the evaluator to use for the graph

  • is_global_graph (bool) – Whether this is a global graph

  • is_backed_by_usd (bool) – Whether the constructs are to be backed by USD

  • backing_type (omni.graph.core.GraphBackingType) – The kind of cache backing this graph

  • pipeline_stage (omni.graph.core.GraphPipelineStage) – What stage in the pipeline the global graph is at (simulation, pre-render, post-render)

  • evaluation_mode (omni.graph.core.GraphEvaluationMode) – What mode to use when evaluating the graph

Returns

Node wrapping the graph that was created

Return type

omni.graph.core.Node

create_node(self: omni.graph.core._omni_graph_core.Graph, path: str, node_type: str, use_usd: bool) omni.graph.core._omni_graph_core.Node

Given the path to the node and the type of the node, creates a node of that type at that path.

Parameters
  • path (str) – The path to the node

  • node_type (str) – The type of the node

  • use_usd (bool) – Whether or not to create the USD backing for the node

Returns

The newly created node

Return type

omni.graph.core.Node

create_subgraph(self: omni.graph.core._omni_graph_core.Graph, subgraphPath: str, evaluator: str = '', createUsd: bool = True) omni.graph.core._omni_graph_core.Graph

Given the path to the subgraph, create the subgraph at that path.

Parameters
  • subgraphPath (str) – The path to the subgraph

  • evaluator (str) – The evaluator type

  • createUsd (bool) – Whether or not to create the USD backing for the node

Returns

Subgraph object created for the given path.

Return type

omni.graph.core.Graph

create_variable(self: omni.graph.core._omni_graph_core.Graph, name: str, type: omni::graph::core::Py_Type) omni.graph.core._omni_graph_core.IVariable

Creates a variable on the graph.

Parameters
  • name (str) – The name of the variable

  • type (omni.graph.core.Type) – The type of the variable to create.

Returns

A reference to the newly created variable, or None if the variable could not be created.

Return type

omni.graph.core.IVariable

deregister_error_status_change_callback(self: omni.graph.core._omni_graph_core.Graph, status_change_handle: int) None

De-registers the error status change callback to be invoked when the error status of nodes change during evaluation.

Parameters

status_change_handle (int) – The handle that was returned during the register_error_status_change_callback call

destroy_node(self: omni.graph.core._omni_graph_core.Graph, node_path: str, update_usd: bool) bool

Given the path to the node, destroys the node at that path.

Parameters
  • node_path (str) – The path to the node

  • update_usd (bool) – Whether or not to destroy the USD backing for the node

Returns

True if the node was successfully destroyed

Return type

bool

evaluate(self: omni.graph.core._omni_graph_core.Graph) None

Tick the graph by causing it to evaluate.

find_variable(self: omni.graph.core._omni_graph_core.Graph, name: str) omni.graph.core._omni_graph_core.IVariable

Find the variable with the given name in the graph.

Parameters

name (str) – The name of the variable to find.

Returns

The variable with the given name, or None if not found.

Return type

omni.graph.core.IVariable | None

get_context(self: omni.graph.core._omni_graph_core.Graph) omni::graph::core::Py_GraphContext

Gets the context associated to the graph

Returns

The context associated to the graph

Return type

omni.graph.core.GraphContext

get_default_graph_context(self: omni.graph.core._omni_graph_core.Graph) omni::graph::core::Py_GraphContext

Gets the default context associated with this graph

Returns

The default graph context associated with this graph.

Return type

omni.graph.core.GraphContext

get_evaluator_name(self: omni.graph.core._omni_graph_core.Graph) str

Gets the name of the evaluator being used on this graph

Returns

The name of the graph evaluator (dirty_push, push, execution)

Return type

str

get_event_stream(self: omni.graph.core._omni_graph_core.Graph) carb.events._events.IEventStream

Get the event stream the graph uses for notification of changes.

Returns

Event stream to monitor for graph changes

Return type

carb.events.IEventStream

get_graph_backing_type(self: omni.graph.core._omni_graph_core.Graph) omni.graph.core._omni_graph_core.GraphBackingType

Gets the data type backing this graph

Returns

Returns the type of data structure backing this graph

Return type

omni.graph.core.GraphBackingType

get_handle(self: omni.graph.core._omni_graph_core.Graph) int

Gets a unique handle identifier for this graph

Returns

Unique handle identifier for this graph

Return type

int

get_instance_count(self: omni.graph.core._omni_graph_core.Graph) int

Gets the number of instances this graph has

Returns

The number of instances the graph has (0 if the graph is standalone).

Return type

int

get_node(self: omni.graph.core._omni_graph_core.Graph, path: str) omni.graph.core._omni_graph_core.Node

Given a path to the node, returns the object for the node.

Parameters

path (str) – The path to the node

Returns

Node object for the given path, None if it does not exist

Return type

omni.graph.core.Node

get_nodes(self: omni.graph.core._omni_graph_core.Graph) List[omni.graph.core._omni_graph_core.Node]

Gets the list of nodes currently in this graph

Returns

The nodes in this graph.

Return type

list[omni.graph.core.Node]

get_owning_compound_node(self: omni.graph.core._omni_graph_core.Graph) omni.graph.core._omni_graph_core.Node

Returns the compound node for which this graph is the compound subgraph of.

Returns

(og.Node) If this graph is a compound graph, the owning compound node. Otherwise, this an invalid node is returned.

get_parent_graph(self: omni.graph.core._omni_graph_core.Graph) object

Gets the immediate parent graph of this graph

Returns

The immediate parent graph of this graph (may be None)

Return type

omni.graph.core.Graph | None

get_path_to_graph(self: omni.graph.core._omni_graph_core.Graph) str

Gets the path to this graph

Returns

The path to this graph (may be empty).

Return type

str

get_pipeline_stage(self: omni.graph.core._omni_graph_core.Graph) omni.graph.core._omni_graph_core.GraphPipelineStage

Gets the pipeline stage to which this graph belongs

Returns

The type of pipeline stage of this graph (simulation, pre-render, post-render)

Return type

omni.graph.core.PipelineStage

get_subgraph(self: omni.graph.core._omni_graph_core.Graph, path: str) omni.graph.core._omni_graph_core.Graph

Gets the subgraph living at the given path below this graph

Parameters

path (str) – Path to the subgraph to find

Returns

Subgraph at the path, or None if not found

Return type

omni.graph.core.Graph | None

get_subgraphs(self: omni.graph.core._omni_graph_core.Graph) List[omni.graph.core._omni_graph_core.Graph]

Gets the list of subgraphs under this graph

Returns

List of graphs that are subgraphs of this graph

Return type

list[omni.graph.core.Graph]

get_variables(self: omni.graph.core._omni_graph_core.Graph) List[omni.graph.core._omni_graph_core.IVariable]

Returns the list of variables defined on the graph.

Returns

The current list of variables on the graph.

Return type

list[omni.graph.core.IVariable]

inspect(self: omni.graph.core._omni_graph_core.Graph, inspector: omni::core::Api<omni::inspect::IInspector_abi>) bool

Runs the inspector on the graph

Parameters

inspector (omni.inspect.Inspector) – The inspector to run

Returns

True if the inspector was successfully run on the graph, False if it is not supported

Return type

bool

is_auto_instanced(self: omni.graph.core._omni_graph_core.Graph) bool

Returns whether this graph is an auto instance or not. An auto instance is a graph that got merged as an instance with all other similar graphs in the stage.

Returns

True if this graph is an auto instance

Return type

bool

is_compound_graph(self: omni.graph.core._omni_graph_core.Graph) bool

Returns whether this graph is a compound graph. A compound graph is subgraph that controlled by a compound node.

Returns

True if this graph is a compound graph

Return type

bool

is_disabled(self: omni.graph.core._omni_graph_core.Graph) bool

Checks to see if the graph is disabled

Returns

True if this graph object is disabled.

Return type

bool

is_valid(self: omni.graph.core._omni_graph_core.Graph) bool

Checks to see if the graph object is valid

Returns

True if this graph object is valid.

Return type

bool

register_error_status_change_callback(self: omni.graph.core._omni_graph_core.Graph, callback: object) int

Registers a callback to be invoked after graph evaluation for all the nodes whose error status changed during the evaluation. The callback receives a list of the nodes whose error status changed.

Parameters

callback (callable) – The callback function

Returns

A handle that can be used for deregistration. Note the calling module is responsible for deregistration of the callback in all circumstances, including where the extension is hot-reloaded.

Return type

int

reload_from_stage(self: omni.graph.core._omni_graph_core.Graph) None

Force the graph to reload by deleting it and re-parsing from the stage.

This is potentially destructive if you have internal state information in any nodes.

reload_settings(self: omni.graph.core._omni_graph_core.Graph) None

Reload the graph settings.

remove_variable(self: omni.graph.core._omni_graph_core.Graph, variable: omni.graph.core._omni_graph_core.IVariable) bool

Removes the given variable from the graph.

Parameters

variable (omni.graph.core.IVariable) – The variable to remove.

Returns

True if the variable was successfully removed, False otherwise.

Return type

bool

rename_node(self: omni.graph.core._omni_graph_core.Graph, path: str, new_path: str) bool

Given the path to the node, renames the node at that path.

Parameters
  • path (str) – The path to the node

  • new_path (str) – The new path

Returns

True if the node was successfully renamed

Return type

bool

rename_subgraph(self: omni.graph.core._omni_graph_core.Graph, path: str, new_path: str) bool

Renames the path of a subgraph

Parameters
  • path (str) – Path to the subgraph being renamed

  • new_path (str) – New path for the subgraph

set_auto_instancing_allowed(self: omni.graph.core._omni_graph_core.Graph, arg0: bool) bool

Allows (or not) this graph to be an auto-instance, ie. to be executed vectorized as an instance amongst all other identical graph

Parameters

allowed (bool) – Whether this graph is allowed to be an auto instance.

Returns

Whether this graph was allowed to be an auto instance before this call.

Return type

bool

set_disabled(self: omni.graph.core._omni_graph_core.Graph, disable: bool) None

Sets whether this graph object is to be disabled or not.

Parameters

disable (bool) – True if the graph is to be disabled

set_prim_view(self: omni.graph.core._omni_graph_core.Graph, view: omni.graph.core._omni_graph_core.IPrimView) bool

Apply a view to a graph: a view is a way to dynamically maintain a list of instances for a graph.

Parameters

view (IPrimViewPtr) – The view to apply to that graph

Returns

whether or not the view has been successfully applied to the graph.

Return type

bool

set_usd_notice_handling_enabled(self: omni.graph.core._omni_graph_core.Graph, enable: bool) None

Sets whether this graph object has USD notice handling enabled.

Parameters

enable (bool) – True to enable USD notice handling, False to disable.

usd_notice_handling_enabled(self: omni.graph.core._omni_graph_core.Graph) bool

Checks whether this graph has USD notice handling enabled.

Returns

True if USD notice handling is enabled on this graph.

Return type

bool

property evaluation_mode

The evaluation mode sets how the graph will be evaluated.

GRAPH_EVALUATION_MODE_AUTOMATIC - Evaluate the graph in Standalone mode when there are no relationships to it, otherwise it will be evaluated in Instanced mode.

GRAPH_EVALUATION_MODE_STANDALONE - Evaluates the graph with the graph Prim as the graph target, and ignore Prims with relationships to the graph Prim. Use this mode when constructing self-contained graphs that evaluate independently.

GRAPH_EVALUATION_MODE_INSTANCED - Evaluates only when the graph there are relationships from OmniGraphAPI interfaces. Each Prim with a relationship to the graph Prim will cause an evaluation, with the Graph Target set to path of Prim with the OmniGraphAPI interface. Use this mode when the graph represents as an asset or template that can be applied to multiple Prims.

Type

omni.graph.core.GraphEvaluationMode