PrimPathWidget

class omni.kit.property.usd.PrimPathWidget

Bases: SimplePropertyWidget

A widget for displaying and interacting with USD Prim paths in Omniverse Kit applications.

This widget extends the SimplePropertyWidget to provide a comprehensive interface for USD Prim path manipulation and visualization. It includes features such as renaming Prims, adding attributes, and displaying various Prim properties like instanceability and path. It supports large selection handling and integrates with the application’s notification system for feedback. The widget also incorporates a context menu for additional actions and utilizes a caching mechanism for performance optimization.

Methods

__init__()

Initializes the PrimPathWidget.

add_button_menu_entry(path[, glyph, ...])

Adds a new button menu entry.

add_path_item(draw_fn)

Adds a new path item.

build_items()

Builds the items for the widget based on the current payload.

clean()

Cleans up resources managed by the widget.

get_button_menu_entries()

Retrieves all button menu entries.

get_path_item_padding(padding)

Gets the padding for path items.

get_path_items()

Retrieves all path items.

on_new_payload(payload)

Handles a new payload for the widget.

payload_wrapper(objects, onclick_fn_weak)

Wraps the payload for onclick events.

rebuild()

Requests a rebuild of the widget.

remove_button_menu_entry(item)

Removes a button menu entry.

remove_path_item(draw_fn)

Removes a path item.

reset()

Resets the widget to its initial state.

set_path_item_padding(padding)

Sets the padding for path items.

__init__()

Initializes the PrimPathWidget.

static add_button_menu_entry(path: str, glyph: Optional[str] = None, name_fn=None, show_fn: Optional[Callable] = None, enabled_fn: Optional[Callable] = None, onclick_fn: Optional[Callable] = None, add_to_context_menu: bool = True)

Adds a new button menu entry.

Parameters
  • path (str) – The path where the menu entry will be added.

  • glyph (str, optional) – The icon glyph for the menu entry.

  • name_fn (Callable, optional) – Function to generate the name of the menu entry.

  • show_fn (Callable, optional) – Function to determine if the menu entry should be shown.

  • enabled_fn (Callable, optional) – Function to determine if the menu entry should be enabled.

  • onclick_fn (Callable, optional) – Function to be executed when the menu entry is clicked.

  • add_to_context_menu (bool, optional) – Indicates if the entry should be added to the context menu.

static add_path_item(draw_fn: Callable)

Adds a new path item.

Parameters

draw_fn (Callable) – The function used to draw the path item.

build_items()

Builds the items for the widget based on the current payload.

clean()

Cleans up resources managed by the widget.

static get_button_menu_entries()

Retrieves all button menu entries.

Returns

A list of button menu entries.

Return type

list

static get_path_item_padding(padding: float)

Gets the padding for path items.

Parameters

padding (float) – The padding value to query.

static get_path_items()

Retrieves all path items.

Returns

A list of path items.

Return type

list

on_new_payload(payload)

Handles a new payload for the widget.

Parameters

payload (dict) – The new payload to be handled by the widget.

Returns

True if the payload is handled successfully, otherwise False.

Return type

bool

static payload_wrapper(objects, onclick_fn_weak)

Wraps the payload for onclick events.

Parameters
  • objects (dict) – Objects associated with the onclick event.

  • onclick_fn_weak (Callable) – Weakref to the onclick function to be executed.

static rebuild()

Requests a rebuild of the widget.

static remove_button_menu_entry(item: ButtonMenuEntry)

Removes a button menu entry.

Parameters

item (ButtonMenuEntry) – The menu entry to be removed.

static remove_path_item(draw_fn: Callable)

Removes a path item.

Parameters

draw_fn (Callable) – The function used to draw the path item that will be removed.

reset()

Resets the widget to its initial state.

static set_path_item_padding(padding: float)

Sets the padding for path items.

Parameters

padding (float) – The padding value to be set.