mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-05 23:41:44 +00:00
vscode config for Bonsai debugging
This commit is contained in:
@@ -21,6 +21,8 @@ venv
|
|||||||
|
|
||||||
# Visual Studio Code files
|
# Visual Studio Code files
|
||||||
.vscode
|
.vscode
|
||||||
|
!.vscode/launch.json
|
||||||
|
!.vscode/tasks.json
|
||||||
.vs
|
.vs
|
||||||
|
|
||||||
# PyCharm files
|
# PyCharm files
|
||||||
|
|||||||
Vendored
+24
@@ -0,0 +1,24 @@
|
|||||||
|
{
|
||||||
|
// 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": "Python Debugger: Remote Attach",
|
||||||
|
"type": "debugpy",
|
||||||
|
"request": "attach",
|
||||||
|
"connect": {
|
||||||
|
"host": "localhost",
|
||||||
|
"port": 5678
|
||||||
|
},
|
||||||
|
"pathMappings": [
|
||||||
|
{
|
||||||
|
"localRoot": "${config:bonsai.localRoot}",
|
||||||
|
"remoteRoot": "${config:bonsai.remoteRoot}"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
Vendored
+53
@@ -0,0 +1,53 @@
|
|||||||
|
{
|
||||||
|
// See https://go.microsoft.com/fwlink/?LinkId=733558
|
||||||
|
// for the documentation about the tasks.json format
|
||||||
|
"version": "2.0.0",
|
||||||
|
"tasks": [
|
||||||
|
{
|
||||||
|
"label": "Configure bonsai/vscode development environment",
|
||||||
|
"type": "shell",
|
||||||
|
"command": "${input:blenderPath}",
|
||||||
|
"args": [
|
||||||
|
"--background",
|
||||||
|
"--python", "${workspaceFolder}/src/bonsai/scripts/dev_environment_vscode_config.py"
|
||||||
|
],
|
||||||
|
"problemMatcher": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "Launch blender with debugpy",
|
||||||
|
"type": "shell",
|
||||||
|
"command": "blender",
|
||||||
|
"options": {
|
||||||
|
"cwd": "${config:bonsai.blenderPath}"
|
||||||
|
},
|
||||||
|
"args": [
|
||||||
|
"--python-expr",
|
||||||
|
"import debugpy; debugpy.listen(5678)"
|
||||||
|
],
|
||||||
|
"problemMatcher": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "Install debugpy in Blender",
|
||||||
|
"type": "shell",
|
||||||
|
"command": "blender",
|
||||||
|
"options": {
|
||||||
|
"cwd": "${config:bonsai.blenderPath}"
|
||||||
|
},
|
||||||
|
"args": [
|
||||||
|
"--background",
|
||||||
|
"--python-expr",
|
||||||
|
"import os, sys, subprocess; path=os.path.abspath(sys.executable); subprocess.call([path, '-m', 'ensurepip']); subprocess.call([path, '-m', 'pip', 'install', '--upgrade', 'debugpy'])"
|
||||||
|
],
|
||||||
|
"problemMatcher": []
|
||||||
|
}
|
||||||
|
|
||||||
|
],
|
||||||
|
"inputs": [
|
||||||
|
{
|
||||||
|
"id": "blenderPath",
|
||||||
|
"type": "promptString",
|
||||||
|
"description": "Enter the path to the blender executable",
|
||||||
|
"default": "blender"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
|
||||||
|
import bonsai, json, bpy
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
repo_path = Path(bonsai.__file__).resolve().parent
|
||||||
|
install_path = Path(bonsai.__file__).absolute().parent
|
||||||
|
assert repo_path != install_path, "Run `dev_environment.py` to setup the development environment symlinks first."
|
||||||
|
|
||||||
|
repo_root = repo_path.parent.parent.parent
|
||||||
|
settings_path = repo_root / ".vscode" / "settings.json"
|
||||||
|
settings_path.parent.mkdir(parents=True, exist_ok=True)
|
||||||
|
|
||||||
|
settings = json.loads(settings_path.read_text()) if settings_path.exists() else {}
|
||||||
|
settings.update({
|
||||||
|
"bonsai.localRoot": repo_path.as_posix(),
|
||||||
|
"bonsai.remoteRoot": install_path.as_posix(),
|
||||||
|
"bonsai.blenderPath": Path(bpy.app.binary_path).parent.as_posix(),
|
||||||
|
})
|
||||||
|
json_data = json.dumps(settings, indent=2)
|
||||||
|
|
||||||
|
settings_path.write_text(json_data)
|
||||||
|
|
||||||
|
print("\n\nBonsai/VSCode development environment configured successfully!\n\n")
|
||||||
|
|
||||||
Reference in New Issue
Block a user