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:
authorDalai Felinto <dfelinto@gmail.com>2013-09-27 18:05:07 +0400
committerDalai Felinto <dfelinto@gmail.com>2013-09-27 18:05:07 +0400
commitc2afa5cfaf4034f07ff0336991ceeda29014c75e (patch)
tree81d26322fee0742920ba3c781e666bc7f8882455 /source/blender/makesrna/intern/rna_wm_api.c
parent60e1fc70d28594920dcbaa9c41e9d532211e8073 (diff)
rna: implementing function to remove keymap from keyconfig
Thanks Campbell Barton for reviewing.
Diffstat (limited to 'source/blender/makesrna/intern/rna_wm_api.c')
-rw-r--r--source/blender/makesrna/intern/rna_wm_api.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_wm_api.c b/source/blender/makesrna/intern/rna_wm_api.c
index dfac81cf6c9..eb84bb61e1f 100644
--- a/source/blender/makesrna/intern/rna_wm_api.c
+++ b/source/blender/makesrna/intern/rna_wm_api.c
@@ -262,6 +262,18 @@ static wmKeyMap *rna_keymap_find_modal(wmKeyConfig *UNUSED(keyconf), const char
return ot->modalkeymap;
}
+static void rna_KeyMap_remove(wmKeyConfig *keyconfig, ReportList *reports, PointerRNA *keymap_ptr)
+{
+ wmKeyMap *keymap = keymap_ptr->data;
+
+ if (WM_keymap_remove(keyconfig, keymap) == FALSE) {
+ BKE_reportf(reports, RPT_ERROR, "KeyConfig '%s' cannot be removed", keymap->idname);
+ return;
+ }
+
+ RNA_POINTER_INVALIDATE(keymap_ptr);
+}
+
static void rna_KeyConfig_remove(wmWindowManager *wm, ReportList *reports, PointerRNA *keyconf_ptr)
{
wmKeyConfig *keyconf = keyconf_ptr->data;
@@ -671,6 +683,12 @@ void RNA_api_keymaps(StructRNA *srna)
parm = RNA_def_pointer(func, "keymap", "KeyMap", "Key Map", "Added key map");
RNA_def_function_return(func, parm);
+ func = RNA_def_function(srna, "remove", "rna_KeyMap_remove"); /* remove_keymap */
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ parm = RNA_def_pointer(func, "keymap", "KeyMap", "Key Map", "Removed key map");
+ RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPTR);
+ RNA_def_property_clear_flag(parm, PROP_THICK_WRAP);
+
func = RNA_def_function(srna, "find", "rna_keymap_find"); /* find_keymap */
parm = RNA_def_string(func, "name", "", 0, "Name", "");
RNA_def_property_flag(parm, PROP_REQUIRED);