diff options
author | Antony Riakiotakis <kalast@gmail.com> | 2014-07-14 17:59:35 +0400 |
---|---|---|
committer | Antony Riakiotakis <kalast@gmail.com> | 2014-07-14 18:06:53 +0400 |
commit | 45f0bd6eb1d15aed480fc843ed1c4acc9865abc4 (patch) | |
tree | c28344a369d83cef2977de319064a3f425bc8195 /source/blender/makesrna/intern/rna_wm.c | |
parent | 8554fa2fad63c20ff0c23894ad0b41087d149a32 (diff) |
Feature request:
Expose pressure from event system to python. This will return the tablet
pressure, if a tablet is present, or 1.0 if not.
Diffstat (limited to 'source/blender/makesrna/intern/rna_wm.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_wm.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_wm.c b/source/blender/makesrna/intern/rna_wm.c index 23b6d1e41ae..21df596dec2 100644 --- a/source/blender/makesrna/intern/rna_wm.c +++ b/source/blender/makesrna/intern/rna_wm.c @@ -565,6 +565,12 @@ 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); +} + static PointerRNA rna_PopupMenu_layout_get(PointerRNA *ptr) { struct uiPopupMenu *pup = ptr->data; @@ -1608,6 +1614,10 @@ static void rna_def_event(BlenderRNA *brna) RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "Mouse Previous Y Position", "The window relative vertical location of the mouse"); + prop = RNA_def_property(srna, "pressure", PROP_FLOAT, PROP_NONE); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + 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"); /* modifiers */ prop = RNA_def_property(srna, "shift", PROP_BOOLEAN, PROP_NONE); |