frame_viewport_selection#

omni.kit.viewport.utility.frame_viewport_selection(
viewport_api=None,
force_legacy_api: bool = False,
)#

Frames the camera in the viewport to include the current selection.

This function adjusts the camera in the viewport to frame the currently selected objects. If no objects are selected, it adjusts the camera to show the entire scene.

Parameters:
  • viewport_api (ViewportAPI, optional) – The viewport API instance to operate on. If not provided, the active viewport is used.

  • force_legacy_api (bool, optional) – If set to True, forces the use of the legacy viewport API. Defaults to False.

Returns:

True if the operation was successful, False otherwise.

Return type:

bool