SettingModel#
- class omni.kit.widget.settings.settings_model.SettingModel(setting_path: str, draggable: bool = False)#
Bases:
AbstractValueModel
Model for simple scalar/POD carb.settings
Methods
__init__
(setting_path[, draggable])SettingModel init function.
begin_edit
(self)Called when the user starts the editing.
destroy
()Destroy class and cleanup.
end_edit
(self)Called when the user finishes the editing.
Get current value
Get current value as bool
Get current value as float
Get current value as integer
Get current value as string
set_range
(min_val, max_val)set the allowable range for the setting.
set_reset_button
(button)Set reset button from ui.Rectangle.
set_value
(*args, **kwargs)Overloaded function.
Attributes
- __init__(setting_path: str, draggable: bool = False)#
SettingModel init function.
- Parameters:
setting_path – setting_path carb setting to create a model for
draggable – is it a numeric value you will drag in the UI?
- begin_edit(self: omni.ui._ui.AbstractValueModel) None #
Called when the user starts the editing. If it’s a field, this method is called when the user activates the field and places the cursor inside. This method should be reimplemented.
- destroy()#
Destroy class and cleanup.
- end_edit(self: omni.ui._ui.AbstractValueModel) None #
Called when the user finishes the editing. If it’s a field, this method is called when the user presses Enter or selects another field for editing. It’s useful for undo/redo. This method should be reimplemented.
- get_value()#
Get current value
- get_value_as_bool() bool #
Get current value as bool
- get_value_as_float() float #
Get current value as float
- get_value_as_int() int #
Get current value as integer
- get_value_as_string() str #
Get current value as string
- set_range(min_val, max_val)#
set the allowable range for the setting. This is more restrictive than the UI min/max setting which still lets you set out of range values using the keyboard (e.g click and type in slider)
- set_reset_button(button: Rectangle)#
Set reset button from ui.Rectangle.
- set_value(*args, **kwargs)#
Overloaded function.
set_value(self: omni.ui._ui.AbstractValueModel, value: bool) -> None
Set the value.
set_value(self: omni.ui._ui.AbstractValueModel, value: int) -> None
Set the value.
set_value(self: omni.ui._ui.AbstractValueModel, value: float) -> None
Set the value.
set_value(self: omni.ui._ui.AbstractValueModel, value: str) -> None
Set the value.