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:
authorAntony Riakiotakis <kalast@gmail.com>2014-07-14 18:49:00 +0400
committerAntony Riakiotakis <kalast@gmail.com>2014-07-14 18:49:00 +0400
commit48eececdba17af7d85fc19480be0e34e38362e66 (patch)
tree146586c54f236aebcdad152c93f5ea9514e1f32b /source/blender/makesrna/intern
parent45f0bd6eb1d15aed480fc843ed1c4acc9865abc4 (diff)
Follow up to previous commit.
* Expose is_tablet property to events to determine if event contains tablet data. * Expose tablet tilt for events as a 2D vector in python
Diffstat (limited to 'source/blender/makesrna/intern')
-rw-r--r--source/blender/makesrna/intern/rna_wm.c25
1 files changed, 24 insertions, 1 deletions
diff --git a/source/blender/makesrna/intern/rna_wm.c b/source/blender/makesrna/intern/rna_wm.c
index 21df596dec2..996d2d2882d 100644
--- a/source/blender/makesrna/intern/rna_wm.c
+++ b/source/blender/makesrna/intern/rna_wm.c
@@ -568,7 +568,19 @@ static int rna_Event_unicode_length(PointerRNA *ptr)
static float rna_Event_pressure_get(PointerRNA *ptr)
{
wmEvent *event = ptr->data;
- return WM_event_tablet_data(event, NULL);
+ return WM_event_tablet_data(event, NULL, NULL);
+}
+
+static int rna_Event_is_tablet_get(PointerRNA *ptr)
+{
+ wmEvent *event = ptr->data;
+ return WM_event_is_tablet(event);
+}
+
+static void rna_Event_tilt_get(PointerRNA *ptr, float *values)
+{
+ wmEvent *event = ptr->data;
+ WM_event_tablet_data(event, NULL, values);
}
static PointerRNA rna_PopupMenu_layout_get(PointerRNA *ptr)
@@ -1619,6 +1631,17 @@ static void rna_def_event(BlenderRNA *brna)
RNA_def_property_float_funcs(prop, "rna_Event_pressure_get", NULL, NULL);
RNA_def_property_ui_text(prop, "Tablet Pressure", "The pressure of the tablet or 1.0 if no tablet present");
+ prop = RNA_def_property(srna, "tilt", PROP_FLOAT, PROP_XYZ_LENGTH);
+ RNA_def_property_array(prop, 2);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_float_funcs(prop, "rna_Event_tilt_get", NULL, NULL);
+ RNA_def_property_ui_text(prop, "Tablet Tilt", "The pressure of the tablet or zeroes if no tablet present");
+
+ prop = RNA_def_property(srna, "is_tablet", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_boolean_funcs(prop, "rna_Event_is_tablet_get", NULL);
+ RNA_def_property_ui_text(prop, "Tablet Pressure", "The pressure of the tablet or 1.0 if no tablet present");
+
/* modifiers */
prop = RNA_def_property(srna, "shift", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "shift", 1);