Database

class omni.graph.core.Database(node: omni.graph.core._omni_graph_core.Node, context_helper: Optional[Any] = None)

Bases: object

Base class for the generated database class for .ogn nodes (Python and C++ implementations)

Defines some common functionality that is the same for nodes of all types, to help cut down on the amount of redundant generated code.

Like the C++ equivalent, you can access the ABI data types normally passed to the compute as:

db.abi_node db.abi_context

Derived classes will have these class member variables instantiated, which are manipulated here in order to keep the amount of generated code to a minimum:

  • INTERFACE: Attribute interface definition - things that don’t change between nodes of the same type

  • PER_NODE_DATA: Dictionary for data that is different on every node of the same type.

Methods

__init__(node[, context_helper])

Initialize the helper classes for roles and sizes - attribute values are defined in the derived classes

dynamic_attribute_data(node, port_type)

Returns the dynamic attribute data class stored on each node for a given port type

get_metadata(metadata_key[, attribute])

Get metadata related to this node.

get_variable(name)

Get the value of a variable with a given name.

log_error(message[, add_context])

Log an error message from a compute method, for when the compute data is inconsistent or unexpected

log_info(message)

Log an information message from a compute method, when status information is required about the compute.

log_warn(message)

Log a warning message from a compute method, when the compute is consistent but produced no results.

log_warning(message)

Log a warning message from a compute method, when the compute is consistent but produced no results.

move(dst, src)

Deprecated function.

per_node_data(node)

Returns the per-node data for the given node

per_node_errors(node)

Returns the compute errors on the node, or [] if it does not exist

per_node_internal_state(node)

Returns the internal state information on the node, or None if it does not exist

set_dynamic_attribute_memory_location(on_gpu)

Set the memory location from which dynamic attribute values will be retrieved

set_variable(name, value)

Set the value of a variable.

Attributes

INTERFACE

PER_NODE_DATA

ROLE_BUNDLE

ROLE_COLOR

ROLE_EXECUTION

ROLE_FRAME

ROLE_MATRIX

ROLE_NORMAL

ROLE_OBJECT_ID

ROLE_PATH

ROLE_POINT

ROLE_QUATERNION

ROLE_TEXCOORD

ROLE_TIMECODE

ROLE_TRANSFORM

ROLE_VECTOR

abi_context

Returns the graph context to which this database belongs

abi_node

Returns the node to which this database belongs

internal_state

__init__(node: omni.graph.core._omni_graph_core.Node, context_helper: Optional[Any] = None)

Initialize the helper classes for roles and sizes - attribute values are defined in the derived classes

classmethod dynamic_attribute_data(node: omni.graph.core._omni_graph_core.Node, port_type: omni.graph.core._omni_graph_core.AttributePortType) omni.graph.core._impl.database.DynamicAttributeInterface

Returns the dynamic attribute data class stored on each node for a given port type

get_metadata(metadata_key: str, attribute: Optional[omni.graph.core._omni_graph_core.Attribute] = None) Optional[str]

Get metadata related to this node.

To get the metadata on the node type:

ui_name = db.get_metadata(ogn.MetadataKeys.UI_NAME)

To get the metadata from a specific attribute:

input_x_ui_name = db.get_metadata(ogn.MetadataKeys.UI_NAME, db.attribute.inputs.x)

Parameters
  • metadata_key – Name of the metadata value to return

  • attribute – Attribute on which the metadata lives. If None then look at the node type’s metadata

Returns

Metadata value string, or None if the named metadata key did not exist

get_variable(name: str)

Get the value of a variable with a given name. Returns None if the variable does not exist on the graph.

log_error(message: str, add_context: bool = True)

Log an error message from a compute method, for when the compute data is inconsistent or unexpected

log_info(message: str)

Log an information message from a compute method, when status information is required about the compute. Usually the compute will be successful, the information is for debugging or analysis.

log_warn(message: str)

Log a warning message from a compute method, when the compute is consistent but produced no results. This method is identical to log_warning; both exist because there are different conventions in other code about which name to use, so to avoid wasted developer time fixing unimportant incorrect guesses both are implemented.

log_warning(message: str)

Log a warning message from a compute method, when the compute is consistent but produced no results. This method is identical to log_warn; both exist because there are different conventions in other code about which name to use, so to avoid wasted developer time fixing unimportant incorrect guesses both are implemented.

move(dst: omni.graph.core._omni_graph_core.Attribute, src: omni.graph.core._omni_graph_core.Attribute)

Deprecated function. Will perform a copy instead of moving

classmethod per_node_data(node: omni.graph.core._omni_graph_core.Node) Dict[str, Any]

Returns the per-node data for the given node

Parameters

node – OmniGraph node for which the data is to be retrieved

Raises

og.OmniGraphError – If the per-node data is missing, most likely because the node is not initialized

classmethod per_node_errors(node: omni.graph.core._omni_graph_core.Node)

Returns the compute errors on the node, or [] if it does not exist

classmethod per_node_internal_state(node: omni.graph.core._omni_graph_core.Node)

Returns the internal state information on the node, or None if it does not exist

set_dynamic_attribute_memory_location(on_gpu: bool, gpu_ptr_kind: omni.graph.core._omni_graph_core.PtrToPtrKind = <PtrToPtrKind.NA: 0>)

Set the memory location from which dynamic attribute values will be retrieved

Parameters
  • on_gpu – If true the data will be returned from GPU memory, else from CPU memory

  • gpu_ptr_kind – Ignored for CPU memory. For GPU memory specifies whether attribute data will be returned as a GPU pointer to the GPU memory, or a CPU pointer to the GPU memory.

set_variable(name: str, value)

Set the value of a variable. og.OmniGraphError will be raised if the variable does not exist on the graph, or if there is type mismatch

property abi_context: omni.graph.core._omni_graph_core.GraphContext

Returns the graph context to which this database belongs

property abi_node: omni.graph.core._omni_graph_core.Node

Returns the node to which this database belongs