Remove link to addon directory at exit of blender - take 2#184
Remove link to addon directory at exit of blender - take 2#184Mateusz-Grzelinski wants to merge 64 commits into
Conversation
- Capitalize global variables - Add type hints
fixes policy violation
Fresh installation of blender is not going to have directory created.
…o-cherry-pick # Conflicts: # pythonFiles/include/blender_vscode/__init__.py # pythonFiles/include/blender_vscode/load_addons.py
- you are developing extension in addons directory - extension has legacy bl_info defined - do not create a link
- prevent from various errors from old links - during blender version upgrade links are copied what breaks them and required manual fix
This reverts commit c6ab0fc
# Conflicts: # pythonFiles/include/blender_vscode/load_addons.py
# Conflicts: # pythonFiles/include/blender_vscode/load_addons.py # pythonFiles/tests/blender_vscode/test_load_addons.py
…ink-on-exit # Conflicts: # CHANGELOG.md # README.md # pythonFiles/include/blender_vscode/__init__.py # pythonFiles/include/blender_vscode/communication.py # pythonFiles/include/blender_vscode/installation.py # pythonFiles/include/blender_vscode/load_addons.py # pythonFiles/include/blender_vscode/operators/addon_update.py # pythonFiles/tests/blender_vscode/test_load_addons.py # src/blender_executable.ts
# Conflicts: # pythonFiles/include/blender_vscode/communication.py # pythonFiles/include/blender_vscode/environment.py # pythonFiles/include/blender_vscode/load_addons.py # pythonFiles/include/blender_vscode/operators/addon_update.py
This is non-destructive operation, files are not deleted.
| from typing import Optional, Union | ||
|
|
||
|
|
||
| def resolve_link(path: Union[str, os.PathLike]) -> Optional[str]: |
There was a problem hiding this comment.
handling juction is an absolute disaster due to python changes 3.7 -> 3.11. In worst case scenario use cmd call.
|
I'm not sure about this yet. I think this needs a better problem description before jumping to a solution. Some notes:
|
Yes, blender panic will leave the link. But that is true for any solution, unless we implement server side cleanup. Hm, maybe I will implement it, seems easy enough. Note: python exceptions do a proper cleanup. Only the panic with
Currently you do not have a choice. Right now your addon is permamently linked and available also outside of VS code session. Using new setting
This is impossible to design without any flaws. Current behavior: blender will fail to start (because link can not be created, directory already exists). I recently improved the error message: https://github.com/JacquesLucke/blender_vscode/blob/master/pythonFiles/include/blender_vscode/load_addons.py#L41 |
Design is complete. No breaking changes will be introduced in this PR.
Remove addon link at the blender exit. This is implemented as new feature with setting
blender.addon.keepAddonInstalled.In this PR implemented:
blender.addon.keepAddonInstalled. If false addon will be available only during debug sessionRelevant: #49
Pros:
Cons:
Design 1 - link only when debugging - used in this PR
Design 2 - modify addon directory - unused
BLENDER_USER_SCRIPTSand dirBLENDER_SYSTEM_EXTENSIONSDesign 3
Modfiy blender preferences to recognise addon location via
bpy.context.preferences.filepaths.script_directoriesCons:
bpy.context.preferences.filepaths.script_directories- might conflict with user settings