VectorSettingsModel

class omni.kit.widget.settings.settings_model.VectorSettingsModel(setting_path: str, component_count: int, item_class: AbstractItemModel, immediate_mode: bool)

Bases: AbstractItemModel

Model For Color, Vec3 and other multi-component settings Assumption is the items are draggable, so we only store a command when the dragging has completed.

TODO: Needs testing with component_count = 2,4

Methods

__init__(setting_path, component_count, ...)

VectorSettingsModel init function.

begin_edit(item)

Stub: need implementation to prevent crashes.

destroy()

Destroy class and cleanup.

end_edit(self, item)

Called when the user finishes the editing.

get_item_children([item])

this is called by the widget when it needs the submodel items

get_item_value_model([sub_model_item, column_id])

This is called by the widget when it needs the submodel item models.

set_reset_button(button)

Set reset button from ui.Rectangle.

set_value(values)

Set list of values to the model.

__init__(setting_path: str, component_count: int, item_class: AbstractItemModel, immediate_mode: bool)

VectorSettingsModel init function.

Parameters
  • setting_path – setting_path carb setting to create a model for

  • component_count – how many elements does the setting have?

  • immediate_mode – do we update the underlying setting immediately, or wait for endEdit

begin_edit(item: AbstractItem)

Stub: need implementation to prevent crashes.

destroy()

Destroy class and cleanup.

end_edit(self: omni.ui._ui.AbstractItemModel, item: omni.ui._ui.AbstractItem) 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.

get_item_children(item: Optional[AbstractItem] = None)

this is called by the widget when it needs the submodel items

get_item_value_model(sub_model_item: Optional[AbstractItem] = None, column_id: int = 0)

This is called by the widget when it needs the submodel item models. (to then get or set them)

set_reset_button(button: Rectangle)

Set reset button from ui.Rectangle.

set_value(values: Union[tuple, list])

Set list of values to the model.