Node

class omni.graph.core.Node

Bases: pybind11_object

An element of execution within a graph, containing attributes and connected to other nodes

Methods

__init__(*args, **kwargs)

clear_old_compute_messages(self)

Clears all compute messages logged for the node prior to its most recent evaluation.

create_attribute(self, attributeName, ...)

Creates an attribute with the specified name, type, and port type and returns success state.

deregister_on_connected_callback(self, callback)

De-registers the on_connected callback to be invoked when attributes connect.

deregister_on_disconnected_callback(self, ...)

De-registers the on_disconnected callback to be invoked when attributes disconnect.

deregister_on_path_changed_callback(self, ...)

Deregisters the on_path_changed callback to be invoked when anything changes in the stage.

get_attribute(self, name)

Given the name of an attribute returns an attribute object to it.

get_attribute_exists(self, name)

Given an attribute name, returns whether this attribute exists or not.

get_attributes(self)

Returns the list of attributes on this node.

get_backing_bucket_id(self)

This method was internal, and is now obsolete: it does not function anymore.

get_compound_graph_instance(self)

Returns a handle to the associated sub-graph, if the given node is a compound node.

get_compute_count(self)

Returns the number of instances on which this node's computation has been invoked.

get_compute_messages(self, severity)

Returns a list of the compute messages currently logged for the node at a specific severity.

get_compute_vectorized_count(self)

Returns the number of vectorized segments on which this node's computation has been invoked.

get_event_stream(self)

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

get_graph(self)

Get the graph to which this node belongs

get_graph_instance_id(self[, instance])

param instance

an index that identify the graph instance for which a unique ID is requested

get_handle(self)

Get an opaque handle to the node

get_node_type(self)

Gets the node type of this node

get_prim_path(self)

Returns the path to the prim currently backing the node.

get_type_name(self)

Get the node type name

get_wrapped_graph(self)

Get the graph wrapped by this node

increment_compute_count(self)

Increments the node's compute counter.

is_backed_by_usd(self)

Check if the node is back by USD or not

is_compound_node(self)

Returns whether this node is a compound node.

is_disabled(self)

Check if the node is currently disabled

is_valid(self)

Check the validity of the node

log_compute_message(self, severity, message)

Logs a compute message of a given severity for the node.

node_id(self)

Returns a unique identifier value for this node.

register_on_connected_callback(self, callback)

Registers a callback to be invoked when the node has attributes connected.

register_on_disconnected_callback(self, callback)

Registers a callback to be invoked when the node has attributes disconnected.

register_on_path_changed_callback(self, callback)

Registers a callback to be invoked when a path changes in the stage.

remove_attribute(self, attributeName)

Removes an attribute with the specified name and type and returns success state.

request_compute(self)

Requests a compute of this node

resolve_coupled_attributes(self, attributesArray)

Resolves attribute types given a set of attributes which are fully type coupled.

resolve_partially_coupled_attributes(self, ...)

Resolves attribute types given a set of attributes, that can have differing tuple counts and/or array depth, and differing but convertible base data type.

set_compute_incomplete(self)

Informs the system that compute is incomplete for this frame.

set_disabled(self, disabled)

Sets whether the node is disabled or not.

__init__(*args, **kwargs)
clear_old_compute_messages(self: omni.graph.core._omni_graph_core.Node) int

Clears all compute messages logged for the node prior to its most recent evaluation. Messages logged during the most recent evaluation remain untouched.

Normally this will be called during graph evaluation so it is of little use unless you’re writing your own evaluation manager.

Returns

The number of messages that were deleted.

Return type

int

create_attribute(self: omni.graph.core._omni_graph_core.Node, attributeName: str, attributeType: omni::graph::core::Py_Type, portType: omni.graph.core._omni_graph_core.AttributePortType = <AttributePortType.ATTRIBUTE_PORT_TYPE_INPUT: 0>, value: object = None, extendedType: omni.graph.core._omni_graph_core.ExtendedAttributeType = <ExtendedAttributeType.EXTENDED_ATTR_TYPE_REGULAR: 0>, unionTypes: str = '') bool

