ViewportWindow

class omni.kit.viewport.window.ViewportWindow(name: Optional[str] = None, usd_context_name: str = '', width: Optional[int] = None, height: Optional[int] = None, flags: Optional[int] = None, style: Optional[dict] = None, usd_drop_support: bool = True, hydra_engine_options: Optional[dict] = None, **ui_kw_args)

Bases: Window

Methods

__init__([name, usd_context_name, width, ...])

ViewportWindow constructor

add_external_drag_drop_support([callback_fn])

Add a callback for an external drag-drop event onto the ViewportWindow

destroy()

Destroy the ViewportWindow instance

get_frame(name)

Add a unique {py:class}`omni.ui.Frame` into the view hierarchy.

get_instances([usd_context_name])

remove_external_drag_drop_support()

Disable external drag-drop into the ViewportWindow

set_default_style(style[, overwrite, ...])

set_style(style)

Set the style for the ViewportWindow

Attributes

active_window

The Viewport Window, simple window holding a ViewportLayers widget

name

Return the name of the ViewportWindow

viewport_api

Return the active ViewportAPI for the ViewportWindow

viewport_widget

Return the active omni.kit.widget.viewport.ViewportWidget for the ViewportWindow

visible

This property holds whether the window is visible.

__init__(name: Optional[str] = None, usd_context_name: str = '', width: Optional[int] = None, height: Optional[int] = None, flags: Optional[int] = None, style: Optional[dict] = None, usd_drop_support: bool = True, hydra_engine_options: Optional[dict] = None, **ui_kw_args)

ViewportWindow constructor

Parameters
  • name (str) – The name of the Window.

  • usd_context_name (str) – The name of a UsdContext this ViewportWindow will be viewing.

  • width (int) – The width of the Window.

  • height (int) – The height of the Window.

  • flags (int) – omni.ui.WINDOW flags to use for the Window.

  • style (dict) – Optional style overrides to apply to the Window’s frame.

  • usd_drop_support (bool) – Enable Usd drop support (requires {py:mod}`omni.kit.window.drop_support`)

  • hydra_engine_options (dict, None) – Optional dictionary to use in creation of the HydraEngine

  • \*args – Additional arguments to pass to omni.ui.Window

  • **kwargs – Additional keyword arguments to pass to omni.ui.Window

add_external_drag_drop_support(callback_fn: Optional[Callable] = None)

Add a callback for an external drag-drop event onto the ViewportWindow

Parameters

callback_fn (Callable) – Object to be invoked when the item is dragged or dropped over the ViewportWindow

destroy()

Destroy the ViewportWindow instance

get_frame(name: str) Frame

Add a unique {py:class}`omni.ui.Frame` into the view hierarchy. This will return a newly created {py:class}`omni.ui.Frame` on the first call for a unique name, or return a previously created {py:class}`omni.ui.Frame` for the same unique name.

Parameters

name (str) – A unique identifier for the frame.

Returns

class}`omni.ui.Frame`.

Return type

An {py

remove_external_drag_drop_support()

Disable external drag-drop into the ViewportWindow

set_style(style)

Set the style for the ViewportWindow

Parameters

style – The omni.ui style object to apply.

active_window: Optional[weakproxy] = None

The Viewport Window, simple window holding a ViewportLayers widget

property name

Return the name of the ViewportWindow

property viewport_api

Return the active ViewportAPI for the ViewportWindow

property viewport_widget

Return the active omni.kit.widget.viewport.ViewportWidget for the ViewportWindow

property visible

This property holds whether the window is visible.