omni.ext module

class omni.ext.DownloadState

Bases: pybind11_builtins.pybind11_object

Index/Extension Download States.

Members:

DOWNLOADING

DOWNLOAD_SUCCESS

DOWNLOAD_FAILURE

DOWNLOADING = DownloadState.DOWNLOADING
DOWNLOAD_FAILURE = DownloadState.DOWNLOAD_FAILURE
DOWNLOAD_SUCCESS = DownloadState.DOWNLOAD_SUCCESS
property name

handle) -> str

Type

(self

class omni.ext.ExtensionManager

Bases: pybind11_builtins.pybind11_object

add_path(self: omni.ext._extensions.ExtensionManager, path: str, type: omni.ext._extensions.ExtensionPathType = ExtensionPathType.COLLECTION)None
add_path_protocol_provider(self: omni.ext._extensions.ExtensionManager, scheme: str, on_add_path_fn: Callable[[str], str], on_remove_path_fn: Callable[[str], None])bool

Add new path protocol provider, scheme must be unique false returned otherwise.

Parameters
  • scheme (str) – Scheme name.

  • fn (Callable[[str], str]) – The callback to be called when new search path is added for this scheme.

add_registry_provider(self: omni.ext._extensions.ExtensionManager, name: str, provider: omni::ext::IRegistryProvider)bool

Add registry provider to be used for remote extension registry.

Parameters
fetch_extension_packages(self: omni.ext._extensions.ExtensionManager, arg0: str)tuple
fetch_extension_summaries(self: omni.ext._extensions.ExtensionManager)tuple
fetch_extension_versions(self: omni.ext._extensions.ExtensionManager, arg0: str)tuple
get_change_event_stream(self: omni.ext._extensions.ExtensionManager)carb.events._events.IEventStream
get_enabled_extension_id(self: omni.ext._extensions.ExtensionManager, ext_name: str)str
get_enabled_extension_module_names()

Get all python modules of enabled extensions

get_extension_dict(self: omni.ext._extensions.ExtensionManager, ext_id: str)carb.dictionary._dictionary.Item
get_extension_id_by_module(module: str)str

Get enabled extension id that contains this python module.

get_extension_path(self: omni.ext._extensions.ExtensionManager, ext_id: str)str
get_extension_path_by_module(module: str)str

Get enabled extension path that contains this python module.

get_extensions(self: omni.ext._extensions.ExtensionManager)tuple
get_folders(self: omni.ext._extensions.ExtensionManager)tuple

Get folders monitored for python extensions.

Returns (List[Dict]):

List of folders. Each folder is dict with “path” and “builtin” key.

get_hooks(self: omni.ext._extensions.ExtensionManager)omni::ext::IExtensionManagerHooks
get_registry_extension_dict(self: omni.ext._extensions.ExtensionManager, ext_id: str)carb.dictionary._dictionary.Item
get_registry_extension_packages(self: omni.ext._extensions.ExtensionManager)tuple
get_registry_extensions(self: omni.ext._extensions.ExtensionManager)tuple
get_registry_providers(self: omni.ext._extensions.ExtensionManager)tuple
is_extension_enabled(self: omni.ext._extensions.ExtensionManager, ext_name: str)bool
pack_extension(ext_id: str, output_folder: str)str

Pack extension into archive.

Supports both single file extensions (kit files) and folders.

Parameters
  • ext_id (str) – Local extension id.

  • output_folder – Folder to output archive into.

Returns

Path to archived extension.

Return type

str

publish_extension(self: omni.ext._extensions.ExtensionManager, ext_id: str, provider_name: str = '', allow_overwrite: bool = False)bool
pull_extension(self: omni.ext._extensions.ExtensionManager, ext_id: str)bool
pull_extension_async(self: omni.ext._extensions.ExtensionManager, ext_id: str)None
refresh_registry(self: omni.ext._extensions.ExtensionManager)None
remove_path(self: omni.ext._extensions.ExtensionManager, path: str)None
remove_path_protocol_provider(self: omni.ext._extensions.ExtensionManager, scheme: str)None
remove_registry_provider(self: omni.ext._extensions.ExtensionManager, name: str)None

Remove registry provider.

Parameters

name (str) – Provider unique name.

set_extension_enabled(self: omni.ext._extensions.ExtensionManager, extension_id: str, enabled: bool)None

Toggle extension enable/disable.

Parameters
  • extension_id (str) – Extension id. Full python module name, returned by get_extensions.

  • enabled (bool) – Enable/disable toggle.

set_extension_enabled_immediate(self: omni.ext._extensions.ExtensionManager, extension_id: str, enabled: bool)bool

Toggle extension enable/disable immediately.

Parameters
  • extension_id (str) – Extension id. Full python module name, returned by get_extensions.

  • enabled (bool) – Enable/disable toggle.

Returns (bool):

Failure or success.

set_extensions_excluded(self: omni.ext._extensions.ExtensionManager, exts: List[str])None

Set extensions to exclude on following solver/startup routines. They persist until next call to this function.

Parameters

extensions (List[str]) – List Extension id with or without versions.

solve_extensions(self: omni.ext._extensions.ExtensionManager, exts: List[str], add_enabled: bool = False, return_only_disabled: bool = False)tuple

Run extension dependencies solver on the input.

Input is a list of extension, they can be names, full id, partial versions like ommi.foo-2.

Parameters
  • exts (List[str]) – List of extensions.

  • add_enabled (bool) – Automatically add already enabled extension to the input (to take into account)

  • return_only_disabled (bool) – If true exclude from the result extensions that are currently already enabled

Returns(Tuple[bool, List[str], str]):

Tuple of result, list of extensions (solution) and error message.

subscribe_to_extension_enable(self: omni.ext._extensions.ExtensionManager, on_enable_fn: Callable[[str], None], on_disable_fn: Callable[[str], None] = None, ext_name: str = '', hook_name: str = '')Tuple[omni::ext::IHookHolder, omni::ext::IHookHolder]

Call callback if extension is enabled and hook in extension system to wait for extension to be enabled again (after reload for instance) and disabled.

Example:

def on_ext_enabled(ext_id: str):
    print("enabled:" + ext_id)

def on_ext_disabled(ext_id: str):
    print("disabled:" + ext_id)

manager = omni.kit.app.get_app().get_extension_manager()
self.hooks = manager.subscribe_to_extension_enable(on_ext_enabled, on_ext_disabled, ext_name="omni.kit.window.console", hook_name="la la la")
# Notice that we stored subscription holder somewhere (in self for instance) to hold it.
Parameters
  • on_enable_fn (Callable[[str]]) – The callback to be called when extension is enabled. It accepts extension id.

  • on_disable_fn (Callable[[str]], optional) – The callback to be called when extension is disabled. It accepts extension id.

  • ext_name (str, optional) – Extension name to look for. Hook is only called for extensions with matching name. Can be empty.

  • hook_name (str) – Hook name for debugging and logging.

Returns

Pair of hook holders.

sync_registry(self: omni.ext._extensions.ExtensionManager)bool
unpublish_extension(self: omni.ext._extensions.ExtensionManager, ext_id: str, provider_name: str = '')bool
class omni.ext.ExtensionPathType

Bases: pybind11_builtins.pybind11_object

Index Refresh States.

Members:

COLLECTION

COLLECTION_USER

COLLECTION_CACHE

DIRECT_PATH

EXT_1_FOLDER

COLLECTION = ExtensionPathType.COLLECTION
COLLECTION_CACHE = ExtensionPathType.COLLECTION_CACHE
COLLECTION_USER = ExtensionPathType.COLLECTION_USER
DIRECT_PATH = ExtensionPathType.DIRECT_PATH
EXT_1_FOLDER = ExtensionPathType.EXT_1_FOLDER
property name

handle) -> str

