Goal
To enable the GUI to change the order of its context, effectively changing the order of when instances are processed.
Motivation
The base library can already reorder the context, so without using the GUI, you can change the order of the instances between plugins. The problem is that the GUI has a “copy” of the context, that doesn’t get updated.
The original use-case was to sort the context to a more human readable list of instances; [solved] Collection sorting. This was implemented, but also paved the way for refreshing the GUI’s context. The refresh happens after collection.
Now I have another use-case for updating the GUI’s context, but its between plugins. The idea is to reorder the context with a context plugin, so other instance plugins process the instances in the right order; https://github.com/pyblish/pyblish-deadline/issues/27.
Unfortunately updating the GUI after each plugin, is a significant performance hit, so we’ll have to look at explicit updating, meaning a plugin will have to tell the GUI to update the context.
My suggestion is to have a flag on the plugins, that tells the GUI it needs to update the context after processing the plugin. Here’s an example of such a plugin:
class ValidatorB(pyblish.api.Validator):
gui_refresh = True
def process(self, context):
context.reverse()