UsdAttributeModel#
- class omni.kit.property.usd.UsdAttributeModel(
- stage: Stage,
- attribute_paths: List[Path],
- self_refresh: bool,
- metadata: dict,
- change_on_edit_end=True,
- **kwargs,
Bases:
AbstractValueModel
,UsdBase
A value model that re-implements the AbstractValueModel interface in Python to observe a USD attribute path.
- Parameters:
stage (
Usd.Stage
) – The stage that contains the USD attribute.attribute_paths (List[
Sdf.Path
]) – A list of paths to the USD attributes to be observed.self_refresh (bool) – Whether the model should automatically refresh its value when changes occur in USD.
metadata (dict) – A dictionary of metadata relevant to the USD attribute.
change_on_edit_end (bool) – Indicates if the value should only change when the edit ends.
- Keyword Arguments:
treat_array_entry_as_comp (bool) – Treat array entries as components of a single value.
is_normal_attribute (bool) – Specify if the attribute is a normal attribute.
This model provides a clean interface to interact with USD attributes, offering functions to begin and end edits, get and set attribute values in various data types, and handle value changes and updates.
Methods
__init__
(stage, attribute_paths, ...[, ...])Initializes the value model that is reimplemented in Python to watch a USD attribute path.
Begins an editing session by notifying the USD base and the UI model.
clean
()Cleans up the model by delegating to the base clean-up method.
end_edit
()Ends an editing session by notifying the USD base and the UI model.
Retrieves the value of the USD attribute as a boolean.
Retrieves the value of the USD attribute as a float.
Retrieves the value of the USD attribute as an integer.
get_value_as_string
([elide_big_array])Retrieves the value of the USD attribute as a string.
set_value
(value[, comp])Sets the value of the USD attribute.
Attributes
- __init__(
- stage: Stage,
- attribute_paths: List[Path],
- self_refresh: bool,
- metadata: dict,
- change_on_edit_end=True,
- **kwargs,
Initializes the value model that is reimplemented in Python to watch a USD attribute path.
- begin_edit()#
Begins an editing session by notifying the USD base and the UI model.
- clean()#
Cleans up the model by delegating to the base clean-up method.
- end_edit()#
Ends an editing session by notifying the USD base and the UI model.
- get_value_as_bool() bool #
Retrieves the value of the USD attribute as a boolean.
- Returns:
The attribute value as a boolean.
- Return type:
bool
- get_value_as_float() float #
Retrieves the value of the USD attribute as a float.
- Returns:
The attribute value as a float.
- Return type:
float
- get_value_as_int() int #
Retrieves the value of the USD attribute as an integer.
- Returns:
The attribute value as an integer.
- Return type:
int
- get_value_as_string(elide_big_array=True) str #
Retrieves the value of the USD attribute as a string.
- Parameters:
elide_big_array (bool) – If True, elides long array displays.
- Returns:
The attribute value formatted as a string.
- Return type:
str
- set_value(value, comp: int = -1)#
Sets the value of the USD attribute.
- Parameters:
value – New value to set the attribute to.
comp (int) – Optional index for the component of the value to set.