Creates an attribute with the specified name, type, and port type and returns success state.

Parameters
  • attributeName (str) – Name of the attribute.

  • attributeType (omni.graph.core.Type) – Type of the attribute.

  • portType (omni.graph.core.AttributePortType) – The port type of the attribute, defaults to omni.graph.core.AttributePortType.ATTRIBUTE_PORT_TYPE_INPUT

  • value (Any) – The initial value to set on the attribute, default is None

  • extendedType (omni.graph.core.ExtendedAttributeType) – The extended type of the attribute, defaults to omni.graph.core.ExtendedAttributeType.EXTENDED_ATTR_TYPE_REGULAR

  • unionTypes (str) – Comma-separated list of union types if the extended type is omni.graph.core.ExtendedAttributeType.EXTENDED_ATTR_TYPE_UNION, defaults to empty string for non-union types.

Returns

True if the creation was successful, else False

Return type

bool

deregister_on_connected_callback(self: omni.graph.core._omni_graph_core.Node, callback: int) None

De-registers the on_connected callback to be invoked when attributes connect.

Parameters

callback (callable) – The handle that was returned during the register_on_connected_callback call

deregister_on_disconnected_callback(self: omni.graph.core._omni_graph_core.Node, callback: int) None

De-registers the on_disconnected callback to be invoked when attributes disconnect.

Parameters

callback (callable) – The handle that was returned during the register_on_disconnected_callback call

deregister_on_path_changed_callback(self: omni.graph.core._omni_graph_core.Node, callback: int) None

Deregisters the on_path_changed callback to be invoked when anything changes in the stage. [DEPRECATED]

Parameters

callback (callable) – The handle that was returned during the register_on_path_changed_callback call

get_attribute(self: omni.graph.core._omni_graph_core.Node, name: str) omni.graph.core._omni_graph_core.Attribute

Given the name of an attribute returns an attribute object to it.

Parameters

name (str) – The name of the attribute

Returns

Attribute with the given name, or None if it does not exist on the node

Return type

omni.graph.core.Attribute

get_attribute_exists(self: omni.graph.core._omni_graph_core.Node, name: str) bool

Given an attribute name, returns whether this attribute exists or not.

Parameters

name (str) – The name of the attribute

Returns

True if the attribute exists on this node, else False

Return type

bool

get_attributes(self: omni.graph.core._omni_graph_core.Node) List[omni.graph.core._omni_graph_core.Attribute]

Returns the list of attributes on this node.

get_backing_bucket_id(self: omni.graph.core._omni_graph_core.Node) omni::fabric::BucketId

This method was internal, and is now obsolete: it does not function anymore. In order to write back to USD, you can directly use the USD API.

get_compound_graph_instance(self: omni.graph.core._omni_graph_core.Node) omni::graph::core::Py_Graph

Returns a handle to the associated sub-graph, if the given node is a compound node.

Returns

The subgraph

Return type

omni.graph.core.Graph

get_compute_count(self: omni.graph.core._omni_graph_core.Node) int

Returns the number of instances on which this node’s computation has been invoked. The counter has a limited range and will eventually roll over to 0, so a higher count cannot be assumed to represent a more recent compute than an older one.

Returns

Number of instances this node’s computation has been invoked since the counter last rolled over to 0.

Return type

int

get_compute_messages(self: omni.graph.core._omni_graph_core.Node, severity: omni::graph::core::ogn::Severity) List[str]

Returns a list of the compute messages currently logged for the node at a specific severity.

Parameters

severity (omni.graph.core.Severity) – Severity level of the message.

Returns

The list of messages, may be empty.

Return type

list[str]

get_compute_vectorized_count(self: omni.graph.core._omni_graph_core.Node) int

Returns the number of vectorized segments on which this node’s computation has been invoked. The counter has a limited range and will eventually roll over to 0, so a higher count cannot be assumed to represent a more recent compute than an older one.

