omni.kit.viewport_widgets_manager

Viewport Widgets Manager

Introduction

This extension provides simple interface to create/manager viewport widgets. It will help to maintain the viewport resize, and active camera movement.

class omni.kit.viewport_widgets_manager.ViewportWidgetsManagerExtension

Bases: omni.ext._extensions.IExt

add_widget(prim_path: pxr.Sdf.Path, widget: omni.kit.viewport_widgets_manager.widget_provider.WidgetProvider, alignment=0)
on_shutdown()
on_startup()
remove_widget(widget_id)
class omni.kit.viewport_widgets_manager.WidgetAlignment

Bases: object

BOTTOM = 1
CENTER = 0
TOP = 2
class omni.kit.viewport_widgets_manager.WidgetProvider

Bases: object

build_widget(window)
omni.kit.viewport_widgets_manager.add_widget(prim_path: Union[str, pxr.Sdf.Path], widget: omni.kit.viewport_widgets_manager.widget_provider.WidgetProvider, alignment=0)

Add widget to viewport, which is positioned to the screen pos of prim on the viewport.

REMINDER: Currently, it’s possible that a prim may includes multiple widgets, and they will be overlapped to each other.

Parameters
  • prim_path (Union[str, Sdf.Path]) – The prim you want to add the widget to.

  • widget (WidgetProvider) – The widget provider that you can override

  • customize the UI layout. (to) –

  • alignment – The anchor point of the widget. By default, it will be

  • calculated by the position of prim. (the) –

Returns

widget id, which you can use it for widget remove. Or None if prim cannot be found.

omni.kit.viewport_widgets_manager.remove_widget(widget_id)

Remove widget with id.

Parameters

widget_id – The widget id returned with add_widget.