Versioning: add missing version update for renamed key-map

Account for the renamed key-map when loading older saved key-maps &
stored user preferences. [0] missed these changes.

[0]: 661e7e451a
This commit is contained in:
Campbell Barton 2024-02-09 18:09:05 +11:00
parent 4e93355187
commit 41b63ebda2
3 changed files with 25 additions and 1 deletions

View File

@ -53,6 +53,19 @@ def keyconfig_update(keyconfig_data, keyconfig_version):
item_prop["properties"] = filtered_properties
keyconfig_data[kmi_index][2]["items"][kmi_item_index] = (item_op, item_event, item_prop)
def rename_keymap(km_name_map):
nonlocal keyconfig_data
nonlocal has_copy
for km_index, (km_name, km_parms, km_items_data) in enumerate(keyconfig_data):
km_name_dst = km_name_map.get(km_name)
if km_name_dst is None:
continue
if not has_copy:
keyconfig_data = copy.deepcopy(keyconfig_data)
has_copy = True
keyconfig_data[km_index] = (km_name_dst, km_parms, km_items_data)
# Default repeat to false.
if keyconfig_version <= (2, 92, 0):
if not has_copy:
@ -164,4 +177,7 @@ def keyconfig_update(keyconfig_data, keyconfig_version):
km_items_data["items"].append(
("PASSTHROUGH_NAVIGATE", {"type": 'LEFT_ALT', "value": 'ANY', "any": True}, None))
if keyconfig_version <= (4, 1, 14):
rename_keymap({"NLA Channels": "NLA Tracks"})
return keyconfig_data

View File

@ -39,7 +39,7 @@ extern "C" {
* https://developer.blender.org/docs/handbook/guidelines/compatibility_handling_for_blend_files/
* for details. */
#define BLENDER_FILE_MIN_VERSION 306
#define BLENDER_FILE_MIN_SUBVERSION 13
#define BLENDER_FILE_MIN_SUBVERSION 14
/** User readable version string. */
const char *BKE_blender_version_string(void);

View File

@ -915,6 +915,14 @@ void blo_do_versions_userdef(UserDef *userdef)
userdef->keying_flag |= AUTOKEY_FLAG_INSERTNEEDED;
}
if (!USER_VERSION_ATLEAST(401, 14)) {
LISTBASE_FOREACH (wmKeyMap *, km, &userdef->user_keymaps) {
if (STREQ(km->idname, "NLA Channels")) {
STRNCPY(km->idname, "NLA Tracks");
}
}
}
/**
* Always bump subversion in BKE_blender_version.h when adding versioning
* code here, and wrap it inside a USER_VERSION_ATLEAST check.