ExtensionManager#

class omni.ext.ExtensionManager#

Bases: pybind11_object

Manages Omniverse extensions: discovery, enable/disable, and registry I/O.

Methods

__init__(*args, **kwargs)

add_path(self, path, type)

Adds a folder to monitored extension paths.

add_path_protocol_provider(self, scheme, ...)

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

add_registry_provider(self, name, provider)

Add registry provider to be used for remote extension registry.

emit_extension_used_event(self, ...[, context])

Helper function to emit a telemetry event indicating that an extension, window, or action was used.

fetch_all_extension_packages(self)

Fetches all extension packages; returns tuple of dicts.

fetch_extension_packages(self, arg0)

Fetches all packages for an extension fullname; returns tuple of dicts.

fetch_extension_summaries(self)

Fetches summaries for all extensions from registry; returns tuple of dicts.

fetch_extension_versions(self, arg0)

Fetches all versions for an extension fullname; returns tuple of dicts.

get_change_event_stream(self)

Gets the change event stream (deprecated).

get_enabled_extension_id(self, ext_name)

Returns the enabled extension id for an extension fullname, if any.

get_enabled_extension_module_names()

Get all python modules of enabled extensions

get_extension_dict(self, ext_id)

Gets the carb.dictionary.Item for an extension id.

get_extension_id_by_module(module)

Get enabled extension id that contains this python module.

get_extension_packages(self)

Returns a tuple of installed extension packages (as dicts).

get_extension_path(self, ext_id)

Gets the on-disk path for an extension id.

get_extension_path_by_module(module)

Get enabled extension path that contains this python module.

get_extensions(self)

Returns a tuple of installed extensions (as dicts).

get_folders(self)

Get folders monitored for python extensions.

get_hooks(self)

Gets the hook interface.

get_registry_extension_dict(self, ext_id)

Gets the registry dictionary for an extension id.

get_registry_extension_packages(self)

Returns a tuple of extension packages available in the registry (as dicts).

get_registry_extensions(self)

Returns a tuple of extensions available in the registry (as dicts).

get_registry_providers(self)

Returns a tuple of registered registry providers (as dicts).

is_extension_enabled(self, ext_name)

Returns True if an extension fullname is currently enabled.

pack_extension(ext_id, output_folder)

Pack extension into archive.

process_and_apply_all_changes(self)

Processes and applies all pending changes.

publish_extension(self, ext_id[, ...])

Publishes an extension to a registry provider.

pull_extension(self, ext_id)

Pulls an extension's content locally.

pull_extension_async(self, ext_id)

Starts an asynchronous pull of an extension.

refresh_registry(self)

Refreshes the extension registry.

remove_path(self, path)

Removes a folder from monitored extension paths.

remove_path_protocol_provider(self, scheme)

Removes a path protocol provider.

remove_registry_provider(self, name)

Remove registry provider.

set_extension_enabled(self, extension_id, ...)

Toggle extension enable/disable.

set_extension_enabled_immediate(self, ...)

Toggle extension enable/disable immediately.

set_extensions_excluded(self, exts)

Set extensions to exclude on following solver/startup routines.

solve_extensions(self, exts[, add_enabled, ...])

Run extension dependencies solver on the input.

subscribe_to_extension_enable(self, ...)

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.

sync_registry(self)

Synchronizes the extension registry.

uninstall_extension(self, ext_id)

Uninstalls an extension from disk.

unpublish_extension(self, ext_id[, ...])

Removes a previously published extension from a provider.

__init__(*args, **kwargs)#
add_path(
self: omni.ext._extensions.ExtensionManager,
path: str,
type: omni.ext._extensions.ExtensionPathType = <ExtensionPathType.COLLECTION: 0>,
) None#

Adds a folder to monitored extension paths.

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:
emit_extension_used_event(
self: omni.ext._extensions.ExtensionManager,
extension_id: str,
window_or_action_name: str,
context: str = '',
) None#

Helper function to emit a telemetry event indicating that an extension, window, or action was used.

This reports that an extension, window, or action was used. This is intended to be emitted at most once for each combination of extension ID and window or action name per session. This is intended to be emitted at key moments of user interaction with an extension, such as executing a command or using a tool provided by the extension. Calling this more than once per extension/window or extension/action combination will have multiple downsides:

  • the resultant data will be inaccurate and misleading - it will no longer be an accurate view of the relative usage frequency of different extensions, windows, or actions.

  • the bandwidth usage related to transmitting this event will increase. This will become bounded only by user activity which will not be deterministic per session.

  • the storage cost for this event will increase significantly and will only be bounded by user activity.

