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:
authorMartin Poirier <theeth@yahoo.com>2010-01-29 05:01:02 +0300
committerMartin Poirier <theeth@yahoo.com>2010-01-29 05:01:02 +0300
commit70109d0dc13e6c9407f5118c9d0a7d31007f714d (patch)
treebb9685284c7a54ca2bd7f296eae17fef16f92447 /source/blender
parent30c317de70bdb5348adecf9f1d8518a51aff6c86 (diff)
Speed up keymap editor a bit (less context changes)
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/makesrna/intern/rna_wm_api.c6
-rw-r--r--source/blender/windowmanager/intern/wm_keymap.c7
2 files changed, 7 insertions, 6 deletions
diff --git a/source/blender/makesrna/intern/rna_wm_api.c b/source/blender/makesrna/intern/rna_wm_api.c
index 9759e72165a..9c41d280dac 100644
--- a/source/blender/makesrna/intern/rna_wm_api.c
+++ b/source/blender/makesrna/intern/rna_wm_api.c
@@ -365,6 +365,12 @@ void RNA_api_keymap(StructRNA *srna)
parm= RNA_def_pointer(func, "item", "KeyMapItem", "Item", "");
RNA_def_property_flag(parm, PROP_REQUIRED);
+ func= RNA_def_function(srna, "item_from_id", "WM_keymap_item_find_id");
+ parm= RNA_def_property(func, "id", PROP_INT, PROP_NONE);
+ RNA_def_property_ui_text(parm, "id", "ID of the item.");
+ parm= RNA_def_pointer(func, "item", "KeyMapItem", "Item", "");
+ RNA_def_function_return(func, parm);
+
func= RNA_def_function(srna, "copy_to_user", "WM_keymap_copy_to_user");
parm= RNA_def_pointer(func, "keymap", "KeyMap", "Key Map", "User editable key map.");
RNA_def_function_return(func, parm);
diff --git a/source/blender/windowmanager/intern/wm_keymap.c b/source/blender/windowmanager/intern/wm_keymap.c
index 4dbc1730033..24a66883ef7 100644
--- a/source/blender/windowmanager/intern/wm_keymap.c
+++ b/source/blender/windowmanager/intern/wm_keymap.c
@@ -688,12 +688,7 @@ void WM_keymap_restore_item_to_default(bContext *C, wmKeyMap *keymap, wmKeyMapIt
}
if (km) {
- wmKeyMapItem *orig;
-
- for (orig = km->items.first; orig; orig = orig->next) {
- if (orig->id == kmi->id)
- break;
- }
+ wmKeyMapItem *orig = WM_keymap_item_find_id(km, kmi->id);
if (orig) {
if(strcmp(orig->idname, kmi->idname) != 0) {