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:
authorTon Roosendaal <ton@blender.org>2012-10-20 18:13:14 +0400
committerTon Roosendaal <ton@blender.org>2012-10-20 18:13:14 +0400
commitadd48983ca6965c1da7ac7bdd0f4100c04a7a4ce (patch)
treeadb639273caca9095da85eae5ee71c5f80dfdccb /source/blender/makesrna
parent950524722cc3cebbe23f7eaa0caad097c329eac3 (diff)
Bugfix #32641
User preferences, keymap editor: it allowed to set any event for "key modifier", and not even to NULL the option. Now it limits to keyboard events, on mouseclicks it clears, on ESC it exits without changes.
Diffstat (limited to 'source/blender/makesrna')
-rw-r--r--source/blender/makesrna/intern/rna_wm.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_wm.c b/source/blender/makesrna/intern/rna_wm.c
index 30bdc717f50..2462733915b 100644
--- a/source/blender/makesrna/intern/rna_wm.c
+++ b/source/blender/makesrna/intern/rna_wm.c
@@ -629,6 +629,20 @@ static void rna_wmKeyMapItem_map_type_set(PointerRNA *ptr, int value)
}
}
+/* assumes value to be an enum from event_type_items */
+/* function makes sure keymodifiers are only valid keys, ESC keeps it unaltered */
+static void rna_wmKeyMapItem_keymodifier_set(PointerRNA *ptr, int value)
+{
+ wmKeyMapItem *kmi = ptr->data;
+
+ if (value == ESCKEY);
+ else if (value >= AKEY)
+ kmi->keymodifier = value;
+ else
+ kmi->keymodifier = 0;
+}
+
+
static EnumPropertyItem *rna_KeyMapItem_type_itemf(bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop),
int *UNUSED(free))
{
@@ -1865,6 +1879,7 @@ static void rna_def_keyconfig(BlenderRNA *brna)
prop = RNA_def_property(srna, "key_modifier", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "keymodifier");
RNA_def_property_enum_items(prop, event_type_items);
+ RNA_def_property_enum_funcs(prop, NULL, "rna_wmKeyMapItem_keymodifier_set", NULL);
RNA_def_property_ui_text(prop, "Key Modifier", "Regular key pressed as a modifier");
RNA_def_property_update(prop, 0, "rna_KeyMapItem_update");