Loading...
Searching...
No Matches
Plug: Plugin Framework

Overview

Provides a plug-in framework implementation. The PlugPlugin class defines the interface to plug-in modules. The PlugRegistry class defines a mechanism for discovering and registering plug-in modules both automatically upon first use and manually at run-time by client calls to PlugRegistry::RegisterPlugins. PlugRegistry sends the PlugNotice::DidRegisterPlugins notice when new plug-ins are registered (both when Plug is first used and again for subsequent calls to PlugRegistry::RegisterPlugins).

PlugRegistry also provides a mechanism to find TfType objects for types defined in plug-ins, then find the plug-ins that provide those types, and read metadata related to those plug-ins and the contained types, and load the plug-ins.

The PlugPlugin class contains properties that indicate whether or not a plug-in is currently loaded and whether a plug-in is a Python module or a C++ shared library. It also includes functions that return a plug-in's name, location in the file system, the names of its base classes, its metadata, and any existing dependencies.

Plug-In Discovery & Registration

The PlugRegistry class discovers plug-ins both on first use and in response to calls to PlugRegistry::RegisterPlugins. This means that plugin-dependent code should listen to the PlugNotice::DidRegisterPlugins notification in order to update appropriately if new plugins are registered during the course of a running program.

Usage

For information on how to add concrete plug-in types to applications like Presto, see the API documentation for the libraries that implement functionality for those types of components. For example, the Mf library includes functions for registering prim plug-ins; the Wd library includes functions for registering GUI components such as editor plug-ins.

Metadata

Plug-ins are found and described using plugInfo.json files that may be read without loading the plugin. The structure of a plugInfo.json file is described in detail in the PlugRegistry class.