[Bf-blender-cvs] [01af839] blender-v2.72-release: Fix T42088: Creating new keybinds can cause duplicates when saving key config profile

Bastien Montagne noreply at git.blender.org
Wed Oct 15 13:07:58 CEST 2014


Commit: 01af839ee6dc0f0bdbaafbc4d4e7c4dd5c69ab41
Author: Bastien Montagne
Date:   Mon Oct 6 22:08:37 2014 +0200
Branches: blender-v2.72-release
https://developer.blender.org/rB01af839ee6dc0f0bdbaafbc4d4e7c4dd5c69ab41

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