[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [51451] trunk/blender/source/blender/ makesrna/intern/rna_wm.c: Bugfix #32641

Ton Roosendaal ton at blender.org
Sat Oct 20 16:13:14 CEST 2012


Revision: 51451
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=51451
Author:   ton
Date:     2012-10-20 14:13:14 +0000 (Sat, 20 Oct 2012)
Log Message:
-----------
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.

Modified Paths:
--------------
    trunk/blender/source/blender/makesrna/intern/rna_wm.c

Modified: trunk/blender/source/blender/makesrna/intern/rna_wm.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_wm.c	2012-10-20 14:10:28 UTC (rev 51450)
+++ trunk/blender/source/blender/makesrna/intern/rna_wm.c	2012-10-20 14:13:14 UTC (rev 51451)
@@ -629,6 +629,20 @@
 	}
 }
 
+/* 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 @@
 	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");
 




More information about the Bf-blender-cvs mailing list