getavalon / core

The safe post-production pipeline - https://getavalon.github.io/2.0
MIT License
218 stars 49 forks source link

Parenting tools #472

Closed davidlatwe closed 4 years ago

davidlatwe commented 4 years ago

Problem

Avalon tools like Loader, Creator, Scene Manager, Context Manager, Workfile were not parented in Houdini and Nuke's main window.

And the Workfile app's show() wasn't accept parent arg at all.

Changes


While I was working on Houdini, I encountered two problems:

  1. The Qt style sheet was overridden by Houdini.
  2. Calling Context Manager raised Segmentation fault fatal error.

On problem 1, the Loader has become:

See Image ![image](https://user-images.githubusercontent.com/3357009/68201708-428f3100-fffd-11e9-9f33-ea7cc88287d3.png)

And the Context Manager:

See Image ![image](https://user-images.githubusercontent.com/3357009/68201798-6c485800-fffd-11e9-9330-41e91a770c15.png)

Which looks cool but I love Avalon flavor more. Interestingly, Creator and Scene Manager did not have this issue, not sure why :(

Edit: :point_up: Actually they do, see comments below.

See Image ![image](https://user-images.githubusercontent.com/3357009/68202029-dcef7480-fffd-11e9-9322-db3442f1ce7a.png)

On problem 2, it was because of directly connecting QtWidgets.QTreeView.selectionModel() to the handler, and leads to a Segmentation fault error and crash Houdini.

The only useful info I could find was this tweet.

davidlatwe commented 4 years ago

Thanks @tokejepsen ❤️ For testing, hope that @BigRoy can have a test on Houdini, and @jasperges or @jezscha able to test on Nuke ☺️

Also, I don’t have fusion here, so the tools still unparented in fusion.

BigRoy commented 4 years ago

Also, I don’t have fusion here, so the tools still unparented in fusion.

There's no Qt in Fusion so I think that will have to remain as is unfortunately.

For testing, hope that @BigRoy can have a test on Houdini

Very nice! I wonder how I missed doing this at the time. Anyway, nice work!

Houdini avalon tools font difference

I did notice the styling felt a bit off as it seems to be using the Houdini font as opposed or something? For example:

Creator ![afbeelding](https://user-images.githubusercontent.com/2439881/68208559-b1ef2b80-ffd1-11e9-996a-a161bfe269bb.png)

I wonder if there's a way to patch that up too.

Houdini Work files error

The Work files tool however pops up this error on opening:

Traceback (most recent call last):
  File "D:\git_pipeline\avalon\development\git\core\avalon\tools\workfiles\app.py", line 344, in <lambda>
    QtCore.QTimer.singleShot(100, lambda: self.list.scrollToItem(item))
RuntimeError: Internal C++ object (PySide2.QtWidgets.QListWidgetItem) already deleted.

Additionally it seems that the Work Files tool does not have the Avalon styling whatsoever. Or does it look so different solely due to the font being so different?

Workfiles App ![afbeelding](https://user-images.githubusercontent.com/2439881/68208691-02668900-ffd2-11e9-972c-2da5798e0a2b.png)

Also I did recall this comment in Shotgun's toolkit regarding styling Qt widgets inside houdini which calls the method here. Maybe we should try and just apply the stylesheet globally in Houdini? Sounds a bit hacky though.

davidlatwe commented 4 years ago

Maybe we should try and just apply the stylesheet globally in Houdini? Sounds a bit hacky though.

Haha, and it says here.. NOTE: Except for 16+. It's no longer safe and causes lots of styling problems in Houdini's UI globally.

So hacky indeed !

Anyway, I finally resolved the font size and QSplitter issue by adding some entry in style.qss, the Loader and Creator tools should now look almost the same as in other DCC.

Here's the before and after: #### before ![image](https://user-images.githubusercontent.com/3357009/68223823-73d12680-0028-11ea-9a8a-e36b64d86fa1.png) Notice that the splitter in Loader is a thick gray line even mouse is not hover on top of them. #### after ![image](https://user-images.githubusercontent.com/3357009/68223890-9b27f380-0028-11ea-8a15-32fca41f9578.png) :tada:

Furthermore, I also moved the line window.setStyleSheet after window.show in every tool, so their appearance should all aligned now.

davidlatwe commented 4 years ago

Houdini Work files error

The Work files tool however pops up this error on opening:

Traceback (most recent call last):
  File "D:\git_pipeline\avalon\development\git\core\avalon\tools\workfiles\app.py", line 344, in <lambda>
    QtCore.QTimer.singleShot(100, lambda: self.list.scrollToItem(item))
RuntimeError: Internal C++ object (PySide2.QtWidgets.QListWidgetItem) already deleted.

Originally, this issue was fixed in https://github.com/getavalon/core/pull/472/commits/1b2e9add741848c3e933fe03ccd74374ca8045e3, but after a few more search, I find that keeping the Houdini's main window instance in a place which can have a longer lifespan is a better solution, which fixes in a higher scope (based on this post). So I revert the previous commit and add https://github.com/getavalon/core/pull/472/commits/5907a80bcd2e0ff6457be3e0617d054cd127ebe9.

Note that the Segmentation fault error described in top comment can still exists after this change.

And for removing duplicated main window getting logic plus having same function for each host, I also add get_main_window in maya.pipeline in https://github.com/getavalon/core/pull/472/commits/49687febcb7cc5072b4203f4ba6f7ecd85d95954.

tokejepsen commented 4 years ago

Just noticed as well that the Loader is not parent to the Maya window.

davidlatwe commented 4 years ago

@tokejepsen, really !? Loader did get parented in Maya here in my end. :astonished:

tokejepsen commented 4 years ago

@tokejepsen, really !? Loader did get parented in Maya here in my end. 😲

Ok, I'm not on the latest core, so it could just be something with my fork. Nvm :)

davidlatwe commented 4 years ago

Will merge this tomorrow if no other objections :)

mottosso commented 4 years ago

I've scanned through the code and couldn't find anything I didn't like. Nice work. :)