ExtensionContentsStandalone#

class omni.graph.tools.ExtensionContentsStandalone(
ext_id: str,
module: ModuleType,
ext_path: str | Path,
)#

Bases: ExtensionContentsBase

Variation of the ExtensionContents class that handles the case of node types not being part of a build. In this case there is no generated code and the cache is relied on for everything.

Methods

__init__(ext_id, module, ext_path)

Common setup that can be shared by all content managers :param ext_id: Name and version of the extension for which this factory is constructing a manager :param main_module: Top level Python module within the extension being handled :param ext_path: Root directory of the extension

do_python_imports()

Find or create the .ogn and .ogn.tests modules in the extension and import the required files into them

ensure_required_modules_exist()

Make sure the required OGN modules exist.

scan_for_nodes()

Process the already-scanned files to determine the available node types

set_scanned_files(python_files, ogn_files)

Attributes

__init__(
ext_id: str,
module: ModuleType,
ext_path: str | Path,
)#

Common setup that can be shared by all content managers :param ext_id: Name and version of the extension for which this factory is constructing a manager :param main_module: Top level Python module within the extension being handled :param ext_path: Root directory of the extension

do_python_imports()#

Find or create the .ogn and .ogn.tests modules in the extension and import the required files into them

Since all of the work is done when defining the modules this just calls that and returns.

ensure_required_modules_exist() tuple[ModuleType | None, ModuleType | None]#

Make sure the required OGN modules exist.

As this is a standalone extension the modules are created directly from the cache. The cache comprises a package with generated __init__.py file that imports everything so all that is required is to import the cache modules into the proper namespaces.

Returns:

A tuple with the populated .ogn and .ogn.tests modules. If nothing was needed in the modules (e.g. no node definitions or no tests) then the module will be None. As a side effect the tuples are stored on this object for future use.

Raises:

OmniGraphExtensionError if anything that prevents proper registration happens

scan_for_nodes()#

Process the already-scanned files to determine the available node types