Skip to content

Make the workfiles app work in Blender#465

Merged
mottosso merged 2 commits intogetavalon:masterfrom
jasperges:fix-workfiles-for-blender
Oct 30, 2019
Merged

Make the workfiles app work in Blender#465
mottosso merged 2 commits intogetavalon:masterfrom
jasperges:fix-workfiles-for-blender

Conversation

@jasperges
Copy link
Contributor

For this I didn't make an issue, because it seems easier to discuss the changes when looking at the code itself. Questions, concerns or suggestions are more then welcome!

There are basically 2 things needed to make it work:

  1. Keep a reference to the Qt window (and children) to avoid garbage collection. To keep track of the window module.window is now used. This also has the advantage of making it consistent with the other tools which do this already.
  2. Avoid running exec_() for the main window, because this blocks Blender and creates conflicts between the Qt event loop and Blender event loop (if I'm not mistaken). Instead just show() the window and keep it responsive by triggering processEvents() all the time from within Blender. This last part is not shown here, because it's part of my Blender integration. This also makes it consistent with the other tools which also just run show(). For the messagebox and name_window it seems fine to run exec_(), they are not working if you run show(). To be honest I'm not completely sure why.

I hope this doesn't cause any problems with other DCC's, but I suspect it's fine because the other tools also do this.

messagebox.setStandardButtons(
messagebox.Yes | messagebox.No | messagebox.Cancel
self._messagebox.setStandardButtons(
self._messagebox.Yes | self._messagebox.No | self._messagebox.Cancel

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

line too long (80 > 79 characters)

Although I personally think the readability suffers from this.
https://www.youtube.com/watch?v=wf-BqAjZb8M&t=1s
@tokejepsen
Copy link
Collaborator

Nice one @jasperges !

because it's part of my Blender integration

What is your Blender integration? Is Avalon missing something, or are you talking about your Avalon config?

@jasperges
Copy link
Contributor Author

What is your Blender integration? Is Avalon missing something, or are you talking about your Avalon config?

I'm adding Blender 2.80 as a supported host to Avalon.

@tokejepsen
Copy link
Collaborator

Ahh, I see. This PR is part of a future bigger PR.

@jasperges
Copy link
Contributor Author

Yes, this is in preperation of that one. But I felt a seperate PR is in place here, because apart from giving problems with Blender it also is not consistent with the other tools. But I also wouldn't mind to incorporate it into the the 'blender PR'.

@mottosso
Copy link
Contributor

Nice and consistent, thanks!

@mottosso mottosso merged commit e771535 into getavalon:master Oct 30, 2019
@jasperges jasperges deleted the fix-workfiles-for-blender branch October 30, 2019 15:51
@BigRoy
Copy link
Collaborator

BigRoy commented Dec 17, 2019

@jasperges Could this have been fixed by explicitly setting the parent on those widgets to self so it automatically keeps a reference to it? I'm working on the Work Files tool and merging it with Context Manager. I'll try and do the 'parent' widget correctly and see if that helps. Then you can see if it crashes on you, if so we can always revert.

BigRoy added a commit to BigRoy/core that referenced this pull request Dec 17, 2019
# Conflicts:
#	avalon/tools/workfiles/app.py

Note this changes the fix from getavalon#465 to not store the widgets as explicit variables but by setting the parent widget
@jasperges
Copy link
Contributor Author

@BigRoy I have no idea... Let's find out! 🤓

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants