ContextMenu

class omni.kit.widget.layers.ContextMenu(usd_context)

Bases: object

Context menu for the layers widget

Methods

__init__(usd_context)

Initializes the ContextMenu with a specific USD context.

add_menu(menu_list)

Add the menu to the end of the context menu.

can_be_set_as_authoring_target()

Check if the selected item can be set as authoring target.

can_delete_prim()

Check if the selected item can be deleted.

can_edit_root_layer()

Check if selected tree view can edit root layer.

can_edit_sublayer()

Check if selected layer item can edit sublayer.

can_edit_sublayer_parent()

Check if selected layer item's parent can edit sublayer.

can_flatten_sublayers()

Check if selected layer item can flatten sublayer.

can_merge_layer_down()

Check if the selected layer item can be merged down.

can_not_edit_sublayer()

Check if selected layer item can edit sublayer.

can_set_as_edit_target()

Check if selected layer can set as edit target.

clear_all_linked_prims(objects)

Clear all the linked prims from a specific layer item.

copy_layer_url()

Deprecated.

copy_url()

Copy the selected item's url to clipboard.

create_anonymous_sublayer()

Create anonymous sublayer for selected layer item.

create_sublayer([anonymous])

Create sublayer for selected layer item.

find_in_browser()

Navigate to selected layer's file if found it in content browser.

flatten_sublayers()

Faltten selected layer item.

has_any_items_selected()

Check any items selected.

has_no_layers_locked()

Check if the selected item has not layers locked.

has_payload_or_reference()

checks if prim has references

has_selections(objects)

If the usd context has selectetions.

has_sublayers()

Check if the selected stage has sublayers.

insert_sublayer()

Insert sublayer into selected layer item.

is_anonymous_layer()

Check if the selected layer item is anonymous layer.

is_authoring_layer()

Check if the selected item is authoring layer.

is_auto_authoring_mode()

Check if the selected item is in auto authoring mode.

is_auto_authoring_or_spec_linking_mode()

Check if the selected item is in spec linking mode or auto authoring mode.

is_edit_layer()

Check if the selected item is edit layer item.

is_from_session_layer_tree()

Check if the selected item is from session layer tree.

is_item_expaned()

Unused.

is_layer_and_parent_unmuted()

Check if the selected layer item is muted and parent muted.

is_layer_dirty()

Check if the selected layer item is dirty.

is_layer_item()

Check if the selected item is layer item.

is_layer_locked()

Check if the selected layer item is locked.

is_layer_locked_by_other()

Deprecated.

is_layer_not_locked()

Check if the selected layer item is not locked.

is_layer_not_locked_by_other()

Check if the selected layer item is not locked by other.

is_layer_or_parent_muted()

Check if the selected layer item is muted or parent muted.

is_layer_read_only()

Check if the selected layer item is not locked.

is_layer_writable()

Check if the selected layer item is writable.

is_live_session_layer()

Check if selected layer item is live session layer.

is_live_syncing_layer()

Check if selected layer item is live syncing layer.

is_material()

Check if the selected item's type is material.

is_missing_layer()

Check if the selected item is missing layer.

is_not_anonymous_layer()

Check if the selected layer item is not anonymous layer.

is_not_authoring_layer()

Check if the selected item is not authoring layer.

is_not_auto_authoring_and_spec_linking_mode()

Check if the selected item is not in spec linking mode and auto authoring mode.

is_not_edit_layer()

Check if the selected item is not edit layer item.

is_not_from_session_layer_tree()

Check if the selected item is not from session layer tree.

is_not_live_layer()

Check if selected layer item is not live syncing layer.

is_not_live_session_layer()

Check if selected layer item is not live session layer.

is_not_missing_layer()

Check if the selected item is not missing layer.

is_not_omni_layer()

Check if the selected item is not omniverse layer.

is_not_reserved_layer()

Check if the selected item is not reserved layer.

is_omni_layer()

Check if the selected item is omniverse layer.

is_over_specifier(objects)

Check if the selected prim item's specifier is 'OVER_ONLY'.

is_prim_spec_item()

Check if the selected item is prim spec item.

is_reserved_layer()

Check if the selected item is reserved layer.

is_spec_linking_mode()

Check if the selected item is in spec linking mode.