Type

(self

class omni.ext.ExtensionStateChangeType

Bases: pybind11_builtins.pybind11_object

Members:

BEFORE_EXTENSION_ENABLE

AFTER_EXTENSION_ENABLE

BEFORE_EXTENSION_DISABLE

AFTER_EXTENSION_DISABLE

COUNT

AFTER_EXTENSION_DISABLE = ExtensionStateChangeType.AFTER_EXTENSION_DISABLE
AFTER_EXTENSION_ENABLE = ExtensionStateChangeType.AFTER_EXTENSION_ENABLE
BEFORE_EXTENSION_DISABLE = ExtensionStateChangeType.BEFORE_EXTENSION_DISABLE
BEFORE_EXTENSION_ENABLE = ExtensionStateChangeType.BEFORE_EXTENSION_ENABLE
COUNT = ExtensionStateChangeType.COUNT
property name

handle) -> str

Type

(self

class omni.ext.ICppExt

Bases: pybind11_builtins.pybind11_object

shutdown(self: omni.ext._extensions.ICppExt)None
startup(self: omni.ext._extensions.ICppExt, arg0: str)None
class omni.ext.IExt

Bases: omni.ext._extensions.ICppExt

class omni.ext.IExtensionManagerHooks

Bases: pybind11_builtins.pybind11_object

create_extension_state_change_hook(self: omni.ext._extensions.IExtensionManagerHooks, fn: Callable[[str, omni.ext._extensions.ExtensionStateChangeType], None], type: omni.ext._extensions.ExtensionStateChangeType, ext_name: str = '', ext_dict_path: str = '', order: int = 0, hook_name: str = '')omni.ext._extensions.IHookHolder

Create extension state change hook.

Hook is valid while returned hook holder object is alive.

Parameters
  • fn (Callable[[str, ExtensionStateChangeType]]) – The callback to be called on extension state change event. It accepts extension id and type of hook event.

  • type (ExtensionStateChangeType) – Extension state change moment to hook into.

  • ext_name (str, optional) – Extension name to look for. Hook is only called for extensions with matching name. Can be empty.

  • ext_dict_path (str, optional) – Extension dictionary path to look for. Hook is only called if it is present.

  • order (int, optional) – Hook call order (if there are multiple).

  • hook_name (str) – Hook name for debugging and logging.

Returns

The hook holder.

class omni.ext.IExtensions

Bases: pybind11_builtins.pybind11_object

create_extension_manager(self: omni.ext._extensions.IExtensions, arg0: carb.events._events.IEventStream)omni.ext._extensions.ExtensionManager
class omni.ext.IHookHolder

Bases: pybind11_builtins.pybind11_object

Hook holder.

class omni.ext.IRegistryProvider

Bases: pybind11_builtins.pybind11_object

omni.ext.acquire_ext_interface(plugin_name: str = None, library_path: str = None)omni.ext._extensions.ICppExt
omni.ext.acquire_extensions_interface(plugin_name: str = None, library_path: str = None)omni.ext._extensions.IExtensions

Creates a symbolic link from ‘link_path’ to ‘target_path’

Parameters
  • link_path – Absolute or relative path to link to create

  • target_path – Absolute or relative path to target; if relative then it is relative to ‘link_path’

  • target_is_dir – This boolean is only used on Windows to specify if the target is a directory or file.

Destroys an existing file system link

Parameters

link_folder_path – Path to linked folder to destroy.

omni.ext.get_extensions_interface()omni.ext._extensions.IExtensions

Returns cached omni.ext.IExtensions interface

omni.ext.pack_extension(package_id: str, ext_path: str, output_folder: str)str

Pack extension into archive.

Supports both single file extensions (kit files) and folders.

Parameters
  • package_id (str) – Extension package id. Resulting archive will be [package_id].zip

  • ext_path (str) – Path to extension folder or file.

  • output_folder – Folder to output archive into.

Returns

Path to archived extension.

Return type

str

omni.ext.release_ext_interface(arg0: omni.ext._extensions.ICppExt)None
omni.ext.unpack_extension(archive_path: str, output_folder: str, ext_id: Optional[str] = None, archive_subdir: Optional[str] = None)

Unpack extenson making it ready to use if output folder is in extension search paths.

Supports both single file extensions (kit files) and folders.

Parameters
  • archive_path (str) – Path to archive.

  • output_folder – Folder to unpack extension into.

  • ext_id (str) – Extension id to use to build folder name. By default acrhive filename is used.

  • archive_subdir (str) – Subdir in the archive to unpack, by default archive root is used.