Closed jboisvertrodeofx closed 2 years ago
Thanks for reporting this @jboisvertrodeofx, this is an oversight. The test is being used, it's just not coming from the host.
This is being called from the QML process. So what you could do, as a temporary and perhaps permanent workaround, is register your test in the QML parent process. For example, by putting it in a userSetup.py
that's on your PYTHONPATH prior to starting QML.
One approach would be something like..
userSetup.py
, append another userSetup.py
to PYTHONPATH
That way, it'll be passed onto QML, and Maya et. al. won't see it.
Thanks for the quick reply @mottosso ! I think your workaround could definitely work and we'll probably end up doing something similar to that on our end.
I'm still a bit curious about how we could go about fixing this in a permanent proper way though. I'm still looking through the code, and I know we're at least passing targets to the server from the client, so I'm wondering if we could pass the registered test function as a serialized string to the server as well. And of course, there might be other ways to do this as well.
Properly would mean communicating with the host, like Maya. Communication currently happens through a "service", which exposes a select few function calls to QML from the host. And from the looks of it, there is already support for doing this.
Called from QML
Called from Host
So, it should only be a matter of replacing..
..with
if self.host.test(**state):
And things should just magically work. From the looks of it, this was already the case way back when, and I'm not sure why it wasn't kept.
If you get around to testing (pun!) it, I'd be curious to know how it goes!
Thanks again @mottosso ! It was slightly more complicated, but I got it to work following your advice!
I had to add the kwargs
argument back to both of the _dispatch
functions, add some missing double asterisks to the test
function, and fix some JSON serialization issue with the set from the state
dictionary's "ordersWithError" key (I made a custom Encoder/Decoder to support Python sets).
I made a branch on our work repo, but I'll do some more testing to make sure there are no new problems.
Nice one!
can this issue be closed since the PR went in?
Yes, good idea!
If we register a custom test function using
pyblish.logic.register_test
, it is respected by thepyblish.util.publish
function and by the pyblish-lite UI, but it is completely ignored by the pyblish-qml UI.It seems that
pyblish_qml.control.Controller.iterator
always uses the defaultdefault_test
function instead of the one that was registered withpyblish.logic.register_test
.We use a custom test function to completely stop the execution of all plugins as soon as an error is raised, except for validator plugins. For example, if an error is raised during the execution of an extractor plugin, we stop the execution so that not only the other extractors are not executed, but also the integrators.
pyblish-lite
pyblish-qml
Here is a code sample to replicate the problem: