Closed davidlatwe closed 6 years ago
Here's my plugins Gist that used in tests.
Stellar effort @davidlatwe! I've given this a go on Windows 10, Maya 2018 and all went well. There's some flickering in the window when it goes from being a child to its own window, but I can't see a way around that.
I've added some docstrings, but was hoping you could fill in what "ninja" meant, here.
Looks like something is off for Maya 2015 and 2016, presumably related to Qt 4 vs. Qt 5.
It sits there, nothing happening. This is with PYBLISH_QML_FOSTER=1
This produces the same result, not sure if it helps.
from pyblish_qml import show
show(foster=False)
Also to confirm that the current master, and the master before merging the foster update, works in 2015. So there's something in this PR specifically causing it not to run.
Thanks for quick spin @mottosso !
Looks like something is off for Maya 2015 and 2016, presumably related to Qt 4 vs. Qt 5.
Yes, it's related to Qt version, but the reason it freeze was from the change in commit 7b3277c .
It's about ninja
, too. ninja
is foster mode's window detach-attach transition process, which I could not come up with a better name.
I would like to elaborate more, but I need to hit the road now, I'll come back later :)
Okay, just tested on 2015, it should wok now :)
I renamed the param ninja
to foster_fixed
, should be clear enough I think. It's to control whether the GUI to avoid main thread busy by parent back to subprocess or not.
If host's Qt version==4
, GUI will become blank white after window setParent
back to subprocess from host (tested on Windows). So I made this extra switch foster_fixed
, to let the fostered window always stay inside the host, although this will produce laggy GUI when host main thread is busy, but it's better then a blank window.
By default, the bool value of foster_fixed
is set from host's Qt version, one can override it through additional environment variable PYBLISH_QML_FOSTER_FIXED=True
.
Here's the code that define the value (describe better then my words) :
if not foster: # If Foster mode is not turned on, `foster_fixed` is False
return False
value = os.environ.get("PYBLISH_QML_FOSTER_FIXED", "").lower()
return value in ("true", "yes", "1") or QtCore.qVersion()[0] == "4"
There's some flickering in the window when it goes from being a child to its own window, but I can't see a way around that.
If everything works well, this window flickering and the taskbar alert change to main window should be the last two trade off. :P
One other buggy appearance was on CentOS, the window did not resize properly when it parent back to subprocess. But I am going to let it slide for now, will back to fix this one after a while. :)
Does foster_fixed
works for you ? @mottosso
Works!
Great work @davidlatwe. If you're ready, I'm happy to merge and release. Have you incremented the version too?
Bump ! Thanks @mottosso :D
In this PR, should have:
foster
is on or not, usual window close or force quit, should remove evenFilter in the end.PYBLISH_QML_FOSTER_NINJA=True
orFalse
(Yes/No 1/0
)Here are some Foster mode running screen gif:
This is Maya 2018.0 on Windows
This is Maya 2015 on Windows
As you can see, it's really laggy.
This is Maya 2017 update 5 on CentOS 7 (Run in Hyper-V)
Foster mode works on CentOS ! One thing to be noticed is that, while in my first test on CentOS, I installed Maya 2017 and encountered an error says:
FosterVessel(QtWidgets.QDialog) has no attribute 'winId'
This is a bug, the error was gone after I installed the Maya 2017 update.Now, I wouldn't say the Foster mode is 100% safe to use, but should at least stable as Fake child approach.
Any feedback are welcome :) Thanks !