JacquesLucke / blender_vscode

Visual Studio Code extension for Blender development.
MIT License
574 stars 75 forks source link

Bug: Blender 4.2 registers addons both as legacy and extensions after using Blender 3.6 #209

Closed SamuelBilek closed 1 week ago

SamuelBilek commented 2 weeks ago

Working with addons that contain both legacy bl_info and the extension-related blender_manifest.toml across several Blender executables of different versions (3.6 - 4.2) with custom BLENDER_USER_SCRIPTS and BLENDER_USER_EXTENSIONS environmentVariables creates clashes with addon registration. Issue described below:

I propose a fix that would also expand the possibilites of users for starting Blender from different executables with different environmentVariables:

In my case it would allow me to have a different BLENDER_USER_SCRIPTS folder for Blender 4.2+ that get's populated only with addons that cannot be used as extensions, while I keep all extensions in the global BLENDER_USER_EXTENSIONS folder.

Mateusz-Grzelinski commented 2 weeks ago

please tell me: is you addon now linked in both places: in BLENDER_USER_SCRIPTS and BLENDER_USER_EXTENSIONS?

Mateusz-Grzelinski commented 2 weeks ago

so there are functions that do a basic check for duplicated links, but I just checked and the case you presented is not covered, I just missed it.

This is why I created #184, but I do not have time to finish it.

I think we can call it a bug. The fix would be:

If you want to push for the feature with environmentVariables please create new issue where we can discuss it

SamuelBilek commented 2 weeks ago

I mostly wanted that feature to fix this bug. What you propose sounds like a not so complicated fix. Will you have time to implement it? Or should I do it?

Mateusz-Grzelinski commented 2 weeks ago

I will not have time to do it, if you have please do. There is already code that does somthing similar, Mark me as reviewer when you create PR

Mateusz-Grzelinski commented 2 weeks ago

BTW this docs is mostly relevant to the logic that you are going to touch, just skim it, dont read deeply into it https://github.com/JacquesLucke/blender_vscode/blob/master/EXTENSION-SUPPORT.md

SamuelBilek commented 2 weeks ago

Could you please tell me how do you debug the launch python code in this extension? :)

Mateusz-Grzelinski commented 2 weeks ago

usually it is easier to add print. Note: print(f"{variable=}") is usually the most conviewnient.

The bootstraping code that lauches debugger is notoriously hard to debug. You can try https://code.visualstudio.com/docs/python/debugging#_debugging-by-attaching-over-a-network-connection but it will take you a while to get it right, I do not have anything ready.

oh and logging in #198 is almost ready - it is still a time issue.

Mateusz-Grzelinski commented 2 weeks ago

I tried writing some tests for this specific part of code, but they are pretty hard to write https://github.com/JacquesLucke/blender_vscode/tree/master/pythonFiles/tests/blender_vscode

Threat them as experiment, not a hard commitment.

they can be run outside of blender so debugging them is easy.

SamuelBilek commented 1 week ago

I managed to fix my problem just by clearing legacy addon links when creating a new extension link, the question is whether it's enough.