Can I use multiple collectors in tk-multi-publish2?

Hey Matt

Welcome to the forums!!

In a way, you’re correct in that you can only have one collector per Publish2 settings block, unlike the plugins where you can list multiple. However, you can use inheritance to subclass the base collector plugin.

When setting the hook paths you can define a chain of inheritance by separating the paths using :.
In your example, the order of inheritance is (from base to subclasses)

  1. The collector from the publish2 app ({self}/collector.py).
  2. Then you have the engine’s implementation of the collector {engine}/tk-multi-publish2/basic/collector.py
  3. Then your mesh collector {config}/tk-multi-publish2/maya/collector_mesh.py
  4. And finally your {config}/tk-multi-publish2/maya/collector_camera.py

So in this situation, the collector_camera.py needs to ensure that it calls super per overridden method so that the collector_mesh.py method gets called, and likewise, that needs to call super if you want the engine’s implementation of the hook called.

The tk-maya implementation of the collector does this for the settings property:

Hopefully that helps?

Thanks
Phil

4 Likes