pyblish / pyblish-qml

Pyblish QML frontend for Maya 2013+, Houdini 11+, Nuke 8+ and more
GNU Lesser General Public License v3.0
114 stars 44 forks source link

Implemented eventFilter removal and improved Foster stability #297

Closed davidlatwe closed 6 years ago

davidlatwe commented 6 years ago

In this PR, should have:

Here are some Foster mode running screen gif:

This is Maya 2018.0 on Windows

qml_foster_windows

This is Maya 2015 on Windows

qml_foster_2015

As you can see, it's really laggy.

This is Maya 2017 update 5 on CentOS 7 (Run in Hyper-V)

qml_foster_linux

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 !

davidlatwe commented 6 years ago

Here's my plugins Gist that used in tests.

mottosso commented 6 years ago

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.

mottosso commented 6 years ago

Looks like something is off for Maya 2015 and 2016, presumably related to Qt 4 vs. Qt 5.

image

It sits there, nothing happening. This is with PYBLISH_QML_FOSTER=1

mottosso commented 6 years ago

This produces the same result, not sure if it helps.

from pyblish_qml import show
show(foster=False)
mottosso commented 6 years ago

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.

davidlatwe commented 6 years ago

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 :)

davidlatwe commented 6 years ago

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

mottosso commented 6 years ago

Works!

Great work @davidlatwe. If you're ready, I'm happy to merge and release. Have you incremented the version too?

davidlatwe commented 6 years ago

Bump ! Thanks @mottosso :D

mottosso commented 6 years ago

Bam! https://github.com/pyblish/pyblish-qml/releases/tag/1.8.2