Loading...
Searching...
No Matches
HfPluginRegistry Class Reference

Base class for registering Hydra plugins using the plug mechanism. More...

#include <pluginRegistry.h>

Inherited by HdGpGenerativeProceduralPluginRegistry, HdRendererPluginRegistry, and HdSceneIndexPluginRegistry.

Public Member Functions

HF_API void GetPluginDescs (HfPluginDescVector *plugins)
 Returns an ordered list of all registered plugins.
 
HF_API bool GetPluginDesc (const TfToken &pluginId, HfPluginDesc *desc)
 Returns the description for the given plugin id.
 
HF_API void AddPluginReference (HfPluginBase *plugin)
 Increment the reference count on an existing plugin.
 
HF_API void ReleasePlugin (HfPluginBase *plugin)
 Decrement the reference count on the plugin.
 
HF_API bool IsRegisteredPlugin (const TfToken &pluginId)
 Returns true if a plugin has been registered for the given id.
 
HF_API TfToken GetPluginId (const HfPluginBase *plugin) const
 

Protected Member Functions

HF_API HfPluginRegistry (const TfType &pluginBaseType)
 Constructs a Plugin Registry.
 
HF_API HfPluginBaseGetPlugin (const TfToken &pluginId)
 Returns the plugin from the given pluginId.
 
virtual HF_API void _CollectAdditionalMetadata (const PlugRegistry &plugRegistry, const TfType &pluginType)
 Gives subclasses an opportunity to inspect plugInfo-based metadata at the time of discovery.
 

Static Protected Member Functions

template<typename T , typename PluginBaseType , typename... Bases>
static void Define ()
 Entry point for registering a types implementation.
 

Detailed Description

Base class for registering Hydra plugins using the plug mechanism.

It is expected that each plugin has a pluginfo.json file that contains a list of types, where each type provides a list of base classes, displayName and priority.

The priority is used to order plugins, with the plugin with the highest priority being at the front of the order. priority is a signed integer. In the event of two plugins having the same priority, the plugins are sorted alphabetically on the type name.

The plugin sorted to the front is used as the default plugin, when not specified.

Example:

{ "Types": { "CPPTypeName": { "bases": ["BaseTypeName"], "displayName": "Human Readable Name", "priority" : 0 } } }

Definition at line 71 of file pluginRegistry.h.

Constructor & Destructor Documentation

◆ HfPluginRegistry()

HF_API HfPluginRegistry ( const TfType pluginBaseType)
protected

Constructs a Plugin Registry.

pluginBaseType is the TfType of the class derived from HfPluginBase that provides the plugin API.

Member Function Documentation

◆ _CollectAdditionalMetadata()

virtual HF_API void _CollectAdditionalMetadata ( const PlugRegistry plugRegistry,
const TfType pluginType 
)
protectedvirtual

Gives subclasses an opportunity to inspect plugInfo-based metadata at the time of discovery.

◆ AddPluginReference()

HF_API void AddPluginReference ( HfPluginBase plugin)

Increment the reference count on an existing plugin.

◆ Define()

void Define
staticprotected

Entry point for registering a types implementation.

T is the plugin being registered. PluginBaseType is the HfPluginBase derived class that specifies the API (the same one the TfType is for in the constructor).

Bases optionally specifies other classes that T is derived from.

Definition at line 204 of file pluginRegistry.h.

◆ GetPlugin()

HF_API HfPluginBase * GetPlugin ( const TfToken pluginId)
protected

Returns the plugin from the given pluginId.

The reference count on the plugin is automatically increased.

◆ GetPluginDesc()

HF_API bool GetPluginDesc ( const TfToken pluginId,
HfPluginDesc desc 
)

Returns the description for the given plugin id.

The plugin may not be loaded or been actually created yet.

◆ GetPluginDescs()

HF_API void GetPluginDescs ( HfPluginDescVector *  plugins)

Returns an ordered list of all registered plugins.

The plugins are ordered by priority then alphabetically

◆ IsRegisteredPlugin()

HF_API bool IsRegisteredPlugin ( const TfToken pluginId)

Returns true if a plugin has been registered for the given id.

The plugin may not be loaded or been actually created yet.

◆ ReleasePlugin()

HF_API void ReleasePlugin ( HfPluginBase plugin)

Decrement the reference count on the plugin.

If the reference count get to 0, the plugin is freed.


The documentation for this class was generated from the following file: