JacquesLucke/blender_vscode

Scripts/Add-ons fail to run if a Blender's non-3D Viewport-based editor area is maximized

ZeroGravitasIndeed opened this issue · 0 comments

Attempting to run an add-on or a script while a Blender's non-3D editor area (e.g, the Node Editor) is maximized via View ‣ Area ‣ Toggle Maximize Area, produces the following error report:

Traceback (most recent call last):
  File "/Users/myusername/.vscode/extensions/jacqueslucke.blender-development-0.0.16/pythonFiles/include/blender_vscode/utils.py", line 22, in always
    try: func()
  File "/Users/myusername/.vscode/extensions/jacqueslucke.blender-development-0.0.16/pythonFiles/include/blender_vscode/operators/script_runner.py", line 23, in run_script_action
    context = prepare_script_context(path)
  File "/Users/myusername/.vscode/extensions/jacqueslucke.blender-development-0.0.16/pythonFiles/include/blender_vscode/operators/script_runner.py", line 49, in prepare_script_context
    context["space_data"] = context["area"].spaces.active
AttributeError: 'NoneType' object has no attribute 'spaces'

The nature of the script's code doesn't seem to matter (for example, a single import bpy line one fails, too).

If the maximized area is the 3D Viewport, no matter in which mode (object, sculpt, etc.), everything works correctly.

Certainly, this is only a minor nuisance in this truly a lifesaver of a VSCode extension of yours, but, just in case… 🙂

(My setup's details:

Blender 2.93.1
blender_vscode v0.0.16
Visual Studio Code 1.58.2
Commit: c3f126316369cd610563c75b1b1725e0679adfb3
Date: 2021-07-14T22:09:06.581Z
Electron: 12.0.13
Chrome: 89.0.4389.128
Node.js: 14.16.0
V8: 8.9.255.25-electron.0
OS: Darwin x64 18.7.0
macOS 10.14.6 Mojave)