AttributeDataValueHelper#
- class omni.graph.core.AttributeDataValueHelper(
- data: str | Path | Attribute | Property | AttributeData,
- instance=18446744073709551614,
Bases:
object
Class to manage getting and setting of omni.graph.core.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 Controller or DataView
- _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])Create an accessor to get at AttributeData values
Check the validity of the data accessor
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
the attribute data this accessor is wrapping
The location of pointers to GPU arrays
Does the underlying attribute have a definite resolved type?
Validity of the underlying API object
the attribute type, extracting it from the data if it hasn't already been done
- __init__(
- data: str | Path | Attribute | Property | AttributeData,
- instance=18446744073709551614,
Create an accessor to get at AttributeData values
- Parameters:
data – Object type whose data is to be accessed
instance – Index of the graph from which the attribute’s value is to be accessed
- Raises:
og.OmniGraphTypeError – if ‘data’ did not reference a correct attribute type
- check_validity()#
Check the validity of the data accessor
- Raises:
og.OmniGraphError – if the data about to be accessed is invalid
- get(
- on_gpu: bool = False,
- reserved_element_count: int | None = None,
- return_type: WrappedArrayType | None = None,
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
- Return type:
Any
- Raises:
og.OmniGraphAttributeError – If reserved_element_count or return_type are defined but the attribute is not
an array type –
og.OmniGraphTypeError – 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: WrappedArrayType | None = None,
Deprecated - use get()
- get_array_size() int #
Get the length of this attribute data’s array.
- Returns:
Length of the data array in Fabric
- Return type:
int
- Raises:
og.OmniGraphAttributeError – 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:
og.OmniGraphAttributeError – If the array is not an array type
- set(
- new_value: Any | 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:
og.OmniGraphTypeError – Raised if the data type of the attribute is not yet supported
- property attribute_data: AttributeData#
the attribute data this accessor is wrapping
- Type:
- property gpu_ptr_kind: PtrToPtrKind#
The location of pointers to GPU arrays
- Type:
- property is_resolved: bool#
Does the underlying attribute have a definite resolved type?
- Type:
bool
- property is_valid: bool#
Validity of the underlying API object
- Type:
bool