omni.kit.window.content_browser

A window extension for browsing Omniverse content.

class omni.kit.window.content_browser.ContentBrowserExtension(self: omni.ext._extensions.IExt)None

Bases: omni.ext._extensions.IExt

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)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 (func) – 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 (func) – 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_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 (func) – 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] 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 (func) – 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 (func) – 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)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 (func) – 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 (func) – 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

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.

show_window(menu, value)

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

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

Bases: object

The Content Browser window

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

Bases: object

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 (func) – 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] 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 (func) – 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 (func) – 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.

search(text, search_engine)

Recursively searches specified text in the current folder and its sub-folders.

Parameters

text (str) – Search term.

class omni.kit.window.content_browser.ContentBrowserModel(theme='NvidiaDark', timeout=3.0)

Bases: omni.kit.window.filepicker.model.FilePickerModel

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 (func) – 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] 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

copy_items_with_callback(dst_item: omni.kit.widget.filebrowser.model.FileBrowserItem, src_paths: [<class 'str'>], callback: Callable = None)

Copies items. Upon success, executes the given callback.

Parameters
  • dst_item (str) – Destination item.

  • src_items ([FileBrowserItem]) – Items to copy.

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

Raises

Exception

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_items: [<class 'omni.kit.widget.filebrowser.model.FileBrowserItem'>], callback: Callable = None)

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

Parameters
  • dst_path (str) – Destination folder.

  • src_items ([FileBrowserItem]) – Items to download.

  • callback (func) – 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

item (FileBrowserItem) – The item in quesetion.

item_filter_fn(item: omni.kit.widget.filebrowser.model.FileBrowserItem)bool

Default item filter callback. Returning True makes the item visible.

Parameters

item (FileBrowseritem) – Item in question.

Returns

bool

async open_stage_async(path: str)

Async function for opening a USD file.

Parameters

path (str) – Fullpath to file.

async open_with_new_edit_layer(path: str)

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

Parameters

path (str) – Fullpath to file.

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

Returns cached ContentBrowserExtension interface