Added preference setting to solve persistence as optional toggle. #244
Added preference setting to solve persistence as optional toggle. #244Sekuora wants to merge 4 commits into
Conversation
Added a new add-on preference: Persist Preferences. When enabled, the add-on saves its preferences to: Blender user config/screencast_keys/preferences.json
There was a problem hiding this comment.
This is interesting feature.
Thank you @Sekuora .
We need some document for the user.
Is it possible to update this document as well?
https://github.com/nutti/Screencast-Keys/blob/master/docs/tutorial.md
Also, introducing importing/exporting configuration function is a nice idea.
nutti
left a comment
There was a problem hiding this comment.
We need to change blender_manifest.toml to accept files permission.
https://github.com/nutti/Screencast-Keys/blob/master/src/screencast_keys/blender_manifest.toml
https://docs.blender.org/manual/en/latest/advanced/extensions/getting_started.html
| preferences.SK_Preferences.ui_in_sidebar_update_fn(prefs, context) | ||
| preferences.SK_Preferences.ui_in_overlay_update_fn(prefs, context) | ||
|
|
||
| # Fix: https://github.com/nutti/Screencast-Keys/issues/195 |
There was a problem hiding this comment.
Is my understanding correct, this is still valid when there is no configuration file,
There was a problem hiding this comment.
Yes, I tested and there's no traces of that.
The fix is now part of the function def ensure_display_event_text_aliases(prefs) in preferences.py.
This will create a dictionary containing all the known keys taking from ops.EventType.names[event.name] same ones used by default and guarantees a single entry per item.
Then it reads from the user overrides which don't need to be persisted on the save file for this to work, keeping the fix.
| return | ||
|
|
||
| data = { | ||
| "version": 1, |
There was a problem hiding this comment.
Can we follow semantic versioning?
In this case, 1.0.0 is good.
|
|
||
|
|
||
| def ensure_display_event_text_aliases(prefs): | ||
| from . import ops # pylint: disable=C0415 |
There was a problem hiding this comment.
Please move to the top-level import instead of here.
|
|
||
| data = { | ||
| "version": 1, | ||
| "persist_preferences": True, |
There was a problem hiding this comment.
It is the entry point for the persist Boolean of the new setting. It has to be written explicitly the first time a preferences file is created to keep track if the user want to restore this setting file or delete it. Maybe I can think of aa different name.
Fixed the misplaced import. Changed version from single number to string type
Wrote an explanation for the persist preferences feature.
Sekuora
left a comment
There was a problem hiding this comment.
Hello, thanks for the review.
I changed this:
- The save file version name from 1 to 1.0.0
- Permissions in manifest file now include "files" using the extensions guide format.
- Explanation of what the persist preferences feature does in docs.
please let me know if anything else comes up.
|
@Sekuora |
Dear nutti, this is a proposal that adds persistence in the add-on. Creating settings that could be later on shared between other installations of screencast keys and survive add-on reloads.
I hope you can evaluate if it serves the development of the add-on. Otherwise, I hope it serves as inspiration for future add-on features.
What was changed:
Persist Preferences.Blender user config/screencast_keys/preferences.jsonPersist Preferencesis disabled, it removes the .json file and keeps the behavior that restores settings to defaults.How it works:
2026-06-05.20-15-45.mp4
Example persistence file:
preferences.json
What gets persisted:
Implementation details:
preferences.py.__init__.py.