ControlStateManager#

class omni.kit.property.usd.ControlStateManager(icon_path)#

Bases: object

Methods

__init__(icon_path)

Initializes a new instance of the ControlStateManager.

build_control_state(control_state, **kwargs)

Gets control state values for UI.

destory()

Cleans up control states.

get_instance()

Get current instance for ControlStateManager.

register_control_state(on_refresh_state, ...)

Registers a new control states.

unregister_control_state(flag)

Unregisters a existing control state.

update_control_state(usd_model_base)

Updates control state.

__init__(icon_path)#

Initializes a new instance of the ControlStateManager.

Parameters:

icon_path – Path for icons.

build_control_state(control_state, **kwargs)#

Gets control state values for UI.

destory()#

Cleans up control states.

classmethod get_instance()#

Get current instance for ControlStateManager.

register_control_state(
on_refresh_state: Callable,
on_build_state: Callable,
icon_path: str,
priority: float = 0.0,
) int#

Registers a new control states.

Parameters:
  • on_refresh_state (Callable) – function to be called when control state refreshes. Callable should returns a tuple(bool, bool). The first bool decides if the flag of this state should be set. The second bool decides if a force rebuild should be triggered.

  • on_build_state (Callable) – function to be called when build control state UI. Callable should returns a tuple(bool, Callable, str). If first bool is True, subsequent states with lower (larger value) priority will be skipped. Second Callable is the action to perform when click on the icon. Third str is tooltip when hovering over icon.

  • icon_path (str) – path to an SVG file to show next to attribute when this state is True.

  • priority (float) – priority override.

unregister_control_state(flag)#

Unregisters a existing control state.

update_control_state(usd_model_base)#

Updates control state.