Open Waffle1434 opened 1 year ago
That is a remote server mapping issue, I also had some so I added a log output to display the mapping json: https://github.com/dimateos/vscode-blender/blob/master/src/python_debugging.ts#L34
NOTE:: it was some time ago and I did not even recompile the addon, I just ported the function to JS manually so it may break.
Here you can see my current mapping, breakpoints set in C:\\GIT\\UPC-MIRI-TFM-git\\src\\addonSim
correctly stop there not in the remote folder. Yours might have something broken.
configuration: {
"name": "Python at Port 5183",
"request": "attach",
"type": "python",
"port": 5183,
"host": "localhost",
"pathMappings": [
{
"localRoot": "C:\\GIT\\UPC-MIRI-TFM-git\\src\\addonSim",
"remoteRoot": "C:\\GIT\\UPC-MIRI-TFM-git\\DATA\\Blender\\3.4.1\\3.4\\scripts\\addons\\_addon_vscode"
},
{
"localRoot": "C:\\GIT\\UPC-MIRI-TFM-git\\DATA\\Blender\\3.4.1\\3.4\\scripts",
"remoteRoot": "C:\\GIT\\UPC-MIRI-TFM-git\\DATA\\Blender\\3.4.1\\3.4\\scripts"
},
{
"localRoot": "C:\\GIT\\UPC-MIRI-TFM-git",
"remoteRoot": "c:\\GIT\\UPC-MIRI-TFM-git"
}
]
}
But if recall correclty, I still had issues due to the fact that the scripts
folder was mapped first! The remote debugger checks the mappings in order to get a valid one. The deploy path of an addon is inside scripts/addons
so it was a valid one under scripts
and it kept opening there. Probably also because my blender binary is inside my repo (gitignored) and part of the path matches.
Reordered mapping function that makes the specific addon and deploy path first: https://github.com/dimateos/vscode-blender/blob/master/src/python_debugging.ts#L39
async function getPythonPathMappings(scriptsFolder: string, addonPathMappings: AddonPathMapping[]) {
let mappings = [];
// first of all add the mapping to the addon as it is the most specific one
mappings.push(...addonPathMappings.map(item => ({
localRoot: item.src,
remoteRoot: item.load
})));
// optional scripts folders, atm supposed to be global paths
for (let folder of getStoredScriptFolders()) {
mappings.push({
localRoot: folder.path,
remoteRoot: folder.path
});
}
// add blender scripts last, otherwise it seems to take all the scope and not let the proper mapping of other files
mappings.push(await getBlenderScriptsPathMapping(scriptsFolder));
// finally add the worspace folder as last resort for mapping loose scripts inside it
let wsFolder = getAnyWorkspaceFolder();
// extension_1.printChannelOutput("wsFolder: " + JSON.stringify(wsFolder, undefined, 2));
mappings.push({
localRoot: wsFolder.uri.fsPath,
remoteRoot: wsFolder.uri.fsPath
});
// change drive letter for some systems
fixMappings(mappings);
return mappings;
}
That being said, in my case I think I could still edit the files? but surely this is a mapping issue. Probably you don't have the same config in both systems: global settings, workspace settings, blender path, etc... Maybe is easier if you try to replicate that.
My fork has more tiny changes that differs from master and the path mapping is a sensitive part of the extension, and a bit undocumented. It's quite well done but I would change some details. I did not PR any as I am still tuning things just for my needs.
cheers
How can I access that configuration json?
I've recently noticed this only occurs with Run Script
, but if I set a breakpoint on a Blender addon that was already running, it uses the correct file.
How can I access that configuration json?
Sadly it's a json that is not displayed by the addon. I added some modifications to the code to print it to a debug output.
I've recently noticed this only occurs with Run Script, but if I set a breakpoint on a Blender addon that was already running, it uses the correct file.
I think that happpened to me too, when I wrote this fix I made sure everything worked for my worskpace:
But if recall correclty, I still had issues due to the fact that the scripts folder was mapped first! The remote debugger checks the mappings in order to get a valid one. The deploy path of an addon is inside scripts/addons so it was a valid one under scripts and it kept opening there. Probably also because my blender binary is inside my repo (gitignored) and part of the path matches.
I opened a PR with my specific changes that solved this issue (+ added the logging). You can try it out https://github.com/JacquesLucke/blender_vscode/pull/142
Platform
Issue
Ctrl+Shift+P -> Blender: Run Script
This issue does not occur hitting addon breakpoints, only when using
Run Script
I am completely losing my mind on this one. My home machine doesn't have this issue, but my work machine does. I've tried completely reinstalling VS Code by wiping the installation and user files and all of my extensions, no change. If I set a breakpoint in a non-blender python file and run using VS Code's ordinary debugger, it hits the breakpoints fine in the same file. Its only when using Blender's python debugger.