GfVecAttributeSingleChannelModel
- class omni.kit.property.usd.GfVecAttributeSingleChannelModel(stage: Stage, attribute_paths: List[Path], channel_index: int, self_refresh: bool, metadata: dict, change_on_edit_end=True, **kwargs)
Bases:
UsdAttributeModel
A model for handling single channel vector attributes in USD.
This model is a specialized version of `UsdAttributeModel` that focuses on a single channel of a vector attribute. It is designed to be used with vector types such as GfVec3f where only one component of the vector is relevant at a time.
- Parameters
stage (
Usd.Stage
) – The USD stage containing the attributes to be managed.attribute_paths (List[
Sdf.Path
]) – A list of USD attribute paths for which the model is responsible.channel_index (int) – The index of the channel in the vector to be managed by this model.
self_refresh (bool) – Whether the model should update itself automatically when changes occur.
metadata (dict) – A dictionary containing metadata information for the attribute.
change_on_edit_end (bool) – Whether the value of the attribute should only change when the user finishes editing.
- Keyword Arguments
treat_array_entry_as_comp (bool) – Treats the array entry as a separate component if set to True.
Methods
__init__
(stage, attribute_paths, ...[, ...])Initializer for GfVecAttributeSingleChannelModel.
Retrieves the value as a boolean.
Retrieves the value as a float.
Retrieves the value as an integer.
get_value_as_string
([elide_big_array])Retrieves the value as a string.
Checks if the current value is different from the default value.
Indicates if the value is an array.
set_value
(value[, comp])Sets the value of the attribute.
Attributes
- __init__(stage: Stage, attribute_paths: List[Path], channel_index: int, self_refresh: bool, metadata: dict, change_on_edit_end=True, **kwargs)
Initializer for GfVecAttributeSingleChannelModel.
- get_value_as_bool() bool
Retrieves the value as a boolean.
- Returns
The value of the attribute as a boolean.
- Return type
bool
- get_value_as_float() float
Retrieves the value as a float.
- Returns
The value of the attribute as a float.
- Return type
float
- get_value_as_int() int
Retrieves the value as an integer.
- Returns
The value of the attribute as an integer.
- Return type
int
- get_value_as_string(elide_big_array=True) str
Retrieves the value as a string.
- Parameters
elide_big_array (bool) – If True, elide arrays that are too large.
- Returns
The value of the attribute as a string.
- Return type
str
- is_different_from_default()
Checks if the current value is different from the default value.
- Returns
True if different, otherwise False.
- Return type
bool
- is_value_array()
Indicates if the value is an array.
- Returns
True if the value is an array, otherwise False.
- Return type
bool
- set_value(value, comp: int = -1)
Sets the value of the attribute.
- Parameters
value – The new value to set.
comp (int) – The component index to set, -1 if not component-specific.