[Bf-blender-cvs] [0d8a007] master: Fix T42088: Creating new keybinds can cause duplicates when saving key config profile

Bastien Montagne noreply at git.blender.org
Mon Oct 6 22:13:15 CEST 2014


Commit: 0d8a007c69ed2af759edbb4fb2c6f89ef4a7dd56
Author: Bastien Montagne
Date:   Mon Oct 6 22:08:37 2014 +0200
Branches: master
https://developer.blender.org/rB0d8a007c69ed2af759edbb4fb2c6f89ef4a7dd56

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.

===================================================================

M	source/blender/windowmanager/intern/wm_keymap.c

===================================================================

diff --git a/source/blender/windowmanager/intern/wm_keymap.c b/source/blender/windowmanager/intern/wm_keymap.c
index 748303f..1abe000 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;




More information about the Bf-blender-cvs mailing list