Skip to content

Commit

Permalink
- fix get setting justMyCode in a function SERVER_handleRequest
Browse files Browse the repository at this point in the history
  • Loading branch information
satabol committed May 1, 2024
1 parent 642800f commit 58743ae
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 10 deletions.
4 changes: 2 additions & 2 deletions pythonFiles/include/blender_vscode/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import bpy
import sys

def startup(editor_address, addons_to_load, allow_modify_external_python, justMyCode):
def startup(editor_address, addons_to_load, allow_modify_external_python):
if bpy.app.version < (2, 80, 34):
handle_fatal_error("Please use a newer version of Blender")

Expand All @@ -14,7 +14,7 @@ def startup(editor_address, addons_to_load, allow_modify_external_python, justMy
path_mappings = load_addons.setup_addon_links(addons_to_load)

from . import communication
communication.setup(editor_address, path_mappings, justMyCode)
communication.setup(editor_address, path_mappings)

load_addons.load(addons_to_load)

Expand Down
7 changes: 2 additions & 5 deletions pythonFiles/include/blender_vscode/communication.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,13 @@
EDITOR_ADDRESS = None
OWN_SERVER_PORT = None
DEBUGPY_PORT = None
JUSTMYCODE = None

def setup(address, path_mappings, justMyCode):
global EDITOR_ADDRESS, OWN_SERVER_PORT, DEBUGPY_PORT, JUSTMYCODE
def setup(address, path_mappings):
global EDITOR_ADDRESS, OWN_SERVER_PORT, DEBUGPY_PORT
EDITOR_ADDRESS = address

OWN_SERVER_PORT = start_own_server()
DEBUGPY_PORT = start_debug_server()
JUSTMYCODE = justMyCode

send_connection_information(path_mappings)

Expand Down Expand Up @@ -104,7 +102,6 @@ def send_connection_information(path_mappings):
"type" : "setup",
"blenderPort" : OWN_SERVER_PORT,
"debugpyPort" : DEBUGPY_PORT,
"justMyCode": JUSTMYCODE,
"blenderPath" : str(blender_path),
"scriptsFolder" : str(scripts_folder),
"addonPathMappings" : path_mappings
Expand Down
1 change: 0 additions & 1 deletion pythonFiles/launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
addons_to_load=tuple(map(lambda x: (Path(x["load_dir"]), x["module_name"]),
json.loads(os.environ['ADDONS_TO_LOAD']))),
allow_modify_external_python=os.environ['ALLOW_MODIFY_EXTERNAL_PYTHON'] == "yes",
justMyCode=os.environ['JUSTMYCODE'] == "True",
)
except Exception as e:
if type(e) is not SystemExit:
Expand Down
1 change: 0 additions & 1 deletion src/blender_executable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,6 @@ async function getBlenderLaunchEnv() {
return {
ADDONS_TO_LOAD: JSON.stringify(loadDirsWithNames),
EDITOR_PORT: getServerPort().toString(),
JUSTMYCODE: <boolean>config.get('addon.justMyCode') ? 'True' : 'False',
ALLOW_MODIFY_EXTERNAL_PYTHON: <boolean>config.get('allowModifyExternalPython') ? 'yes' : 'no',
...<object>config.get("environmentVariables", {}),
};
Expand Down
5 changes: 4 additions & 1 deletion src/communication.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import * as http from 'http';
import * as vscode from 'vscode';
import * as request from 'request';
import { getConfig } from './utils';
import { attachPythonDebuggerToBlender } from './python_debugging';

const RESPONSIVE_LIMIT_MS = 1000;
Expand Down Expand Up @@ -132,7 +133,9 @@ function SERVER_handleRequest(request: any, response: any) {

switch (req.type) {
case 'setup': {
let instance = new BlenderInstance(req.blenderPort, req.debugpyPort, req.justMyCode, req.blenderPath, req.scriptsFolder, req.addonPathMappings);
let config = getConfig();
let justMyCode:boolean = <boolean>config.get('addon.justMyCode')
let instance = new BlenderInstance(req.blenderPort, req.debugpyPort, justMyCode, req.blenderPath, req.scriptsFolder, req.addonPathMappings);
instance.attachDebugger();
RunningBlenders.register(instance);
response.end('OK');
Expand Down

0 comments on commit 58743ae

Please sign in to comment.