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 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
-
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 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
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
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 the menu item, with the given name, from the Import combo box.
- Parameters
name (str) – Name of the menu item.
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
-
get_current_selections
(pane: int = 2) → [<class ‘str’>]¶ Returns current selected as list of system path names.
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.
-
-
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
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
-
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.
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
(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
-
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.
-
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.
-
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
-
-
omni.kit.window.content_browser.
get_content_window
() → omni.kit.window.content_browser.extension.ContentBrowserExtension¶ Returns cached
ContentBrowserExtension
interface