blender_vscode
blender_vscode copied to clipboard
Remove link to addon directory at exit of blender - take 2
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:
- Disable "Load Previous settings" Blender feature during VS code session. Blender breaks when trying to copy link from previous version
- Windows only: disable addon uninstallation if addon is link because if will cause data loss on Windows :
- Add option to make addon link/junction temporary
blender.addon.keepAddonInstalled
. If false addon will be available only during debug session - Send notification if linking addon failed
- Update readme
- [ ] multiple blender instances might use the same addon (for example you start blender twice). Do not remove the directory when another blender instance still needs it!
Relevant: https://github.com/JacquesLucke/blender_vscode/issues/49
Pros:
- Having the link temporary will fix issues that pop up in ugly corner cases in various places:
- uninstalling addon from blender might lead to data loss
- importing data from previous blender converts junction (link) into directory what leads to permission error when trying to install addon
Cons:
- changes what users are used to. we can also prompt user to choose.
- removing junctions and directories in python is a mess!!! Different python versions handle junctions dramatically differently.
Design 1 - link only when debugging - used in this PR
- temporary link to addon dir is made only for VS code session - proposed in #55 but not merged, so
- add new setting to go back to previous behaviour - simple
- or create a command "Blender: Install addons" that links/installs addons permamently - might be complicated - addons can have different ways of installation.
Design 2 - modify addon directory - unused
- breaking change
- modify VS code startup to use separate addon
BLENDER_USER_SCRIPTS
and dirBLENDER_SYSTEM_EXTENSIONS
- might conflict with user settings
Design 3
Modfiy blender preferences to recognise addon location via bpy.context.preferences.filepaths.script_directories
Cons:
- breaking change
- requires specific directory structure, see instructions from this random repo: https://github.com/hextantstudios/hextant_python_debugger?tab=readme-ov-file#setup-a-custom-scripts-folder-for-your-add-on
- is extension supported via this mechanism?
- script directories change require blender restart
- older blender versions can specify one path, later have list of paths to specify in
bpy.context.preferences.filepaths.script_directories
- might conflict with user settings