GfVecAttributeModel
- class omni.kit.property.usd.GfVecAttributeModel(stage: Stage, attribute_paths: List[Path], comp_count: int, tf_type: Type, self_refresh: bool, metadata: dict, **kwargs)
Bases:
AbstractItemModel
,UsdBase
A model for representing and manipulating vector attributes in USD.
This model provides an interface for editing vector attributes associated with USD stages and paths. It is designed to handle different component counts and data types, such as GfVec2f, GfVec3f, GfVec4f, etc.
- Parameters
stage (
Usd.Stage
) – The USD stage where the attribute is located.attribute_paths (List[
Sdf.Path
]) – A list of SDF paths to the attributes this model will represent.comp_count (int) – The number of components in the vector attribute (e.g., 2 for GfVec2, 3 for GfVec3).
tf_type (
Tf.Type
) – The type of the vector attribute, which defines the data type of the components (e.g., float, double).self_refresh (bool) – Whether the model should automatically refresh its value when changes occur.
metadata (dict) – A dictionary containing metadata for the attribute.
- Keyword Arguments
change_on_edit_end (bool) – Whether to apply changes only when the user finishes editing (default is False).
treat_array_entry_as_comp (bool) – Treat each array entry as a separate component (default is False).
The model supports editing individual components of the vector attribute and can handle different data types as specified by the `tf_type` argument. It integrates with USD’s change notification system to update its value when the underlying attribute changes.
Methods
__init__
(stage, attribute_paths, comp_count, ...)Initializer for GfVecAttributeModel.
begin_edit
(item)Begins an edit operation on the given item.
clean
()Cleans up the model and releases any held resources.
end_edit
(item)Ends an edit operation on the given item.
get_item_children
(item)Returns the children of the given item.
get_item_value_model
(item, column_id)Retrieves the value model associated with the given item and column ID.
Attributes
- __init__(stage: Stage, attribute_paths: List[Path], comp_count: int, tf_type: Type, self_refresh: bool, metadata: dict, **kwargs)
Initializer for GfVecAttributeModel.
- begin_edit(item)
Begins an edit operation on the given item.
- Parameters
item – The item on which the edit operation is started.
- clean()
Cleans up the model and releases any held resources.
- end_edit(item)
Ends an edit operation on the given item.
- Parameters
item – The item on which the edit operation is ended.
- get_item_children(item)
Returns the children of the given item.
- Parameters
item – The item whose children are to be retrieved.
- get_item_value_model(item, column_id)
Retrieves the value model associated with the given item and column ID.
- Parameters
item – The item for which the model is retrieved.
column_id (int) – The column ID associated with the item.