MdlEnumAttributeModel
- class omni.kit.property.usd.MdlEnumAttributeModel(stage: Stage, attribute_paths: List[Path], self_refresh: bool, metadata: dict, **kwargs)
Bases:
AbstractItemModel
,UsdBase
A model representing an enumeration attribute in USD.
This model provides an abstraction over a USD attribute that represents an enumeration. It allows querying and setting of the enumeration value, as well as observing changes to the enumeration option.
- Parameters
stage (
Usd.Stage
) – The stage that the attribute is associated with.attribute_paths (List[Sdf.Path]) – The list of attribute paths that this model is watching.
self_refresh (bool) – Whether the model should automatically refresh its value when changes occur.
metadata (dict) – A dictionary containing metadata for the model.
- Keyword Arguments
change_on_edit_end (bool) – Whether to apply changes only when editing ends.
treat_array_entry_as_comp (bool) – Whether to treat array entries as components.
Methods
__init__
(stage, attribute_paths, ...)Initializes the MdlEnumAttributeModel with a USD stage and attribute paths.
begin_edit
([item])Begins an editing session for the given item.
clean
()Cleans the internal state of the model.
end_edit
([item])Ends an editing session for the given item.
get_item_children
(item)Retrieves the child items of the given item.
get_item_value_model
(item, column_id)Gets the value model for the given item and column ID.
Gets the value of the model as a string.
is_allowed_enum_string
(enum_str)Checks if the given enum string is allowed.
set_from_enum_string
(enum_str)Sets the value of the model from the given enum string.
Attributes
- __init__(stage: Stage, attribute_paths: List[Path], self_refresh: bool, metadata: dict, **kwargs)
Initializes the MdlEnumAttributeModel with a USD stage and attribute paths.
- begin_edit(item=None)
Begins an editing session for the given item.
- Parameters
item – The item to begin editing.
- clean()
Cleans the internal state of the model.
- end_edit(item=None)
Ends an editing session for the given item.
- Parameters
item – The item to end editing.
- get_item_children(item)
Retrieves the child items of the given item.
- Parameters
item – The item to retrieve children for.
- get_item_value_model(item, column_id)
Gets the value model for the given item and column ID.
- Parameters
item – The item to retrieve the value model for.
column_id (int) – The ID of the column.
- get_value_as_string()
Gets the value of the model as a string.
- is_allowed_enum_string(enum_str)
Checks if the given enum string is allowed.
- Parameters
enum_str (str) – The enum string to check.
- set_from_enum_string(enum_str)
Sets the value of the model from the given enum string.
- Parameters
enum_str (str) – The enum string to set.