AttributeDataValueHelper
- class omni.graph.core.AttributeDataValueHelper(data: Union[str, pxr.Sdf.Path, omni.graph.core._omni_graph_core.Attribute, pxr.Usd.Attribute, omni.graph.core._omni_graph_core.AttributeData], instance=18446744073709551614)
Bases:
object
Class to manage getting and setting of og.AttributeData values.
Note that this helper sets values directly and is not generally advised for use as it has no undo support. Instead you probably want to use og.Controller or og.DataView
- Internal Attributes:
_data: The interface to the attribute data _type: The attribute type of the data (delay loaded to allow for extended types needing resolution)
Methods
__init__
(data[, instance])Initialize the evaluation information for the AttributeData.
Raises an og.OmniGraphError exception if the data about to be accessed is invalid
get
([on_gpu, reserved_element_count, ...])Get the value of this attribute data.
get_array
(get_for_write[, ...])Deprecated - use get()
Get the length of this attribute data's array.
reserve_element_count
(new_element_count)Set the length of this attribute data's array.
set
(new_value[, on_gpu])Set the value of AttributeData
Attributes
Returns the attribute data this helper is wrapping
Returns the location of pointers to GPU arrays
Returns whether the underlying API object has a resolved type.
Returns whether the underlying API object is valid or not
Returns the attribute type, extracting it from the data if it hasn't already been done
- __init__(data: Union[str, pxr.Sdf.Path, omni.graph.core._omni_graph_core.Attribute, pxr.Usd.Attribute, omni.graph.core._omni_graph_core.AttributeData], instance=18446744073709551614)
Initialize the evaluation information for the AttributeData.
- Raises
TypeError if 'data' did not reference a correct attribute type –
- check_validity()
Raises an og.OmniGraphError exception if the data about to be accessed is invalid
- get(on_gpu: bool = False, reserved_element_count: Optional[int] = None, return_type: Optional[omni.graph.core._impl.attribute_values.WrappedArrayType] = None) Any
Get the value of this attribute data.
- Parameters
on_gpu – Is the value stored on the GPU?
reserved_element_count – For array attributes, if not None then the array will pre-reserve this many elements
return_type – For array attributes this specifies how the return data is to be wrapped
- Returns
Value of the attribute data
- Raises
AttributeError – If reserved_element_count or return_type are defined but the attribute is not an array type
TypeError – Raised if the data type is not yet supported or the attribute type is not resolved
- get_array(get_for_write: bool, reserved_element_count: int = 0, on_gpu: bool = False, return_type: Optional[omni.graph.core._impl.attribute_values.WrappedArrayType] = None) Any
Deprecated - use get()
- get_array_size() int
Get the length of this attribute data’s array.
- Returns
Length of the data array in Fabric
- Raises
AttributeError – If the array is not an array type
- reserve_element_count(new_element_count: int)
Set the length of this attribute data’s array. It doesn’t matter whether the data will be on the GPU or CPU, all this does is reserve the size number. When retrieving the data you will specify where it lives.
- Parameters
new_element_count – Number of array elements to reserve for the array
- Raises
AttributeError – If the array is not an array type
- set(new_value: Union[Any, omni.graph.core._impl.utils.TypedValue], on_gpu: bool = False)
Set the value of AttributeData
- Parameters
new_value – New value to be set on the attribute
on_gpu – Should the value be stored on the GPU?
- Raises
TypeError – Raised if the data type of the attribute is not yet supported
- property attribute_data: omni.graph.core._omni_graph_core.AttributeData
Returns the attribute data this helper is wrapping
- property gpu_ptr_kind: omni.graph.core._omni_graph_core.PtrToPtrKind
Returns the location of pointers to GPU arrays
- property is_resolved: bool
Returns whether the underlying API object has a resolved type.
- property is_valid: bool
Returns whether the underlying API object is valid or not
- property type: omni.graph.core._omni_graph_core.Type
Returns the attribute type, extracting it from the data if it hasn’t already been done