24 #ifndef PXR_BASE_PLUG_PLUGIN_H
25 #define PXR_BASE_PLUG_PLUGIN_H
28 #include "pxr/base/plug/api.h"
40 PXR_NAMESPACE_OPEN_SCOPE
44 class Plug_RegistrationMetadata;
70 #ifdef PXR_PYTHON_SUPPORT_ENABLED
71 PLUG_API
bool IsPythonModule()
const;
73 #endif // PXR_PYTHON_SUPPORT_ENABLED
104 return _resourcePath;
115 PLUG_API std::string
FindPluginResource(
const std::string& path,
bool verify =
true)
const;
120 #ifdef PXR_PYTHON_SUPPORT_ENABLED
122 #endif // PXR_PYTHON_SUPPORT_ENABLED
129 const std::string & name,
130 const std::string & resourcePath,
131 const JsObject & plugInfo,
135 static PlugPluginPtr _GetPluginForType(
const TfType & type);
138 static void _RegisterAllPlugins();
140 static PlugPluginPtr _GetPluginWithName(
const std::string& name);
142 static PlugPluginPtrVector _GetAllPlugins();
144 template <
class PluginMap>
146 static std::pair<PlugPluginPtr, bool>
147 _NewPlugin(
const Plug_RegistrationMetadata &metadata,
149 const std::string& pluginCreationPath,
150 PluginMap *allPluginsByNamePtr);
153 static std::pair<PlugPluginPtr, bool>
154 _NewDynamicLibraryPlugin(
const Plug_RegistrationMetadata& metadata);
156 #ifdef PXR_PYTHON_SUPPORT_ENABLED
158 static std::pair<PlugPluginPtr, bool>
159 _NewPythonModulePlugin(
const Plug_RegistrationMetadata& metadata);
160 #endif // PXR_PYTHON_SUPPORT_ENABLED
163 static std::pair<PlugPluginPtr, bool>
164 _NewResourcePlugin(
const Plug_RegistrationMetadata& metadata);
170 void _DeclareAliases(
TfType t,
const JsObject & metadata );
172 void _DeclareTypes();
174 void _DeclareType(
const std::string &name,
const JsObject &dict);
176 static void _DefineType(
TfType t );
180 bool _LoadWithDependents(_SeenPlugins * seenPlugins);
183 static void _UpdatePluginMaps(
const TfType & baseType );
186 static constexpr
char const *_GetPluginTypeDisplayName(_Type type);
191 std::string _resourcePath;
194 std::atomic<bool> _isLoaded;
206 PlugFindPluginResource(
const PlugPluginPtr& plugin,
207 const std::string& path,
bool verify =
true);
209 PXR_NAMESPACE_CLOSE_SCOPE
211 #endif // PXR_BASE_PLUG_PLUGIN_H
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 & GetResourcePath() const
Returns the plugin's resources filesystem path.
PLUG_API JsObject GetMetadata()
Returns the dictionary containing meta-data for the plugin.
Standard pointer typedefs.
Defines an interface for registering plugins.
PLUG_API JsObject GetMetadataForType(const TfType &type)
Returns the metadata sub-dictionary for a particular type.
std::string const & GetPath() const
Returns the plugin's filesystem path.
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...
Pointer storage with deletion detection.
#define TF_DECLARE_WEAK_AND_REF_PTRS(type)
Define standard weak, ref, and vector pointer types.
PLUG_API JsObject GetDependencies()
Returns the dictionary containing the dependencies for the plugin.
PLUG_API bool IsResource() const
Returns true if the plugin is resource-only.
Enable a concrete base class for use with TfRefPtr.
PLUG_API bool DeclaresType(const TfType &type, bool includeSubclasses=false) const
Returns true if type is declared by this plugin.
Defines an interface to registered plugins.
std::string const & GetName() const
Returns the plugin's name.
TfType represents a dynamic runtime type.
PLUG_API bool Load()
Loads the plugin.
Enable a concrete base class for use with TfWeakPtr.
PLUG_API bool IsLoaded() const
Returns true if the plugin is currently loaded.