Returns

Number of vectorized segments on which this node’s computation has been invoked since the counter last rolled over to 0.

Return type

int

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

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

Returns

Event stream to monitor for node changes

Return type

carb.events.IEventStream

get_graph(self: omni.graph.core._omni_graph_core.Node) omni::graph::core::Py_Graph

Get the graph to which this node belongs

Returns

Graph associated with the current node. The returned graph will be invalid if the node is not valid.

Return type

omni.graph.core.Graph

get_graph_instance_id(self: omni.graph.core._omni_graph_core.Node, instance: int = 18446744073709551614) str
Parameters
  • instance (int) – an index that identify the graph instance for which a unique ID is requested

  • instantiated (Be aware that even if not) –

  • graph (the authoring) –

Returns

A unique name that identifies the graph for the requested index.

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

Get an opaque handle to the node

Returns

a unique handle to the node

Return type

int

get_node_type(self: omni.graph.core._omni_graph_core.Node) omni::graph::core::Py_NodeType

Gets the node type of this node

Returns

The node type from which this node was created.

Return type

omni.graph.core.NodeType

get_prim_path(self: omni.graph.core._omni_graph_core.Node) str

Returns the path to the prim currently backing the node.

get_type_name(self: omni.graph.core._omni_graph_core.Node) str

Get the node type name

Returns

The type name of the node.

Return type

str

get_wrapped_graph(self: omni.graph.core._omni_graph_core.Node) omni::graph::core::Py_Graph

Get the graph wrapped by this node

Returns

The graph wrapped by the current node, if any. The returned graph will be invalid if the node does not wrap a graph or is invalid.

Return type

omni.graph.core.Graph

increment_compute_count(self: omni.graph.core._omni_graph_core.Node) int

Increments the node’s compute counter. This method is provided primarily for debugging and experimental uses and should not normally be used by end-users.

Returns

The new compute counter. This may be zero if the counter has just rolled over.

Return type

int

is_backed_by_usd(self: omni.graph.core._omni_graph_core.Node) bool

Check if the node is back by USD or not

Returns

True if the current node is by an USD prim on the stage.

Return type

bool

is_compound_node(self: omni.graph.core._omni_graph_core.Node) bool

Returns whether this node is a compound node. A compound node is a node that has a node type that is defined by an OmniGraph.

Returns

True if this node is a compound node, False otherwise.

Return type

bool

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

Check if the node is currently disabled

Returns

True if the node is disabled.

Return type

bool

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

Check the validity of the node

Returns

True if the node is valid.

Return type

bool

log_compute_message(self: omni.graph.core._omni_graph_core.Node, severity: omni::graph::core::ogn::Severity, message: str) bool

Logs a compute message of a given severity for the node.

This method is intended to be used from within the compute() method of a node to alert the user to any problems or issues with the node’s most recent evaluation. They are accumulated until the next successful evaluation at which point they are cleared.

If duplicate messages are logged, with the same severity level, only one is stored.

Parameters
Returns

True if the message has already been logged, else False

Return type

bool

node_id(self: omni.graph.core._omni_graph_core.Node) int

Returns a unique identifier value for this node.

Returns

Unique identifier value for the node - not persistent through file save and load

Return type

int

register_on_connected_callback(self: omni.graph.core._omni_graph_core.Node, callback: object) int

Registers a callback to be invoked when the node has attributes connected. The callback takes 2 parameters: the attributes from and attribute to of the connection.

Parameters

callback (callable) – The callback function

Returns

A handle that could be used for deregistration.

Return type

int

register_on_disconnected_callback(self: omni.graph.core._omni_graph_core.Node, callback: object) int

Registers a callback to be invoked when the node has attributes disconnected. The callback takes 2 parameters: the attributes from and attribute to of the disconnection.

Parameters

callback (callable) – The callback function

Returns

A handle identifying the callback that can be used for deregistration.

register_on_path_changed_callback(self: omni.graph.core._omni_graph_core.Node, callback: object) int

