Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Montagne <montagne29@wanadoo.fr>2014-10-07 00:08:37 +0400
committerBastien Montagne <montagne29@wanadoo.fr>2014-10-07 00:08:37 +0400
commit0d8a007c69ed2af759edbb4fb2c6f89ef4a7dd56 (patch)
tree32c5dd94d8b30c1ec046cf0e4dff1c0cd0168a60
parentb4860de6f18db5ef460b082ac8a7517d46ba2e1b (diff)
Fix T42088: Creating new keybinds can cause duplicates when saving key config profile
When patching a keymap with a 'UserPref' diff one, do not add keymap items from diff if they already exists in patched keymap.
-rw-r--r--source/blender/windowmanager/intern/wm_keymap.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/source/blender/windowmanager/intern/wm_keymap.c b/source/blender/windowmanager/intern/wm_keymap.c
index 748303f9082..1abe000a86c 100644
--- a/source/blender/windowmanager/intern/wm_keymap.c
+++ b/source/blender/windowmanager/intern/wm_keymap.c
@@ -589,8 +589,12 @@ static void wm_keymap_patch(wmKeyMap *km, wmKeyMap *diff_km)
/* add item */
if (kmdi->add_item) {
+ /* Do not re-add an already existing keymap item! See T42088. */
+ kmi_add = wm_keymap_find_item_equals(km, kmdi->add_item);
+ if (!kmi_add)
+ kmi_add = wm_keymap_find_item_equals_result(km, kmdi->add_item);
/* only if nothing to remove or item to remove found */
- if (!kmdi->remove_item || kmi_remove) {
+ if (!kmi_add && (!kmdi->remove_item || kmi_remove)) {
kmi_add = wm_keymap_item_copy(kmdi->add_item);
kmi_add->flag |= KMI_USER_MODIFIED;