I have a couple of preference properties (string, boolean, float) in my add-on and they all have a default value in their defining statement.
When I install an update to my add-on, the previously modified settings are not saved and the default values are used instead.
Is there a way to save the settings before the update and restore them afterwards? Or do I have to get rid of the default values from the properties? (That would be not so good.)
I was looking at the application handlers but I could not find a handler for add-on updates.
Does anyone have a best practice method for dealing with add-on preferences? Thanks in advance.
Update: here is how my add-on settings are defined:
class PREF_PT_Preferences(bpy.types.AddonPreferences):
bl_idname = __package__
pref_library_path: bpy.props.StringProperty(name="pref_library_path",subtype="DIR_PATH", description = '...', default=Library_Location)
pref_local_lib_path: bpy.props.StringProperty(name="pref_local_lib_path",subtype="DIR_PATH",description = '...', default="")
pref_stage_height: bpy.props.FloatProperty(name ='pref_stage_height', description = '...', default=(240), soft_min=0, soft_max=1000)
bpy.types.AddonPreferences
with:
-properties? $\endgroup$