At the moment, I use VS code to build / debug blender. This video is great to get started on the internals of blender.
VS code task.json
:
{
"version": "2.0.0",
"tasks": [
{
"label": "Build Blender",
"type": "shell",
"command": "make debug developer ccache ninja",
"group": "build"
},
{
"label": "Lite Build Blender",
"type": "shell",
"command": "make CC='ccache gcc' lite",
"group": "build"
}
]
}
VS code launch.json
:
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "(lldb) Launch Blender",
"type": "lldb",
"request": "launch",
"program": "${workspaceFolder}/../build_darwin_debug/bin/Blender.app/Contents/MacOS/Blender",
"args": [
"/Users/user_name/projects/blender/dev/blend_file_name.blend",
"--debug-all"
],
"terminal": "integrated",
"stopOnEntry": false,
"cwd": "${workspaceFolder}",
"preLaunchTask": "Build Blender" // Optional; you can use if you want it to build before launching
},
// For building lite version
{
"name": "Lite (lldb) Launch Blender",
"type": "lldb",
"request": "launch",
"program": "${workspaceFolder}/../build_darwin_lite/bin/Blender.app/Contents/MacOS/Blender",
"args": [
"--debug",
"--debug-memory",
// "--debug-python",
// "--debug-ghost",
// "--debug-wm",
// "--debug-depsgraph",
// "--debug-depsgraph-eval",
// "--debug-depsgraph-build",
// "--debug-depsgraph-no-threads",
// "--debug-depsgraph-pretty",
"--debug-events",
// "--debug-handlers"
], // I usually have all of the flags listed, and commented out. That way I can toggle them on as needed.
"terminal": "integrated",
"stopOnEntry": false,
"cwd": "${workspaceFolder}",
"preLaunchTask": "Lite Build Blender"
}
]
}
Some notes:
- I've specifed a target blend file
/Users/user_name/projects/blender/dev/blend_file_name.blend
, so I can easily launch a buggy blend file for testing - I'm using the CodeLLDB plugin which allows me to use the integrated terminal in VS code (the
"terminal": "integrated"
option) - The
"args": ["--debug-all"]
flag turns everything on. Which can be a bit much. I usually list them all out, and comment out the one I'm not using at the moment. A list of debug flags can be found here