Support same named plugins

Goal

To be able to have two plugins named the same, and have Pyblish process both plugins.

Motivation

With an increasing amount of plugins across different packages, finding unique names for plugins becomes difficult.

Implementation

The following two Collectors should execute and generate two instances; A and B.

import pyblish.api


class Collect(pyblish.api.ContextPlugin):

    order = pyblish.api.CollectorOrder

    def process(self, context):

        context.create_instance(name="A")


pyblish.api.register_plugin(Collect)


class Collect(pyblish.api.ContextPlugin):

    order = pyblish.api.CollectorOrder

    def process(self, context):

        context.create_instance(name="B")

pyblish.api.register_plugin(Collect)

I can see the immediate convenience, and technically it might not be an issue thanks to the unique id of each plug-in, but aren’t we just moving the problem to where it becomes difficult to debug?

For example, how will you know which of these are causing problems? In the terminal, it would output the problem along with the name of the plug-in.

Currently, they all require a unique name, and their label attribute is provided to enable you to both condense and prettify their names in GUIs.

class MyUniqueCollector(...):
  label = "Collect"

If you use the package as a namespace to the name of each plug-in, you could avoid this and as an added bonus also efficiently be able to tell which groups of plug-ins have an implicit relationship.

- CollectStarterInstances
- ValidateStarterModel
- IntegrateStarterInstance
- NapoleonCollector
- NapoleonValidateNormals
- NapoleonExtractObj
- Collect
- ValidateName
- Integrate

See how it’s difficult to tell whether the last three work together, or are independent? Now picture all of the above without the package in the name.

That might be the workflow piece, I’m missing :smile:

1 Like

With this workflow of having long descriptive names, and short names for the GUI, it can be difficult to narrow down where a plugin lives.

This has been solved in pyblish-qml with the Perspective view, and would be solved as well for pyblish-lite. I would argue that it might be useful to easily toggle between the label names and the full class names.

This could be a setting for each GUI, where you toggle the label names on or off. What do you think?

I like it.

Important to remember perhaps the two different audiences involved here, such a toggle would be useful for developers, but not so much for artists.

Definitely I’m being entirely selfish here :smile:

I’ll put a PR together for it.