techartorg / bqt

A Blender add-on to support & manage Qt Widgets in Blender (PySide2)
https://github.com/techartorg/bqt/wiki
Mozilla Public License 2.0
172 stars 25 forks source link

Abstract Classes for bqt #10

Closed Amatobahn closed 4 years ago

Amatobahn commented 4 years ago

Updated classes to handle proper initialization without calling a function that no longer exists and passing argv for no real reason.

JeffHanna commented 4 years ago

Don't put these in \startup\bqt\ The init.py in the repo causes an issue and then the bqt script is not run, giving a false-positive result of success. If you put blender_applications\, bqt.py, and blender_stylesheeet.qss in \startup, start Blender, and then toggle the System Console you'll see the real errors that are being encountered. I've submitted a slight fix to bqt.py and the win32blenderapplication class. Now the bqt script fails in on_update(), line 91 because the local context 'app' variable is None.

I'm not sure the Win32BlenderApplication or DarwinBlenderApplication classes are being correctly instantiated at any point. bqt.load_os_module() returns either of those classes, not instances of those classes. bqt.instantiate_application() does not instantiate what it gets back from load_os_module(), instead just returning the class. So, I think that ultimately at the top of that call-chain, self.__qapp is just a handle to a class definition, not a correctly instantiated version of that class.

But, none of this would help with on_update() failing as self.__qapp is a class attribute and on_update() is a function outside of that class. I think maybe we need to move self.__qapp out of the QOperator() class and make it a global, then on_update() could reference it correctly.

I think...