diff options
author | Martin Poirier <theeth@yahoo.com> | 2009-12-17 06:32:33 +0300 |
---|---|---|
committer | Martin Poirier <theeth@yahoo.com> | 2009-12-17 06:32:33 +0300 |
commit | fd18f555103efe8ac148ab763965d5595632da3d (patch) | |
tree | de257068c03ac20500c55568c40214c61716caf7 /source/blender/makesrna/intern/rna_wm_api.c | |
parent | c3b978828cc47aca064d8e3e5349ec76e802c844 (diff) |
keymap editor
New unique ID per keymap item (unique inside their keymap) for default and configuration keymaps.
This allows restoring a single user defined kmi to its previous (default or config) values instead of having to restore the whole keymap.
The restore item button is disabled for kmi added by the users (they don't have an ID).
Also fixes a bug in the rna function for add keymap item (parameter order was incorrect, messing adding back saved configurations).
Diffstat (limited to 'source/blender/makesrna/intern/rna_wm_api.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_wm_api.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/source/blender/makesrna/intern/rna_wm_api.c b/source/blender/makesrna/intern/rna_wm_api.c index 47d15c87596..94a689c9f1c 100644 --- a/source/blender/makesrna/intern/rna_wm_api.c +++ b/source/blender/makesrna/intern/rna_wm_api.c @@ -113,7 +113,12 @@ static wmKeyMapItem *rna_KeyMap_add_modal_item(wmKeyMap *km, bContext *C, Report return WM_modalkeymap_add_item(km, type, value, modifier, keymodifier, propvalue); } -static wmKeyMapItem *rna_KeyMap_add_item(wmKeyMap *km, ReportList *reports, char *idname, int type, int any, int value, int shift, int ctrl, int alt, int oskey, int keymodifier) +static void rna_keymap_restore_item_to_default(wmKeyMap *km, bContext *C, wmKeyMapItem *kmi) +{ + WM_keymap_restore_item_to_default(C, km, kmi); +} + +static wmKeyMapItem *rna_KeyMap_add_item(wmKeyMap *km, ReportList *reports, char *idname, int type, int value, int any, int shift, int ctrl, int alt, int oskey, int keymodifier) { // wmWindowManager *wm = CTX_wm_manager(C); int modifier= 0; @@ -276,6 +281,11 @@ void RNA_api_keymap(StructRNA *srna) RNA_def_function_return(func, parm); func= RNA_def_function(srna, "restore_to_default", "WM_keymap_restore_to_default"); + + func= RNA_def_function(srna, "restore_item_to_default", "rna_keymap_restore_item_to_default"); + RNA_def_function_flag(func, FUNC_USE_CONTEXT); + parm= RNA_def_pointer(func, "item", "KeyMapItem", "Item", ""); + RNA_def_property_flag(parm, PROP_REQUIRED); } #endif |