UI Visibility

UI by default is disabled from view by default. If you wish to enable visibility, you have 2 options.

Show the UI Manually

To display the UI in the Viewport, or in a Window, right click on the UI’s Frame and select either “Viewport Frame” or “Window Frame”.

../_images/ext_b_ncui_frame_vis_options.png

This will then instantiate your UI in either the Viewport or in a Window.

Note

This action needs to be done each time the scene is loaded.

Showing The UI Automatically

When the UI needs to be shown when the Stage is first loaded, an ActionGraph can be used to automatically populate your UI. In this example below you can see how an “OnLoaded” event is used to execute an ActionGraph Script Node that instantiates the menu.

import omni.kit.commands

def compute(db: og.Database):
   omni.kit.commands.execute("ParentToViewport", prim_path="/World/UI/Frame")
   return True
../_images/ext_b_ncui_onload_show_frame.png

The following script can be used in a similar way for removing the current UI from the Viewport when it is no longer needed. This can be from any given ActionGraph event or logic, but typically from an “On Closing” event.

import omni.kit.commands

def compute(db: og.Database):
   omni.kit.commands.execute("RemoveViewportPrim")
   return True