Because of these potential problems, ensuring that calls to this helper function are unique in a session is enforced internally for all combinations of extension ID and window or action name. A caller may still make multiple calls to this helper, but they should do so with the knowledge that repeated calls with the same first two parameters will be silently ignored.

Parameters:
  • extension_id (str) – The name of the extension that was used. This could be the extension that owns a window or UI element that was interacted with, or the extension that registered an action that was used. This may not be an empty string. This must include the extension’s internal name and its version number to ensure the data is useful. For example, `omni.kit.telemetry-0.1.0`.

  • window_or_action_name (str) – The name of the window that was interacted with or the action ID of a registered hotkey that was used. This should be a user friendly display name. This may not be an empty string. For example, `Viewport` or `Content Browser` for windows, or `omni.kit.action.myAction` for actions.

  • context (str, optional) – A caller specified string describing the specific action or feature of the extension that was used. This is only required to provide extra context for why or how the extension, window, or action was used. This may be an empty string if not needed.

Returns:

No return value.

fetch_all_extension_packages(
self: omni.ext._extensions.ExtensionManager,
) tuple#

Fetches all extension packages; returns tuple of dicts.

fetch_extension_packages(
self: omni.ext._extensions.ExtensionManager,
arg0: str,
) tuple#

Fetches all packages for an extension fullname; returns tuple of dicts.

fetch_extension_summaries(
self: omni.ext._extensions.ExtensionManager,
) tuple#

Fetches summaries for all extensions from registry; returns tuple of dicts.

fetch_extension_versions(
self: omni.ext._extensions.ExtensionManager,
arg0: str,
) tuple#

Fetches all versions for an extension fullname; returns tuple of dicts.

get_change_event_stream(
self: omni.ext._extensions.ExtensionManager,
) carb.events._events.IEventStream#

Gets the change event stream (deprecated).

get_enabled_extension_id(
self: omni.ext._extensions.ExtensionManager,
ext_name: str,
) str#

Returns the enabled extension id for an extension fullname, if any.

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#

Gets the carb.dictionary.Item for an extension id.

get_extension_id_by_module(module: str) str#

Get enabled extension id that contains this python module.

get_extension_packages(
self: omni.ext._extensions.ExtensionManager,
) tuple#

Returns a tuple of installed extension packages (as dicts).

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

Gets the on-disk path for an extension id.

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#

Returns a tuple of installed extensions (as dicts).

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#

Gets the hook interface.

get_registry_extension_dict(
self: omni.ext._extensions.ExtensionManager,
ext_id: str,
) carb.dictionary._dictionary.Item#

Gets the registry dictionary for an extension id.

get_registry_extension_packages(
self: omni.ext._extensions.ExtensionManager,
) tuple#

Returns a tuple of extension packages available in the registry (as dicts).

get_registry_extensions(
self: omni.ext._extensions.ExtensionManager,
) tuple#

Returns a tuple of extensions available in the registry (as dicts).

get_registry_providers(
self: omni.ext._extensions.ExtensionManager,
) tuple#

Returns a tuple of registered registry providers (as dicts).

is_extension_enabled(
self: omni.ext._extensions.ExtensionManager,
ext_name: str,
) bool#

Returns True if an extension fullname is currently enabled.

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

process_and_apply_all_changes(
self: omni.ext._extensions.ExtensionManager,
) None#

Processes and applies all pending changes.

publish_extension(
self: omni.ext._extensions.ExtensionManager,
ext_id: str,
provider_name: str = '',
allow_overwrite: bool = False,
) bool#

Publishes an extension to a registry provider.

pull_extension(
self: omni.ext._extensions.ExtensionManager,
ext_id: str,
) bool#

Pulls an extension’s content locally.

pull_extension_async(
self: omni.ext._extensions.ExtensionManager,
ext_id: str,
) None#

Starts an asynchronous pull of an extension.

refresh_registry(
self: omni.ext._extensions.ExtensionManager,
) None#

Refreshes the extension registry.

remove_path(
self: omni.ext._extensions.ExtensionManager,
path: str,
) None#

Removes a folder from monitored extension paths.

remove_path_protocol_provider(
self: omni.ext._extensions.ExtensionManager,
scheme: str,
) None#

Removes a path protocol provider.

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#

Synchronizes the extension registry.

uninstall_extension(
self: omni.ext._extensions.ExtensionManager,
ext_id: str,
) bool#

Uninstalls an extension from disk.

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

Removes a previously published extension from a provider.