We’ve established a series of plugins and have everything running smoothly within one of our DCC platforms. When I attempted running within another DCC I got a slew of exceptions that certain plugins were not for the correct host. I was under the impression that host filtering was done at the api level… do I have to perform additional functionality?
Here’s what I’m currently doing:
Registering the current host
Registering a slew of plugins for a slew of hosts (some are shared some are specific)
Is this possible out of the box to filter plugins based on current host, or am I doing it wrong?
I was looking at the register_discovery_filter function, but it feels overly complex for what I’m attempting to achieve. Is this what I would need to do before registering plugins:
import pyblish.api
class PotatoPlugin(pyblish.api.ContextPlugin):
hosts = ['potato']
class TomatoPlugin(pyblish.api.ContextPlugin):
hosts = ['tomato']
pyblish.api.register_host('tomato')
for plugin in (PotatoPlugin, TomatoPlugin):
pyblish.api.register_plugin(plugin)
An exception is raised while registering PotatoPlugin. It might seem obvious, just use a try/except when registering or don’t include the plugin that doesn’t match the host. In my case I want to register every plugin we develop, and use the host/families/targets to filter what plugins are executed at runtime. Hopefully that makes more sense.