link_selected_prims(objects)

Link the selected prims to a specific layer item.

link_selected_prims_with_hierarchy(objects)

Link the selected prims to a specific layer item with hierarchy.

merge_down_one()

Merge selected layer items down to one.

move_prims(objects)

Move selected prim spec item.

no_items_selected()

Check any items selected.

on_mouse_event(event)

Handles mouse events and show context menu based on the event type.

prim_delete()

Delete selected prim spec item.

refresh_reference_payload_name()

checks if prims have references/payload and returns name

reload_layer()

Reload selected layer item.

remove_layer()

Remove selected layer item.

save_layer()

Save selected layer.

save_layer_as()

Save selected layer, it will open a file picker dialog to select save path.

save_layer_as_and_replace()

Save selected layer, it will open a file picker dialog to select save path, and overwrite the exist layer file.

select_linked_prims(objects)

Select the linked prims from a specific layer item.

set_authoring_layer()

Set the selected layer as authoring layer.

set_edit_layer()

Set the selected layer as default edit layer.

show_open_close_tree()

Toggle tree from a specific layer/prim item.

unlink_selected_prims(objects)

Unlink the selected prims to a specific layer item.

unlink_selected_prims_with_hierarchy(objects)

Unlink the selected prims to a specific layer item with hierarchy.

__init__(usd_context)

Initializes the ContextMenu with a specific USD context.

Parameters

usd_context (omni.usd.UsdContext) – The USD context to be associated with this context menu.

static add_menu(menu_list)

Add the menu to the end of the context menu. Return the object that should be alive all the time. Once the returned object is destroyed, the added menu is destroyed as well.

can_be_set_as_authoring_target()

Check if the selected item can be set as authoring target.

Parameters

objects (dict) – A dictionary containing selected item information.

Returns

bool

can_delete_prim()

Check if the selected item can be deleted.

Parameters

objects (dict) – A dictionary containing selected item information.

Returns

bool

can_edit_root_layer()

Check if selected tree view can edit root layer.

Parameters

objects (dict) – A dictionary containing selected item information.

Returns

bool

can_edit_sublayer()

Check if selected layer item can edit sublayer.

Parameters

objects (dict) – A dictionary containing selected item information.

Returns

bool

can_edit_sublayer_parent()

Check if selected layer item’s parent can edit sublayer.

Parameters

objects (dict) – A dictionary containing selected item information.

Returns

bool

can_flatten_sublayers()

Check if selected layer item can flatten sublayer.

Parameters

objects (dict) – A dictionary containing selected item information.

Returns

bool

can_merge_layer_down()

Check if the selected layer item can be merged down.

Parameters

objects (dict) – A dictionary containing selected item information.

Returns

bool

can_not_edit_sublayer()

Check if selected layer item can edit sublayer.

Parameters

objects (dict) – A dictionary containing selected item information.

Returns

bool

can_set_as_edit_target()

Check if selected layer can set as edit target.

Parameters

objects (dict) – A dictionary containing selected item information.

Returns

bool

clear_all_linked_prims(objects)

Clear all the linked prims from a specific layer item.

Parameters

objects (dict) – A dictionary containing selected item information.

copy_layer_url()

Deprecated.

copy_url()

Copy the selected item’s url to clipboard.

Parameters

objects (dict) – A dictionary containing selected item information.

Returns

bool

create_anonymous_sublayer()

Create anonymous sublayer for selected layer item.

Parameters

objects (dict) – A dictionary containing selected item information.

create_sublayer(anonymous=False)

Create sublayer for selected layer item.

Parameters

objects (dict) – A dictionary containing selected item information.

Returns

bool

find_in_browser()

Navigate to selected layer’s file if found it in content browser.

Parameters

objects (dict) – A dictionary containing selected item information.

Returns

bool

flatten_sublayers()

Faltten selected layer item.

Parameters

objects (dict) – A dictionary containing selected item information.

has_any_items_selected()

Check any items selected.

Parameters

objects (dict) – A dictionary containing selected item information.

Returns

True if any item selected, otherwise False.

Return type

bool

has_no_layers_locked()

Check if the selected item has not layers locked.

Parameters

objects (dict) – A dictionary containing selected item information.

Returns

bool

