You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+4-5Lines changed: 4 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,4 @@
1
-
# Blender Debugger for VS Code (and Visual Studio)
1
+
# Blender Debugger for VS Code (and Visual Studio)
2
2
3
3
Inspired by [Blender-VScode-Debugger](https://github.com/Barbarbarbarian/Blender-VScode-Debugger) which was itself inspired by this [remote_debugger](https://github.com/sybrenstuvel/random-blender-addons/blob/master/remote_debugger.py) for pycharm as explained in this [Blender Developer's Blog post](https://code.blender.org/2015/10/debugging-python-code-with-pycharm/).
4
4
@@ -86,9 +86,7 @@ Go to the Debugging tab and add a configuration. Pick Python. You'll want the co
86
86
"name": "Python: Attach",
87
87
"type": "python",
88
88
"request": "attach",
89
-
"localRoot": "${workspaceFolder}",
90
-
"remoteRoot": "${workspaceFolder}",
91
-
"port": 3000,
89
+
"port": 5678, //careful, this used to be 3000 in older versions of vscode and this addon
92
90
"host": "localhost"
93
91
},
94
92
```
@@ -123,8 +121,9 @@ Now in Blender the text editor will show this little red button in the top left.
123
121
- To determine whether the problem is on Blender's side or your editor's: Close Blender and download/copy this [test script](https://gist.github.com/AlansCodeLog/ff1b246a8e31938e1c3dbfdcbb90522f) and run it with Python, and then try to connect to the server with your editor. If you're still getting problems then the problem is with VS Code, try:
124
122
- Check your detected your Python install, or set it manually.
125
123
- For VS Code try reinstalling the VS Code Python extension.
124
+
- If you've been using this addon for a while and it's suddenly giving you a connection error, it might be because the default port has changed. VS Code's Python extension (vscode-python) has changed their default port from 3000 to 5678, so I have changed the default accordingly. I've made it configurable now though, so just check the port the addon is set to matches the one in your `launch.json` in VS Code.
126
125
127
-
Otherwise, if nothing works, don't hesitate to file an issue.
126
+
Otherwise, if none of that helped, don't hesitate to file an issue.
Copy file name to clipboardExpand all lines: __init__.py
+26-10Lines changed: 26 additions & 10 deletions
Original file line number
Diff line number
Diff line change
@@ -21,7 +21,7 @@
21
21
bl_info= {
22
22
'name': 'Debugger for VS Code',
23
23
'author': 'Alan North',
24
-
'version': (0, 2, 0),
24
+
'version': (0, 3, 0),
25
25
'blender': (2, 79, 0),
26
26
"description": "Starts debugging server for VS Code.",
27
27
'location': 'In search (default shortcut:space) type "Debug"',
@@ -92,18 +92,32 @@ class DebuggerPreferences(bpy.types.AddonPreferences):
92
92
name="Timeout",
93
93
default=20
94
94
)
95
+
96
+
port=bpy.props.IntProperty(
97
+
name="Port",
98
+
min=0,
99
+
max=65535,
100
+
default=5678
101
+
)
95
102
defdraw(self, context):
96
103
layout=self.layout
97
-
layout.prop(self, "path")
98
-
layout.label(text="Pluging will try to auto-find it, if no path found, or you would like to use a different path, set it here.")
99
-
row=layout.split()
100
-
row.label(text="Timeout in seconds for attach confirmation listener.")
101
-
row.prop(self, "timeout")
104
+
row_path=layout
105
+
row_path.label(text="The addon will try to auto-find the location to ptvsd, if no path is found, or you would like to use a different path, set it here.")
106
+
row_path.prop(self, "path")
107
+
108
+
row_timeout=layout.split()
109
+
row_timeout.prop(self, "timeout")
110
+
row_timeout.label(text="Timeout in seconds for the attach confirmation listener.")
111
+
112
+
row_port=layout.split()
113
+
row_port.prop(self, "port")
114
+
row_port.label(text="Port to use. Should match port in VS Code's launch.json.")
115
+
102
116
103
117
# check if debugger has attached
104
-
defcheck_done(i, modal_limit):
118
+
defcheck_done(i, modal_limit, prefs):
105
119
ifi==0ori%60==0:
106
-
print("Waiting...")
120
+
print("Waiting... (on port "+str(prefs.port)+")")
107
121
ifi>modal_limit:
108
122
print("Attach Confirmation Listener Timed Out")
109
123
return {"CANCELLED"}
@@ -125,7 +139,8 @@ class DebuggerCheck(bpy.types.Operator):
0 commit comments