[Bf-blender-cvs] [02a5cf7] master: Fix for debug-only crash when setting "Any" keymap input type

Dalai Felinto noreply at git.blender.org
Fri Apr 10 16:11:21 CEST 2015


Commit: 02a5cf75a21ba0aeb394b3ff0b9882f950187adc
Author: Dalai Felinto
Date:   Fri Apr 10 11:03:47 2015 -0300
Branches: master
https://developer.blender.org/rB02a5cf75a21ba0aeb394b3ff0b9882f950187adc

Fix for debug-only crash when setting "Any" keymap input type

Another one of those assert crashes when passing values != than 1 and 0
(in this case the value is -1)

Notes from reviewer:
--------------------
These should really be enums. since valid values are KM_ANY,
KM_MOD_FIRST, KM_MOD_SECOND.

But can see at some point this was changed from an enum so... I guess
this is the only way.

Reviewers: campbellbarton

Differential Revision: https://developer.blender.org/D1227

===================================================================

M	source/blender/makesrna/intern/rna_wm.c

===================================================================

diff --git a/source/blender/makesrna/intern/rna_wm.c b/source/blender/makesrna/intern/rna_wm.c
index a423a06..f01e1d0 100644
--- a/source/blender/makesrna/intern/rna_wm.c
+++ b/source/blender/makesrna/intern/rna_wm.c
@@ -790,6 +790,29 @@ static void rna_KeyMapItem_any_set(PointerRNA *ptr, int value)
 	}
 }
 
+static int rna_KeyMapItem_shift_get(PointerRNA *ptr)
+{
+	wmKeyMapItem *kmi = (wmKeyMapItem *)ptr->data;
+	return kmi->shift != 0;
+}
+
+static int rna_KeyMapItem_ctrl_get(PointerRNA *ptr)
+{
+	wmKeyMapItem *kmi = (wmKeyMapItem *)ptr->data;
+	return kmi->ctrl != 0;
+}
+
+static int rna_KeyMapItem_alt_get(PointerRNA *ptr)
+{
+	wmKeyMapItem *kmi = (wmKeyMapItem *)ptr->data;
+	return kmi->alt != 0;
+}
+
+static int rna_KeyMapItem_oskey_get(PointerRNA *ptr)
+{
+	wmKeyMapItem *kmi = (wmKeyMapItem *)ptr->data;
+	return kmi->oskey != 0;
+}
 
 static PointerRNA rna_WindowManager_active_keyconfig_get(PointerRNA *ptr)
 {
@@ -2073,6 +2096,7 @@ static void rna_def_keyconfig(BlenderRNA *brna)
 
 	prop = RNA_def_property(srna, "shift", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "shift", 0);
+	RNA_def_property_boolean_funcs(prop, "rna_KeyMapItem_shift_get", NULL);
 /*	RNA_def_property_enum_sdna(prop, NULL, "shift"); */
 /*	RNA_def_property_enum_items(prop, keymap_modifiers_items); */
 	RNA_def_property_ui_text(prop, "Shift", "Shift key pressed");
@@ -2080,6 +2104,7 @@ static void rna_def_keyconfig(BlenderRNA *brna)
 
 	prop = RNA_def_property(srna, "ctrl", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "ctrl", 0);
+	RNA_def_property_boolean_funcs(prop, "rna_KeyMapItem_ctrl_get", NULL);
 /*	RNA_def_property_enum_sdna(prop, NULL, "ctrl"); */
 /*	RNA_def_property_enum_items(prop, keymap_modifiers_items); */
 	RNA_def_property_ui_text(prop, "Ctrl", "Control key pressed");
@@ -2087,6 +2112,7 @@ static void rna_def_keyconfig(BlenderRNA *brna)
 
 	prop = RNA_def_property(srna, "alt", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "alt", 0);
+	RNA_def_property_boolean_funcs(prop, "rna_KeyMapItem_alt_get", NULL);
 /*	RNA_def_property_enum_sdna(prop, NULL, "alt"); */
 /*	RNA_def_property_enum_items(prop, keymap_modifiers_items); */
 	RNA_def_property_ui_text(prop, "Alt", "Alt key pressed");
@@ -2094,6 +2120,7 @@ static void rna_def_keyconfig(BlenderRNA *brna)
 
 	prop = RNA_def_property(srna, "oskey", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "oskey", 0);
+	RNA_def_property_boolean_funcs(prop, "rna_KeyMapItem_oskey_get", NULL);
 /*	RNA_def_property_enum_sdna(prop, NULL, "oskey"); */
 /*	RNA_def_property_enum_items(prop, keymap_modifiers_items); */
 	RNA_def_property_ui_text(prop, "OS Key", "Operating system key pressed");




More information about the Bf-blender-cvs mailing list