Closed cmcpasserby closed 4 years ago
So bqt.py
is designed to be run as a startup script. Not sure how the execution model differs when run directly like that.
I also get an error, but related to operators registration not the icon code:
found bundled python: e:\Blender\2.80\python
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "e:\Blender\bqt.py", line 408, in <module>
unregister()
File "e:\Blender\bqt.py", line 381, in unregister
bpy.utils.unregister_class(QOperator)
RuntimeError: unregister_class(...):, missing bl_rna attribute from 'RNAMeta' instance (may not be registered)
@bob-white well the block that calls unregister only runs if you execute the script from the cli to start blender, so i feel it is just running too early
You are correct, if I remove that block I no longer get the error. Also, I still don't get the error that you are. I tried this both in an admin console, and a non-elevated console so I don't believe this is a permissions issue.
I don't get the IndexError. But the Blender frame is without an icon.
So poking around with this, it appears loading the bytes from GetBitmapBits
into a QImage
or QPixmap
just doesn't work. It will work with a PIL.Image
though. So its probably some kind of formatting thing.
likely just something simple like needing to go into a QByteArray first instead of a python list.
though i think we can kill off the code for finding the process. since bpy.app.binary_path
will just give you the blender exe directly
The latest commit uses bpy.app.binary_path to get the path to the blender.exe. The code to step through running Windows processes to find the blender.exe has been removed.
With my latest change I successfully get an application icon when starting Blender from a command prompt using the "blender.exe --debug --python bqt.exe" command posted above.
Closing.
when i execute blender via the CLI the call to find the blender icons fails
blender.exe --debug --python bqt.py