omni.kit.window.content_browser

A window extension for browsing Omniverse content.

class omni.kit.window.content_browser.ContentBrowserExtension

The Content Browser extension

add_connections(connections: dict)

Adds specified server connections to the tree browser.

Parameters

connections (dict) – A dictionary of name, path pairs. For example: {“C:”: “C:”, “ov-content”: “omniverse://ov-content”}. Paths to Omniverse servers should be prefixed with “omniverse://”.

add_context_menu(name: str, glyph: str, click_fn: Callable, show_fn: Callable, index: int = - 1)str

Add menu item, with corresponding callbacks, to the context menu.

Parameters
  • name (str) – Name of the menu item (e.g. ‘Open’), this name must be unique across the context menu.

  • glyph (str) – Associated glyph to display for this menu item.

  • click_fn (Callable) – This callback function is executed when the menu item is clicked. Function signature is void fn(name: str, path: str), where name is menu name and path is absolute path to clicked item.

  • show_fn (Callable) – Returns True to display this menu item. Function signature - bool fn(path: str). For example, test filename extension to decide whether to display a ‘Play Sound’ action.

  • index (int) – The position that this menu item will be inserted to.

Returns

Name of menu item if successful, None otherwise.

Return type

str

add_file_open_handler(name: str, open_fn: Callable, file_type: Union[int, Callable])str

Registers callback/handler to open a file of matching type.

Parameters
  • name (str) – Unique name of handler.

  • open_fn (Callable) – This function is executed when a matching file is selected for open, i.e. double clicked, right mouse menu open, or path submitted to browser bar. Function signature: void open_fn(full_path: str), full_path is the file’s system path.

  • file_type (Union[int, func]) – Can either be an enumerated int that is one of: [FILE_TYPE_USD, FILE_TYPE_IMAGE, FILE_TYPE_SOUND, FILE_TYPE_TEXT, FILE_TYPE_VOLUME] or a more general boolean function that returns True if this function should be activated on the given file. Function signature: bool file_type(full_path: str).

Returns

str - Name if successful, None otherwise.

add_import_menu(name: str, glyph: str, click_fn: Callable, show_fn: Callable)str

Add menu item, with corresponding callbacks, to the Import combo box.

Parameters
  • name (str) – Name of the menu item, this name must be unique across the menu.

  • glyph (str) – Associated glyph to display for this menu item.

  • click_fn (Callable) – This callback function is executed when the menu item is clicked. Function signature: void fn(name: str, path: str), where name is menu name and path is absolute path to clicked item.

  • show_fn (Callable) – Returns True to display this menu item. Function signature: bool fn(path: str). For example, test filename extension to decide whether to display a ‘Play Sound’ action.

Returns

Name of menu item if successful, None otherwise.

Return type

str

add_listview_menu(name: str, glyph: str, click_fn: Callable, show_fn: Callable, index: int = - 1)str

Add menu item, with corresponding callbacks, to the list view menu.

Parameters
  • name (str) – Name of the menu item (e.g. ‘Open’), this name must be unique across the list view menu.

  • glyph (str) – Associated glyph to display for this menu item.

  • click_fn (Callable) – This callback function is executed when the menu item is clicked. Function signature: void fn(name: str, path: str), where name is menu name and path is absolute path to clicked item.

  • show_fn (Callable) – Returns True to display this menu item. Function signature: bool fn(path: str). For example, test filename extension to decide whether to display a ‘Play Sound’ action.

  • index (int) – The position that this menu item will be inserted to.

Returns

Name of menu item if successful, None otherwise.

Return type

str

delete_context_menu(name: str)

Delete the menu item, with the given name, from the context menu.

Parameters

name (str) – Name of the menu item (e.g. ‘Open’).

delete_file_open_handler(name: str)

Unregisters the named file open handler.

Parameters

name (str) – Name of the handler.

delete_import_menu(name: str)

Delete the menu item, with the given name, from the Import combo box.

Parameters

name (str) – Name of the menu item.

delete_listview_menu(name: str)

Delete the menu item, with the given name, from the list view menu.

Parameters

name (str) - Name of the menu item (e.g. 'Open') –

get_current_directory()str

Returns the current directory fom the browser bar.

Returns

The system path, which may be different from the displayed path.

Return type

str

get_current_selections(pane: int = 2)[<class ‘str’>]

Returns current selected as list of system path names.

Parameters

pane (int) – Specifies pane to retrieve selections from, one of {TREEVIEW_PANE = 1, LISTVIEW_PANE = 2, BOTH = None}. Default LISTVIEW_PANE.

Returns

List of system paths (which may be different from displayed paths, e.g. bookmarks)

Return type

[str]

navigate_to(path: str)

Navigates to a path, i.e. the path’s parent directory will be expanded and leaf selected.

Parameters

path (str) – The path to navigate to.

refresh_current_directory()

Refreshes the current directory set in the browser bar.

set_current_directory(path: str)

Procedurally sets the current directory path.

Parameters

path (str) – The full path name of the folder, e.g. “omniverse://ov-content/Users/me.

Raises

RuntimeWarning – If path doesn’t exist or is unreachable.

set_search_delegate(delegate: omni.kit.window.filepicker.search_delegate.SearchDelegate)

Sets a custom search delegate for the tool bar.

Parameters

delegate (SearchDelegate) – Object that creates the search widget.

show_model(model: omni.kit.widget.filebrowser.model.FileBrowserModel)

Displays the given model in the list view, overriding the default model. For example, this model might be the result of a search.

Parameters

model (FileBrowserModel) – Model to display.

show_window(menu, value)

Shows this window. Inputs are for backwards compatibility only and not used.

subscribe_selection_changed(fn: Callable)

Subscribes to file selection changes.

Parameters

fn (Callable) – callback function when file selection changed.

Returns

carb.Subscription object, or None if subscription failed.

toggle_bookmark_from_path(name: str, path: str, is_bookmark: bool)bool

Adds/deletes the given bookmark with the specified path. If deleting, then the path argument is optional.

Parameters
  • name (str) – Name to call the bookmark or existing name if delete.

  • path (str) – Path to the bookmark.

  • is_bookmark (bool) – True to add, False to delete.

Returns

True if successful.

Return type

bool

property window

Main dialog window for this extension.

Type

ui.Window

class omni.kit.window.content_browser.ContentBrowserWindow(import_menu: Optional[omni.kit.window.content_browser.tool_bar.ImportMenu])

The Content Browser window

class omni.kit.window.content_browser.ContentBrowserWidget(**kwargs)

The Content Browser widget

add_file_open_handler(name: str, open_fn: Callable, file_type: Union[int, Callable])str

Registers callback/handler to open a file of matching type.

Parameters
  • name (str) – Unique name of handler.

  • open_fn (Callable) – This function is executed when a matching file is selected for open, i.e. double clicked, right mouse menu open, or path submitted to browser bar. Function signature: void open_fn(full_path: str), full_path is the file’s system path.

  • file_type (Union[int, func]) – Can either be an enumerated int that is one of: [FILE_TYPE_USD, FILE_TYPE_IMAGE, FILE_TYPE_SOUND, FILE_TYPE_TEXT, FILE_TYPE_VOLUME] or a more general boolean function that returns True if this function should be activated on the given file. Function signature: bool file_type(full_path: str).

Returns

Name if successful, None otherwise.

Return type

str

add_import_menu(name: str, glyph: str, click_fn: Callable, show_fn: Callable)str

Adds menu item, with corresponding callbacks, to the Import combo box.

Parameters
  • name (str) – Name of the menu item, this name must be unique across the menu.

  • glyph (str) – Associated glyph to display for this menu item.

  • click_fn (Callable) – This callback function is executed when the menu item is clicked. Function signature: void fn(name: str, path: str), where name is menu name and path is absolute path to clicked item.

  • show_fn (Callable) – Returns True to display this menu item. Function signature: bool fn(path: str). For example, test filename extension to decide whether to display a ‘Play Sound’ action.

Returns

Name of menu item if successful, None otherwise.

Return type

str

property api

Provides API methods to this widget.

Type

FilePickerAPI

delete_file_open_handler(name: str)

Unregisters the named file open handler.

Parameters

name (str) – Name of the handler.

delete_import_menu(name: str)

Deletes the menu item, with the given name, from the Import combo box.

Parameters

name (str) – Name of the menu item.

class omni.kit.window.content_browser.ContentBrowserModel(timeout=3.0)

The model class for ContentBrowserWidget.

add_file_open_handler(name: str, open_fn: Callable, file_type: Union[int, Callable])str

Registers callback/handler to open a file of matching type.

Parameters
  • name (str) – Unique name of handler.

  • open_fn (Callable) – This function is executed when a matching file is selected for open, i.e. double clicked, right mouse menu open, or path submitted to browser bar. Function signature: void open_fn(full_path: str), full_path is the file’s system path.

  • file_type (Union[int, func]) – Can either be an enumerated int that is one of: [FILE_TYPE_USD, FILE_TYPE_IMAGE, FILE_TYPE_SOUND, FILE_TYPE_TEXT, FILE_TYPE_VOLUME] or a more general boolean function that returns True if this function should be activated on the given file. Function signature: bool file_type(full_path: str).

Returns

Name if successful, None otherwise.

Return type

str

delete_file_open_handler(name: str)

Unregisters the named file open handler.

Parameters

name (str) – Name of the handler.

download_items_with_callback(dst_path: str, src_paths: List[str], callback: Optional[Callable] = None)

Downloads specified items. Upon success, executes the given callback.

Parameters
  • dst_path (str) – Destination folder.

  • src_paths ([str]) – Paths of items to download.

  • callback (Callable) – Callback to execute upon success. Function signature is void callback([str]).

Raises

Exception

get_file_open_handler(path: str)Callable

Returns the matching file open handler for the given item.

Parameters

str (path) – The path of the item to open.

async open_stage_async(path: str, open_loadset=UsdContextInitialLoadSet.LOAD_ALL)

Async function for opening a USD file.

Parameters

path (str) – Fullpath to file.

async open_with_new_edit_layer(path: str, open_loadset=UsdContextInitialLoadSet.LOAD_ALL)

Async function for opening a USD file, then creating a new layer.

Parameters

path (str) – Fullpath to file.

subscribe_selection_changed(fn: Callable)carb._carb.Subscription

Subscribes to file selection changes.

Parameters

fn (Callable) – callback function when file selection changed.

Returns

carb.Subscription object.

omni.kit.window.content_browser.get_content_window()omni.kit.window.content_browser.extension.ContentBrowserExtension

Returns cached ContentBrowserExtension interface