PropertyValueModel#
- class omni.kit.environment.core.PropertyValueModel(
- property_path: str,
- stage: ~pxr.Usd.Stage,
- value_type: ~pxr.Sdf.ValueTypeName = <pxr.Sdf.ValueTypeName object>,
- default: ~typing.Any = '',
- min: int | float | None = None,
- max: int | float | None = None,
- default_prim_type: str | None = None,
Bases:
BaseValueModelModel for simple usd property. :param property_path: Property path in usd stage. :type property_path: str :param stage: Usd stage that property belongs to. :type stage: Usd.Stage
- Keyword Arguments:
value_type (Sdf.ValueTypeName) – Property value type. Used to create attribute if not exists, Default Sdf.ValueTypeNames.String.
default (Any) – Default property value.
min (Union[int, float, None]) – Min value. Default None.
max (Union[int, float, None]) – Max value. Default None.
default_prim_type (Optional[str]) – Prim type when creating if prim that propert belongs to does not exists. Default None to donot create.
Methods
__init__(self)Constructs AbstractValueModel.
destroy()Destroys the property value model by calling the base class destroy method.
Returns the usd property value as a bool.
Returns the usd property value as a float.
Returns the usd property value as an int.
Returns the usd property value as a string.
on_property_changed(stage)Updates the model with the new usd stage and triggers a notification of the value change.
set_value(value)Sets the property value on the usd stage after validation and clamping.
Attributes
- __init__(
- self: omni.ui._ui.AbstractValueModel,
Constructs AbstractValueModel.
- `kwargsdict`
See below
### Keyword Arguments:
- destroy()#
Destroys the property value model by calling the base class destroy method.
- get_value_as_bool() bool#
Returns the usd property value as a bool.
- Returns:
Property value converted to a boolean.
- Return type:
bool
- get_value_as_float() float#
Returns the usd property value as a float.
- Returns:
Property value converted to a float.
- Return type:
float
- get_value_as_int() int#
Returns the usd property value as an int.
- Returns:
Property value converted to an integer.
- Return type:
int
- get_value_as_string() str#
Returns the usd property value as a string.
- Returns:
Property value converted to a string.
- Return type:
str
- on_property_changed(stage: Stage)#
Updates the model with the new usd stage and triggers a notification of the value change.
- Parameters:
stage (Usd.Stage) – Updated usd stage instance.
- set_value(value: Any) None#
Sets the property value on the usd stage after validation and clamping.
If the stage is not available or the value fails validation, no update is performed. Updates the pending edit flag when the value changes and creates an attribute if it does not exist.
- Parameters:
value (Any) – Value to set after validation and adjustment based on min and max constraints.