EditMenuExtension

class omni.kit.menu.edit.scripts.edit.EditMenuExtension

Bases: IExt

A class for extending the edit menu functionality within an application.

This class provides mechanisms to manipulate the edit menu by adding, organizing, and handling actions related to selection, duplication, deletion, and other common editing tasks for prims in a USD stage. It integrates with various parts of the application to provide contextual actions based on the current selection, stage events, and user preferences.

The extension supports customization of the edit menu, context menu integration, and responds to stage selection changes to update available actions dynamically. It also includes functionality to manage selection sets, recent selections, and provides utilities for renaming, deactivating, or capturing screenshots of prims.

Methods

__init__()

Initializes the EditMenuExtension object and sets default menu priorities.

can_be_instanced()

Can selected prims be instanced

can_delete()

Can selected prims be deleted (prims do not have no_delete metadata

can_prims_parent()

Can selected prims be Parented

can_prims_unparent()

Can selected prims be Unparented

capture_screenshot([on_complete_fn])

Captures a screenshot of the active viewport or the entire application.

create_xform_to_group()

Groups the selected prims under a new Xform in the USD stage.

deactivate_prims()

Deactivates the selected prim(s) in the USD stage.

delete_prim(destructive)

Deletes the selected prim(s) from the USD stage.

duplicate_prim(duplicate_layers, combine_layers)

Duplicates the selected prim(s) in the USD stage with options for layer handling.

focus_prim()

Focuses the viewport camera on the selected prim(s).

get_screenshot_path(settings)

Get path to save screenshot.

instance_prim()

Creates an instance of the selected prim(s) in the USD stage.

is_in_live_session()

Is kit in live session

is_not_in_live_session()

Is kit not in live session

is_one_prim_selected()

Is a single prim selected

menu_rename_prim_dialog()

on_shutdown()

Cleans up the extension upon shutdown.

on_startup(ext_id)

Initializes the extension upon startup.

parent_prims()

Parents the selected prims to the last selected prim in the USD stage.

post_notification(message[, info, duration])

Posts a notification message to the UI.

prim_selected()

Is one or more prims selected

rename_prim(stage, prim, window, field_widget)

Renames the specified prim in the USD stage.

toggle_global_visibility()

Toggles the global visualization mode in the viewport.

toggle_visibillity()

Toggles the visibility of the selected prim(s) in the viewport.

ungroup_prims()

Ungroups the selected prims in the USD stage.

unparent_prims()

Unparents the selected prims in the USD stage.

__init__()

Initializes the EditMenuExtension object and sets default menu priorities.

static can_be_instanced()

Can selected prims be instanced

static can_delete()

Can selected prims be deleted (prims do not have no_delete metadata

static can_prims_parent()

Can selected prims be Parented

static can_prims_unparent()

Can selected prims be Unparented

static capture_screenshot(on_complete_fn: Optional[callable] = None)

Captures a screenshot of the active viewport or the entire application.

Parameters

on_complete_fn (callable, optional) – A callback function that gets called upon completion of the screenshot capture. Defaults to None.

static create_xform_to_group() bool

Groups the selected prims under a new Xform in the USD stage.

static deactivate_prims()

Deactivates the selected prim(s) in the USD stage.

static delete_prim(destructive)

Deletes the selected prim(s) from the USD stage.

Parameters

destructive (bool) – If True, deletes the prims destructively.

static duplicate_prim(duplicate_layers, combine_layers)

Duplicates the selected prim(s) in the USD stage with options for layer handling.

Parameters
  • duplicate_layers (bool) – If True, duplicates the prims across all layers.

  • combine_layers (bool) – If True, duplicates the prims with references flattened.

static focus_prim()

Focuses the viewport camera on the selected prim(s).

get_screenshot_path(settings)

Get path to save screenshot.

Parameters

settings – carb.settings()

static instance_prim()

Creates an instance of the selected prim(s) in the USD stage.

static is_in_live_session()

Is kit in live session

static is_not_in_live_session()

Is kit not in live session

static is_one_prim_selected()

Is a single prim selected

on_shutdown()

Cleans up the extension upon shutdown.

on_startup(ext_id)

Initializes the extension upon startup.

Parameters

ext_id (str) – The ID of the extension being started.

static parent_prims()

Parents the selected prims to the last selected prim in the USD stage.

static post_notification(message: str, info: bool = False, duration: int = 3)

Posts a notification message to the UI.

Parameters
  • message (str) – The message to be displayed in the notification.

  • info (bool, optional) – If True, displays an info notification; otherwise, a warning. Defaults to False.

  • duration (int, optional) – The duration in seconds for which the notification should be visible. Defaults to 3.

static prim_selected()

Is one or more prims selected

static rename_prim(stage, prim, window, field_widget)

Renames the specified prim in the USD stage.

Parameters
  • stage (Usd.Stage) – The stage where the prim resides.

  • prim (Usd.Prim) – The prim to rename.

  • window (ui.Widget) – The UI window associated with the rename operation.

  • field_widget (ui.StringField) – The UI string field containing the new name for the prim.

static toggle_global_visibility()

Toggles the global visualization mode in the viewport.

static toggle_visibillity()

Toggles the visibility of the selected prim(s) in the viewport.

static ungroup_prims() bool

Ungroups the selected prims in the USD stage.

static unparent_prims()

Unparents the selected prims in the USD stage.