Registers a callback to be invoked when a path changes in the stage. The callback takes 1 parameter: a list of the paths that were changed. [DEPRECATED]

Parameters

callback (callable) – The callback function

Returns

A handle identifying the callback that can be used for deregistration.

remove_attribute(self: omni.graph.core._omni_graph_core.Node, attributeName: str) bool

Removes an attribute with the specified name and type and returns success state.

Parameters

attributeName (str) – Name of the attribute.

Returns

True if the removal was successful, False if the attribute was not found

Return type

bool

request_compute(self: omni.graph.core._omni_graph_core.Node) bool

Requests a compute of this node

Returns

True if the request was successful, False if there was an error

Return type

bool

resolve_coupled_attributes(self: omni.graph.core._omni_graph_core.Node, attributesArray: List[omni.graph.core._omni_graph_core.Attribute]) bool

Resolves attribute types given a set of attributes which are fully type coupled. For example if node ‘Increment’ has one input attribute ‘a’ and one output attribute ‘b’ and the types of ‘a’ and ‘b’ should always match. If the input is resolved then this function will resolve the output to the same type. It will also take into consideration available conversions on the input size. The type of the first (resolved) provided attribute will be used to resolve others or select appropriate conversions

Note that input attribute types are never inferred from output attribute types.

This function should only be called from the INodeType function ‘on_connection_type_resolve’

Parameters

attributesArray (list[omni.graph.core.Attribute]) – Array of attributes to be resolved as a coupled group

Returns

True if successful, False otherwise, usually due to mismatched or missing resolved types

Return type

bool

resolve_partially_coupled_attributes(self: omni.graph.core._omni_graph_core.Node, attributesArray: List[omni.graph.core._omni_graph_core.Attribute], tuplesArray: list, arraySizesArray: list, rolesArray: List[omni::fabric::AttributeRole]) bool

Resolves attribute types given a set of attributes, that can have differing tuple counts and/or array depth, and differing but convertible base data type. The three input buffers are tied together, holding the attribute, the tuple count, and the array depth of the types to be coupled. This function will solve base type conversion by targeting the first provided type in the list, for all other ones that require it.

For example if node ‘makeTuple2’ has two input attributes ‘a’ and ‘b’ and one output ‘c’ and we want to resolve any float connection to the types ‘a’:float, ‘b’:float, ‘c’:float[2] (convertible base types and different tuple counts) then the input buffers would contain: attrsBuf = [a, b, c] tuplesBuf = [1, 1, 2] arrayDepthsBuf = [0, 0, 0] rolesBuf = [AttributeRole::eNone, AttributeRole::eNone, AttributeRole::eNone]

This is worth noting that ‘b’ could be of any type convertible to float. But since the first provided attribute is ‘a’, the type of ‘a’ will be used to propagate the type resolution.

Note that input attribute types are never inferred from output attribute types.

This function should only be called from the INodeType function ‘on_connection_type_resolve’

Parameters
  • attributesArray (list[omni.graph.core.Attribute]) – Array of attributes to be resolved as a coupled group

  • tuplesArray (list[int]) – Array of tuple count desired for each corresponding attribute. Any value of None indicates the found tuple count is to be used when resolving.

  • arraySizesArray (list[int]) – Array of array depth desired for each corresponding attribute. Any value of None indicates the found array depth is to be used when resolving.

  • rolesArray (list[omni.graph.core.AttributeRole]) – Array of role desired for each corresponding attribute. A value of AttributeRole::eUnknown indicates the found role is to be used when resolving.

Returns

True if successful, False otherwise, usually due to mismatched or missing resolved types

Return type

bool

set_compute_incomplete(self: omni.graph.core._omni_graph_core.Node) None

Informs the system that compute is incomplete for this frame. In lazy evaluation systems, this node will be scheduled on the next frame since it still has more work to do.

set_disabled(self: omni.graph.core._omni_graph_core.Node, disabled: bool) None

Sets whether the node is disabled or not.

Parameters

disabled (bool) – True for disabled, False for not.