has_payload_or_reference()

checks if prim has references

Parameters

objects (dict) – A dictionary containing selected item information.

Returns

bool

has_selections(objects)

If the usd context has selectetions.

Parameters

objects (dict) – A dictionary containing selected item information.

Returns

True if any thing selected in usd context, otherwise False.

Return type

bool

has_sublayers()

Check if the selected stage has sublayers.

Parameters

objects (dict) – A dictionary containing selected item information.

Returns

bool

insert_sublayer()

Insert sublayer into selected layer item.

Parameters

objects (dict) – A dictionary containing selected item information.

is_anonymous_layer()

Check if the selected layer item is anonymous layer.

Parameters

objects (dict) – A dictionary containing selected item information.

Returns

bool

is_authoring_layer()

Check if the selected item is authoring layer.

Parameters

objects (dict) – A dictionary containing selected item information.

Returns

bool

is_auto_authoring_mode()

Check if the selected item is in auto authoring mode.

Parameters

objects (dict) – A dictionary containing selected item information.

Returns

bool

is_auto_authoring_or_spec_linking_mode()

Check if the selected item is in spec linking mode or auto authoring mode.

Parameters

objects (dict) – A dictionary containing selected item information.

Returns

bool

is_edit_layer()

Check if the selected item is edit layer item.

Parameters

objects (dict) – A dictionary containing selected item information.

Returns

bool

is_from_session_layer_tree()

Check if the selected item is from session layer tree.

Parameters

objects (dict) – A dictionary containing selected item information.

Returns

bool

is_item_expaned()

Unused.

is_layer_and_parent_unmuted()

Check if the selected layer item is muted and parent muted.

Parameters

objects (dict) – A dictionary containing selected item information.

Returns

bool

is_layer_dirty()

Check if the selected layer item is dirty.

Parameters

objects (dict) – A dictionary containing selected item information.

Returns

bool

is_layer_item()

Check if the selected item is layer item.

Parameters

objects (dict) – A dictionary containing selected item information.

Returns

True if selected item is layer item, otherwise True.

Return type

bool

is_layer_locked()

Check if the selected layer item is locked.

Parameters

objects (dict) – A dictionary containing selected item information.

Returns

bool

is_layer_locked_by_other()

Deprecated.

is_layer_not_locked()

Check if the selected layer item is not locked.

Parameters

objects (dict) – A dictionary containing selected item information.

Returns

bool

is_layer_not_locked_by_other()

Check if the selected layer item is not locked by other.

Parameters

objects (dict) – A dictionary containing selected item information.

Returns

bool

is_layer_or_parent_muted()

Check if the selected layer item is muted or parent muted.

Parameters

objects (dict) – A dictionary containing selected item information.

Returns

bool

is_layer_read_only()

Check if the selected layer item is not locked.

Parameters

objects (dict) – A dictionary containing selected item information.

Returns

bool

is_layer_writable()

Check if the selected layer item is writable.

Parameters

objects (dict) – A dictionary containing selected item information.

Returns

bool

is_live_session_layer()

Check if selected layer item is live session layer.

Parameters

objects (dict) – A dictionary containing selected item information.

Returns

bool

is_live_syncing_layer()

Check if selected layer item is live syncing layer.

Parameters

objects (dict) – A dictionary containing selected item information.

Returns

bool

is_material()

Check if the selected item’s type is material.

Parameters

objects (dict) – A dictionary containing selected item information.

Returns

bool

is_missing_layer()

Check if the selected item is missing layer.

Parameters

objects (dict) – A dictionary containing selected item information.

Returns

bool

is_not_anonymous_layer()

Check if the selected layer item is not anonymous layer.

Parameters

objects (dict) – A dictionary containing selected item information.

Returns

bool

is_not_authoring_layer()

Check if the selected item is not authoring layer.

Parameters

objects (dict) – A dictionary containing selected item information.

Returns

bool

is_not_auto_authoring_and_spec_linking_mode()

Check if the selected item is not in spec linking mode and auto authoring mode.

Parameters

objects (dict) – A dictionary containing selected item information.

Returns

bool

is_not_edit_layer()

Check if the selected item is not edit layer item.

Parameters

objects (dict) – A dictionary containing selected item information.

Returns

bool

