diff --git a/meshroom/core/plugins.py b/meshroom/core/plugins.py index ac8c92a9..e75af08c 100644 --- a/meshroom/core/plugins.py +++ b/meshroom/core/plugins.py @@ -148,6 +148,16 @@ class Plugin(BaseObject): if file.endswith(".mg"): self._templates[os.path.splitext(file)[0]] = os.path.join(self.path, file) + def containsNodePlugin(self, name: str) -> bool: + """ + Return whether the node plugin "name" is part of the plugin, independently from its + status. + + Args: + name: the name of the node plugin to be checked. + """ + return name in self._nodePlugins + class NodePlugin(BaseObject): """ @@ -231,6 +241,22 @@ class NodePluginManager(BaseObject): """ return name in self._nodePlugins + def belongsToPlugin(self, name: str) -> Plugin: + """ + Check whether the node plugin belongs to a loaded plugin, independently from + whether it has been registered or not. + + Args: + name: the name of the node plugin that needs to be searched for across plugins. + + Returns: + Plugin | None: the Plugin the node belongs to if it exists, None otherwise. + """ + for plugin in self._plugins.values(): + if plugin.containsNodePlugin(name): + return plugin + return None + def getPlugins(self) -> dict[str: Plugin]: """ Return a dictionary containing all the loaded Plugins, with {key, value} =