Attribute
- class omni.graph.core.Attribute
Bases:
pybind11_object
An attribute, defining a data type and value that belongs to a node
Methods
__init__
(*args, **kwargs)connect
(self, path, modify_usd)Connects this attribute with another attribute.
connectEx
(self, info, modify_usd)Connects this attribute with another attribute.
connectPrim
(self, path, modify_usd, write)Connects this attribute to a prim that can represent a bundle connection or just a plain prim relationship
deprecation_message
(self)Gets the deprecation message on an attribute, if it is deprecated.
disconnect
(self, attribute, modify_usd)Disconnects this attribute from another attribute.
disconnectPrim
(self, path, modify_usd, write)Disconnects this attribute to a prim that can represent a bundle connection or just a plain prim relationship
ensure_port_type_in_name
(name, port_type, ...)Return the attribute name with the port type namespace prepended if it isn't already present.
get
(self[, on_gpu, instance])Get the value of the attribute
get_all_metadata
(self)Gets the attribute's metadata
get_array
(self, on_gpu, get_for_write, ...)Gets the value of an array attribute
get_attribute_data
(self, instance)Get the AttributeData object that can access the attribute's data
Where we have dynamic scheduling, downstream nodes can have their execution disabled by turning on the flag in the upstream attribute.
Gets the number of downstream connections to this attribute
Gets the list of downstream connections to this attribute
Returns the list of downstream connections for this attribute, with detailed connection information such as the connection type.
get_extended_type
(self)Get the extended type of the attribute
get_handle
(self)Get a handle to the attribute
get_metadata
(self, key)Returns the metadata value for the given key.
get_metadata_count
(self)Gets the number of metadata values on the attribute
get_name
(self)Get the attribute's name
get_node
(self)Gets the node to which this attribute belongs
get_path
(self)Get the path to the attribute
get_port_type
(self)Gets the attribute's port type (input, output, or state)
get_port_type_from_name
(name)Parse the port type from the given attribute name if present.
get_resolved_type
(self)Get the resolved type of the attribute
get_type_name
(self)Get the name of the attribute's type
get_union_types
(self)Get the list of types accepted by a union attribute
Gets the number of upstream connections to this attribute
get_upstream_connections
(self)Gets the list of upstream connections to this attribute
Returns the list of upstream connections for this attribute, with detailed connection information such as the connection type.
is_array
(self)Checks if the attribute is an array type.
is_compatible
(self, attribute)Checks to see if this attribute is compatible with another one, in particular the data types they use
is_connected
(self, attribute)Checks to see if this attribute has a connection to another attribute
is_deprecated
(self)Checks whether an attribute is deprecated.
is_dynamic
(self)Checks to see if an attribute is dynamic
is_runtime_constant
(self)Checks is this attribute is a runtime constant.
is_valid
(self)Checks if the current attribute is valid.
map_to_target
(self, target_attrib_name)Maps the attribute to another one on the graph target.
register_value_changed_callback
(self, func)Registers a function that will be invoked when the value of the given attribute changes.
remove_port_type_from_name
(name, is_bundle)Find the attribute name with the port type removed if it is present.
set
(self, value[, on_gpu, instance])Sets the value of the attribute's data
set_default
(self, value[, on_gpu])Sets the default value of the attribute's data (value when not connected)
set_disable_dynamic_downstream_work
(self, ...)Where we have dynamic scheduling, downstream nodes can have their execution disabled by turning on the flag in the upstream attribute.
set_metadata
(self, key, value)Sets the metadata value for the given key
set_resolved_type
(self, resolved_type)Sets the resolved type for the extended attribute.
update_attribute_value
(self, update_immediately)Requests the value of an attribute.
write_complete
(attributes)Warn the framework that writing to the provided attributes is done, so it can trigger callbacks attached to them
Attributes
Defines the memory space that GPU array data pointers live in.
Flag that is set when an attribute need not be valid for compute() to happen.
resolved_prefix
Returns the attribute name on the graph target the attribute is mapped to
- __init__(*args, **kwargs)
- connect(self: omni.graph.core._omni_graph_core.Attribute, path: omni.graph.core._omni_graph_core.Attribute, modify_usd: bool) bool
Connects this attribute with another attribute. Assumes regular connection type.
- Parameters
path (omni.graph.core.Attribute) – The destination attr
modify_usd (bool) – Whether to create USD.
- Returns
True for success, False for fail
- Return type
bool
- connectEx(self: omni.graph.core._omni_graph_core.Attribute, info: omni::graph::core::Py_ConnectionInfo, modify_usd: bool) bool
Connects this attribute with another attribute. Allows for different connection types.
- Parameters
info (omni.graph.core.ConnectionInfo) – The ConnectionInfo object that contains both the attribute and the connection type
modify_usd (bool) – Whether to modify the underlying USD with this connection
- Returns
True for success, False for fail
- Return type
bool
- connectPrim(self: omni.graph.core._omni_graph_core.Attribute, path: str, modify_usd: bool, write: bool) bool
Connects this attribute to a prim that can represent a bundle connection or just a plain prim relationship
- Parameters
path (str) – The path to the prim
modify_usd (bool) – Whether to modify USD.
write (bool) – Whether this connection represents a bundle
- Returns
True for success, False for fail
- Return type
bool
- deprecation_message(self: omni.graph.core._omni_graph_core.Attribute) str
Gets the deprecation message on an attribute, if it is deprecated. Typically this message gives guidance as to what the user should do instead of using the deprecated attribute.
- Returns
The message associated with a deprecated attribute
- Return type
str
- disconnect(self: omni.graph.core._omni_graph_core.Attribute, attribute: omni.graph.core._omni_graph_core.Attribute, modify_usd: bool) bool
Disconnects this attribute from another attribute.
- Parameters
attribute (omni.graph.core.Attribute) – The destination attribute of the connection to remove
modify_usd (bool) – Whether to modify USD
- Returns
True for success, False for fail
- Return type
bool
- disconnectPrim(self: omni.graph.core._omni_graph_core.Attribute, path: str, modify_usd: bool, write: bool) bool
Disconnects this attribute to a prim that can represent a bundle connection or just a plain prim relationship
- Parameters
path (str) – The path to the prim
modify_usd (bool) – Whether to modify USD.
write (bool) – Whether this connection represents a bundle
- Returns
True for success, False for fail
- Return type
bool
- static ensure_port_type_in_name(name: str, port_type: omni.graph.core._omni_graph_core.AttributePortType, is_bundle: bool) str
Return the attribute name with the port type namespace prepended if it isn’t already present.
- Parameters
name (str) – The attribute name, with or without the port prefix
port_type (omni.graph.core.AttributePortType) – The port type of the attribute
is_bundle (bool) – true if the attribute name is to be used in a bundle. Note that colon is an illegal character
instead. (in bundled attributes so an underscore is used) –
- Returns
The name with the proper prefix for the given port type
- Return type
str
- get(self: omni.graph.core._omni_graph_core.Attribute, on_gpu: bool = False, instance: int = 18446744073709551614) object
Get the value of the attribute
- Parameters
on_gpu (bool) – Is the data to be retrieved from the GPU?
instance (int) – an instance index when getting value on an instantiated graph
- Returns
Value of the attribute’s data
- Return type
Any
- get_all_metadata(self: omni.graph.core._omni_graph_core.Attribute) dict
Gets the attribute’s metadata
- Returns
A dictionary of name:value metadata on the attribute
- Return type
dict[str,str]
- get_array(self: omni.graph.core._omni_graph_core.Attribute, on_gpu: bool = False, get_for_write: bool, reserved_element_count: int, instance: int = 18446744073709551614) object
Gets the value of an array attribute
- Parameters
on_gpu (bool) – Is the data to be retrieved from the GPU?
get_for_write (bool) – Should the data be retrieved for writing?
reserved_element_count (int) – If the data is to be retrieved for writing, preallocate this many elements
instance (int) – an instance index when getting value on an instantiated graph
- Returns
Value of the array attribute’s data
- Return type
list[Any]
- get_attribute_data(self: omni.graph.core._omni_graph_core.Attribute, instance: int = 18446744073709551614) omni::graph::core::Py_AttributeData
Get the AttributeData object that can access the attribute’s data
- Parameters
instance (int) – an instance index when getting value on an instantiated graph
- Returns
The underlying attribute data accessor object for this attribute
- Return type
- get_disable_dynamic_downstream_work(self: omni.graph.core._omni_graph_core.Attribute) bool
Where we have dynamic scheduling, downstream nodes can have their execution disabled by turning on the flag in the upstream attribute. Note you also have to call setDynamicDownstreamControl on the node to enable this feature. See setDynamicDownstreamControl on INode for further information.
- Returns
True if downstream nodes are disabled in dynamic scheduling, False otherwise
- Return type
bool
- get_downstream_connection_count(self: omni.graph.core._omni_graph_core.Attribute) int
Gets the number of downstream connections to this attribute
- Returns
the number of downstream connections on this attribute.
- Return type
int
- get_downstream_connections(self: omni.graph.core._omni_graph_core.Attribute) List[omni.graph.core._omni_graph_core.Attribute]
Gets the list of downstream connections to this attribute
- Returns
The list of downstream connections for this attribute.
- Return type
- get_downstream_connections_info(self: omni.graph.core._omni_graph_core.Attribute) List[omni::graph::core::Py_ConnectionInfo]
Returns the list of downstream connections for this attribute, with detailed connection information such as the connection type.
- Returns
A list of the downstream ConnectionInfo objects
- Return type
- get_extended_type(self: omni.graph.core._omni_graph_core.Attribute) omni.graph.core._omni_graph_core.ExtendedAttributeType
Get the extended type of the attribute
- Returns
Extended type of the attribute data object
- Return type
- get_handle(self: omni.graph.core._omni_graph_core.Attribute) int
Get a handle to the attribute
- Returns
An opaque handle to the attribute
- Return type
int
- get_metadata(self: omni.graph.core._omni_graph_core.Attribute, key: str) str
Returns the metadata value for the given key.
- Parameters
key – (str) The metadata keyword
- Returns
Metadata value for the given keyword, or None if it is not defined
- Return type
str
- get_metadata_count(self: omni.graph.core._omni_graph_core.Attribute) int
Gets the number of metadata values on the attribute
- Returns
the number of metadata values currently defined on the attribute.
- Return type
int
- get_name(self: omni.graph.core._omni_graph_core.Attribute) str
Get the attribute’s name
- Returns
The name of the current attribute.
- Return type
str
- get_node(self: omni.graph.core._omni_graph_core.Attribute) omni::graph::core::Py_Node
Gets the node to which this attribute belongs
- Returns
The node associated with the attribute
- Return type
- get_path(self: omni.graph.core._omni_graph_core.Attribute) str
Get the path to the attribute
- Returns
The full path to the attribute, including the node path.
- Return type
str
- get_port_type(self: omni.graph.core._omni_graph_core.Attribute) omni.graph.core._omni_graph_core.AttributePortType
Gets the attribute’s port type (input, output, or state)
- Returns
The port type of the attribute.
- Return type
- static get_port_type_from_name(name: str) omni.graph.core._omni_graph_core.AttributePortType
Parse the port type from the given attribute name if present. The port type is indicated by a prefix seperated by a colon or underscore in the case of bundled attributes.
- Parameters
name (name The attribute) –
- Returns
- The port type indicated by the attribute prefix if present.
AttributePortType.UNKNOWN if there is no recognized prefix.
- Return type
- get_resolved_type(self: omni.graph.core._omni_graph_core.Attribute) omni::graph::core::Py_Type
Get the resolved type of the attribute
- Returns
Resolved type of the attribute data object, or the hardcoded type for regular attributes
- Return type
- get_type_name(self: omni.graph.core._omni_graph_core.Attribute) str
Get the name of the attribute’s type
- Returns
The type name of the current attribute.
- Return type
str
- get_union_types(self: omni.graph.core._omni_graph_core.Attribute) object
Get the list of types accepted by a union attribute
- Returns
The list of accepted types for the attribute if it is an extended union type, else None
- Return type
list[str]
- get_upstream_connection_count(self: omni.graph.core._omni_graph_core.Attribute) int
Gets the number of upstream connections to this attribute
- Returns
the number of upstream connections on this attribute.
- Return type
int
- get_upstream_connections(self: omni.graph.core._omni_graph_core.Attribute) List[omni.graph.core._omni_graph_core.Attribute]
Gets the list of upstream connections to this attribute
- Returns
The list of upstream connections for this attribute.
- Return type
- get_upstream_connections_info(self: omni.graph.core._omni_graph_core.Attribute) List[omni::graph::core::Py_ConnectionInfo]
Returns the list of upstream connections for this attribute, with detailed connection information such as the connection type.
- Returns
A list of the upstream ConnectionInfo objects
- Return type
- is_array(self: omni.graph.core._omni_graph_core.Attribute) bool
Checks if the attribute is an array type.
- Returns
True if the attribute data type is an array
- Return type
bool
- is_compatible(self: omni.graph.core._omni_graph_core.Attribute, attribute: omni.graph.core._omni_graph_core.Attribute) bool
Checks to see if this attribute is compatible with another one, in particular the data types they use
- Parameters
attribute (omni.graph.core.Attribute) – Attribute for which compatibility is to be checked
- Returns
True if this attribute is compatible with “attribute”
- Return type
bool
- is_connected(self: omni.graph.core._omni_graph_core.Attribute, attribute: omni.graph.core._omni_graph_core.Attribute) bool
Checks to see if this attribute has a connection to another attribute
- Parameters
attribute (Attribute) – Attribute for which the connection is to be checked
- Returns
True if this attribute is connected to another, either as source or destination
- Return type
bool
- is_deprecated(self: omni.graph.core._omni_graph_core.Attribute) bool
Checks whether an attribute is deprecated. Deprecated attributes should not be used as they will be removed in a future version.
- Returns
True if the attribute is deprecated
- Return type
bool
- is_dynamic(self: omni.graph.core._omni_graph_core.Attribute) bool
Checks to see if an attribute is dynamic
- Returns
True if the current attribute is a dynamic attribute (not in the node type definition).
- Return type
bool
- is_runtime_constant(self: omni.graph.core._omni_graph_core.Attribute) bool
Checks is this attribute is a runtime constant.
Runtime constants will keep the same value every frame, for every instance. This property can be taken advantage of in vectorized compute.
- Returns
True if the attribute is a runtime constant
- Return type
bool
- is_valid(self: omni.graph.core._omni_graph_core.Attribute) bool
Checks if the current attribute is valid.
- Returns
True if the attribute reference points to a valid attribute object
- Return type
bool
- map_to_target(self: omni.graph.core._omni_graph_core.Attribute, target_attrib_name: str) omni::graph::core::FunctionResult
Maps the attribute to another one on the graph target.
- Parameters
target_attrib_name (str) – the attribute name on the graph target prim to map this attribute to
- Returns
- Whether the call was immediately applied, failed or deferred. Deferral can
happen when the graph does not yet have any explicit instances or a prim view applied
- Return type
- register_value_changed_callback(self: omni.graph.core._omni_graph_core.Attribute, func: object) None
Registers a function that will be invoked when the value of the given attribute changes.
Note that an attribute can have one and only one callback. Subsequent calls will replace previously set callbacks. Passing None for the function argument will clear the existing callback.
- Parameters
func (callable) – A function with one argument representing the attribute that changed.
- static remove_port_type_from_name(name: str, is_bundle: bool) str
Find the attribute name with the port type removed if it is present. For example “inputs:attr” becomes “attr”
- Parameters
name (str) – The attribute name, with or without the port prefix
is_bundle (bool) – True if the attribute name is to be used in a bundle. Note that colon is an illegal character in bundled attributes so an underscore is used instead.
- Returns
The name with the port type prefix removed
- Return type
str
- set(self: omni.graph.core._omni_graph_core.Attribute, value: object, on_gpu: bool = False, instance: int = 18446744073709551614) bool
Sets the value of the attribute’s data
- Parameters
value (Any) – New value of the attribute’s data
on_gpu (bool) – Is the data to be set on the GPU?
instance (int) – an instance index when setting value on an instantiated graph
- Returns
True if the value was successfully set
- Return type
bool
- set_default(self: omni.graph.core._omni_graph_core.Attribute, value: object, on_gpu: bool = False) bool
Sets the default value of the attribute’s data (value when not connected)
- Parameters
value (Any) – New value of the default attribute’s data
on_gpu (bool) – Is the data to be set on the GPU?
- Returns
True if the value was successfully set
- Return type
bool
- set_disable_dynamic_downstream_work(self: omni.graph.core._omni_graph_core.Attribute, disable: bool) None
Where we have dynamic scheduling, downstream nodes can have their execution disabled by turning on the flag in the upstream attribute. Note you also have to call setDynamicDownstreamControl on the node to enable this feature. This function allows you to set the flag on the attribute that will disable the downstream node. See setDynamicDownstreamControl on INode for further information.
- Parameters
disable (bool) – Whether to disable downstream connected nodes in dynamic scheduling.
- set_metadata(self: omni.graph.core._omni_graph_core.Attribute, key: str, value: str) bool
Sets the metadata value for the given key
- Parameters
key (str) – The metadata keyword
value (str) – The value of the metadata
- set_resolved_type(self: omni.graph.core._omni_graph_core.Attribute, resolved_type: omni::graph::core::Py_Type) None
Sets the resolved type for the extended attribute.
Only valid for attributes with union/any extended types, who’s type has not yet been resolved. Should only be called from on_connection_type_resolve() callback. This operation is async and may fail if the type cannot be resolved as requested.
- Parameters
resolved_type (omni.graph.core.Type) – The type to resolve the attribute to
- update_attribute_value(self: omni.graph.core._omni_graph_core.Attribute, update_immediately: bool) bool
Requests the value of an attribute. In the cases of lazy evaluation systems, this generates the “pull” that causes the attribute to update its value.
- Parameters
update_immediately (bool) – Whether to update the attribute value immediately. If True, the function will block until the attribute is update and then return. If False, the attribute will be updated in the next update loop.
- Returns
The value of the attribute
- Return type
Any
- static write_complete(attributes: sequence) None
Warn the framework that writing to the provided attributes is done, so it can trigger callbacks attached to them
- Parameters
attributes (list[omni.graph.core.Attribute]) – List of attributes that are done writing
- property gpu_ptr_kind
Defines the memory space that GPU array data pointers live in.
- property is_optional_for_compute
Flag that is set when an attribute need not be valid for compute() to happen. bool:
- property target_mapping
Returns the attribute name on the graph target the attribute is mapped to
- Returns
The name of the target, or None if there isn’t one mapped
- Return type
string