is_not_from_session_layer_tree()

Check if the selected item is not from session layer tree.

Parameters

objects (dict) – A dictionary containing selected item information.

Returns

bool

is_not_live_layer()

Check if selected layer item is not live syncing layer.

Parameters

objects (dict) – A dictionary containing selected item information.

Returns

bool

is_not_live_session_layer()

Check if selected layer item is not live session layer.

Parameters

objects (dict) – A dictionary containing selected item information.

Returns

bool

is_not_missing_layer()

Check if the selected item is not missing layer.

Parameters

objects (dict) – A dictionary containing selected item information.

Returns

bool

is_not_omni_layer()

Check if the selected item is not omniverse layer.

Parameters

objects (dict) – A dictionary containing selected item information.

Returns

bool

is_not_reserved_layer()

Check if the selected item is not reserved layer.

Parameters

objects (dict) – A dictionary containing selected item information.

Returns

bool

is_omni_layer()

Check if the selected item is omniverse layer.

Parameters

objects (dict) – A dictionary containing selected item information.

Returns

bool

is_over_specifier(objects)

Check if the selected prim item’s specifier is ‘OVER_ONLY’.

Parameters

objects (dict) – A dictionary containing selected item information.

Returns

bool

is_prim_spec_item()

Check if the selected item is prim spec item.

Parameters

objects (dict) – A dictionary containing selected item information.

Returns

True if selected item is prim spec item, otherwise True.

Return type

bool

is_reserved_layer()

Check if the selected item is reserved layer.

Parameters

objects (dict) – A dictionary containing selected item information.

Returns

bool

is_spec_linking_mode()

Check if the selected item is in spec linking mode.

Parameters

objects (dict) – A dictionary containing selected item information.

Returns

bool

Link the selected prims to a specific layer item.

Parameters

objects (dict) – A dictionary containing selected item information.

Link the selected prims to a specific layer item with hierarchy.

Parameters

objects (dict) – A dictionary containing selected item information.

merge_down_one()

Merge selected layer items down to one.

Parameters

objects (dict) – A dictionary containing selected item information.

move_prims(objects)

Move selected prim spec item.

Parameters

objects (dict) – A dictionary containing selected item information.

no_items_selected()

Check any items selected.

Parameters

objects (dict) – A dictionary containing selected item information.

Returns

False if any item selected, otherwise True.

Return type

bool

on_mouse_event(event)

Handles mouse events and show context menu based on the event type.

Parameters

event – An event object containing details about the mouse event.

Returns

None if the module is not found or if the event type is not ACTIVATE.

prim_delete()

Delete selected prim spec item.

Parameters

objects (dict) – A dictionary containing selected item information.

refresh_reference_payload_name()

checks if prims have references/payload and returns name

Parameters

objects (dict) – A dictionary containing selected item information.

Returns

bool

reload_layer()

Reload selected layer item.

Parameters

objects (dict) – A dictionary containing selected item information.

remove_layer()

Remove selected layer item.

Parameters

objects (dict) – A dictionary containing selected item information.

save_layer()

Save selected layer.

Parameters

objects (dict) – A dictionary containing selected item information.

save_layer_as()

Save selected layer, it will open a file picker dialog to select save path.

Parameters

objects (dict) – A dictionary containing selected item information.

save_layer_as_and_replace()

Save selected layer, it will open a file picker dialog to select save path, and overwrite the exist layer file.

Parameters

objects (dict) – A dictionary containing selected item information.

select_linked_prims(objects)

Select the linked prims from a specific layer item.

Parameters

objects (dict) – A dictionary containing selected item information.

set_authoring_layer()

Set the selected layer as authoring layer.

Parameters

objects (dict) – A dictionary containing selected item information.

Returns

bool

set_edit_layer()

Set the selected layer as default edit layer.

Parameters

objects (dict) – A dictionary containing selected item information.

Returns

bool

show_open_close_tree()

Toggle tree from a specific layer/prim item.

Parameters

objects (dict) – A dictionary containing selected item information.

Unlink the selected prims to a specific layer item.

Parameters

objects (dict) – A dictionary containing selected item information.

Unlink the selected prims to a specific layer item with hierarchy.

Parameters

objects (dict) – A dictionary containing selected item information.