24#ifndef PXR_BASE_PLUG_PLUGIN_H
25#define PXR_BASE_PLUG_PLUGIN_H
28#include "pxr/base/plug/api.h"
39PXR_NAMESPACE_OPEN_SCOPE
43class Plug_RegistrationMetadata;
69#ifdef PXR_PYTHON_SUPPORT_ENABLED
103 return _resourcePath;
126 const std::string & name,
127 const std::string & resourcePath,
128 const JsObject & plugInfo,
132 static PlugPluginPtr _GetPluginForType(
const TfType & type);
135 static void _RegisterAllPlugins();
137 static PlugPluginPtr _GetPluginWithName(
const std::string& name);
139 static PlugPluginPtrVector _GetAllPlugins();
141 template <
class PluginMap>
143 static std::pair<PlugPluginPtr, bool>
144 _NewPlugin(
const Plug_RegistrationMetadata &metadata,
146 const std::string& pluginCreationPath,
147 PluginMap *allPluginsByNamePtr);
150 static std::pair<PlugPluginPtr, bool>
151 _NewDynamicLibraryPlugin(
const Plug_RegistrationMetadata& metadata);
153#ifdef PXR_PYTHON_SUPPORT_ENABLED
155 static std::pair<PlugPluginPtr, bool>
156 _NewPythonModulePlugin(
const Plug_RegistrationMetadata& metadata);
160 static std::pair<PlugPluginPtr, bool>
161 _NewResourcePlugin(
const Plug_RegistrationMetadata& metadata);
167 void _DeclareAliases(
TfType t,
const JsObject & metadata );
169 void _DeclareTypes();
171 void _DeclareType(
const std::string &name,
const JsObject &dict);
173 static void _DefineType(
TfType t );
177 bool _LoadWithDependents(_SeenPlugins * seenPlugins);
180 static void _UpdatePluginMaps(
const TfType & baseType );
183 static constexpr char const *_GetPluginTypeDisplayName(_Type type);
188 std::string _resourcePath;
191 std::atomic<bool> _isLoaded;
203PlugFindPluginResource(
const PlugPluginPtr& plugin,
204 const std::string& path,
bool verify =
true);
206PXR_NAMESPACE_CLOSE_SCOPE
Defines an interface to registered plugins.
std::string const & GetName() const
Returns the plugin's name.
std::string const & GetResourcePath() const
Returns the plugin's resources filesystem path.
PLUG_API bool IsLoaded() const
Returns true if the plugin is currently loaded.
PLUG_API JsObject GetMetadataForType(const TfType &type)
Returns the metadata sub-dictionary for a particular type.
PLUG_API bool DeclaresType(const TfType &type, bool includeSubclasses=false) const
Returns true if type is declared by this plugin.
PLUG_API JsObject GetDependencies()
Returns the dictionary containing the dependencies for the plugin.
PLUG_API std::string MakeResourcePath(const std::string &path) const
Build a plugin resource path by returning a given absolute path or combining the plugin's resource pa...
std::string const & GetPath() const
Returns the plugin's filesystem path.
PLUG_API bool Load()
Loads the plugin.
PLUG_API JsObject GetMetadata()
Returns the dictionary containing meta-data for the plugin.
PLUG_API std::string FindPluginResource(const std::string &path, bool verify=true) const
Find a plugin resource by absolute or relative path optionally verifying that file exists.
PLUG_API bool IsPythonModule() const
Returns true if the plugin is a python module.
PLUG_API bool IsResource() const
Returns true if the plugin is resource-only.
Defines an interface for registering plugins.
TfType represents a dynamic runtime type.
Enable a concrete base class for use with TfWeakPtr.
Standard pointer typedefs.
#define TF_DECLARE_WEAK_PTRS(type)
Define standard weak pointer types.