JacquesLucke / blender_vscode

Visual Studio Code extension for Blender development.
MIT License
540 stars 70 forks source link

Cannot set breakpoints when debugging scripts #145

Open cmelchiorre opened 1 year ago

cmelchiorre commented 1 year ago

I've configured vs code for Blender development. The following is my configuration:

Blender 3.4.1
Visual Studio Code 1.80
Blender Development extension v0.0.18
Python 3.10.8
fake-bpy-module-latest 20230517

I can start Blender and run scripts, but when debugging, if I set a breakpoint, this appears as excluded (dark bullet with white border instead of a red bullet).

The text message hovering over the breakpoint says:

Breakpoint in file excluded by filters.

Note: may be excluded because of "justMyCode" option (default == true).Try setting "justMyCode": false in the debug configuration (e.g., launch.json).

But adding "justMyCode" = false to launch.json doesn't change anythinhg:

This is my launch.json:

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Debug Blender",
            "type": "python",
            "request": "attach",
            "port": 5678, //careful, this used to be 3000 in older versions of vscode and this addon
            "host": "localhost",
            "justMyCode": false
        }
   ]
}

Output window:

Error: there is no registered task type 'f712011c67'. Did you miss installing an extension that provides a corresponding task provider?

Terminal window:

Read prefs: C:\Users\<my username>\AppData\Roaming\Blender Foundation\Blender\3.4\config\userpref.blend
[{'load_dir': 'e:\\Software\\Blender\\3.4\\python\\workspace\\test_addon', 'module_name': 'test_addon'}]
 * Serving Flask app 'Blender Server'
 * Debug mode: on
WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
 * Running on http://127.0.0.1:8726
Press CTRL+C to quit
Sending: {'type': 'setup', 'blenderPort': 8726, 'debugpyPort': 8762, 'blenderPath': 'e:\\Software\\Blender\\blender.exe', 'scriptsFolder': 'e:\\Software\\Blender\\3.4\\scripts', 'addonPathMappings': [{'src': 'e:\\Software\\Blender\\3.4\\python\\workspace\\test_addon', 'load': 'C:\\Users\\<my username>\\AppData\\Roaming\\Blender Foundation\\Blender\\3.4\\scripts\\addons\\test_addon'}]}
Waiting for debug client.
Debug client attached.

Debug console:

Debug client attached.
dimateos commented 10 months ago

Maybe related to https://github.com/JacquesLucke/blender_vscode/issues/140

Maybe your source is in "e:\Software\Blender\3.4\python\workspace\test_addon", and if you add breakpoints to those files they should be normal red dots. You can try to place them there without running blender etc.

Then during execution vscode opens the file but in the mapped path "C:\Users\\AppData\Roaming\Blender Foundation\Blender\3.4\scripts\addons\test_addon". Seems like that path is excluded by some of your filters or something idk.

Probably if you set breakpoints in "e:\Software\Blender\3.4\python\workspace\test_addon" then the execution will be stopped at those places even if the file that pops up is in "C:\Users\\AppData\Roaming\Blender Foundation\Blender\3.4\scripts\addons\test_addon" and seems to have none, in this case the breakpoints get kind of mirrored.

I noticed you are working with multiple drives e and C thats is also proably another thing that may fail. This addon uses Junctions to simulate your addon being inside the addons folders too, but iirc junctions can work across drives.