I came to think of a possible implementation and use of the Background Publishing issue.
What if, whenever you hit Publish:
- Your scene is saved (into a temporary directory that you cannot see nor touch).
- Pyblish launches standalone, either automatically or by hand.
- Your plug-ins then operate solely on the saved file, with no interaction with your currently opened file.
It would mean support for any host, even those without scripting capabilities, without integration, other than running an external app or in worst case, asking the user to open it themselves once the scene has been saved into the designated location. For example, an artist could save out JPEGs from Photoshop or sculptures from ZBrush and validate those before conforming them to an asset library.
It would also mean publishing without interfering with the scene. A user can publish, it can take however long it takes, and move on with his work undisturbed.
It would also mean publishing can be destructive. That publishing could make permanent changes to the scene before performing any serialisation. For example, it may be desired to bake all keys so as to not bring along any constraints or expressions. As baking alters the scene, this can be difficult and error-prone in the currently opened scene.
You would be unable to interact with your scene through Pyblish, such as performing repairs or custom actions.
In some cases, publishing can take longer. Although in others, it can go faster.
It may take longer because the scene must be saved prior to publishing and also in cases where deep introspection is needed, such as querying attributes or relationships between nodes within Maya (in which case you need mayapy). It can go faster, because publishing can be done using multiple instances of a host for introspection. For example, it could launch mayapy once per plug-in. E.g. extracting a pointcache and quicktime could each run concurrently.
As both the current (foreground publishing) and background publishing have their own pros/cons, it may be ideal to try and get the best of both.
For example, there could be a toggle/setting specifying whether to perform a background or foreground publish. It could be specified at any point prior to publishing, such as per-studio, per-project, per-user or per-publish.