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:
authorCampbell Barton <ideasman42@gmail.com>2013-01-16 23:22:15 +0400
committerCampbell Barton <ideasman42@gmail.com>2013-01-16 23:22:15 +0400
commit337695d4967f99edd5163a639d0f7a884fcd27c8 (patch)
treecfa4b2774866fc14633d987127249903d6229811 /source/blender/windowmanager
parent6e7ee2649d108e680d4d25f6f2d382022fd0bb75 (diff)
draw the brush size with pressure applied (when the tablet is used), nice to see the actual size used.
Diffstat (limited to 'source/blender/windowmanager')
-rw-r--r--source/blender/windowmanager/WM_api.h1
-rw-r--r--source/blender/windowmanager/intern/wm_event_system.c4
-rw-r--r--source/blender/windowmanager/intern/wm_window.c15
3 files changed, 20 insertions, 0 deletions
diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h
index eb1aad75a88..1b8bf29d92a 100644
--- a/source/blender/windowmanager/WM_api.h
+++ b/source/blender/windowmanager/WM_api.h
@@ -131,6 +131,7 @@ void *WM_paint_cursor_activate(struct wmWindowManager *wm,
void WM_paint_cursor_end(struct wmWindowManager *wm, void *handle);
void WM_cursor_warp (struct wmWindow *win, int x, int y);
+float WM_cursor_pressure (const struct wmWindow *win);
/* event map */
int WM_userdef_event_map(int kmitype);
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c
index d81aa74e138..907a0a34f60 100644
--- a/source/blender/windowmanager/intern/wm_event_system.c
+++ b/source/blender/windowmanager/intern/wm_event_system.c
@@ -2655,6 +2655,10 @@ static void update_tablet_data(wmWindow *win, wmEvent *event)
event->custom = EVT_DATA_TABLET;
event->customdata = wmtab;
event->customdatafree = 1;
+ // printf("%s: using tablet %.5f\n", wmtab->Pressure, __func__);
+ }
+ else {
+ // printf("%s: not using tablet\n", __func__);
}
}
diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c
index e6a40187bfe..52024897f70 100644
--- a/source/blender/windowmanager/intern/wm_window.c
+++ b/source/blender/windowmanager/intern/wm_window.c
@@ -1318,6 +1318,21 @@ void WM_cursor_warp(wmWindow *win, int x, int y)
}
}
+/**
+ * Get the cursor pressure, in most cases you'll want to use wmTabletData from the event
+ */
+float WM_cursor_pressure(const struct wmWindow *win)
+{
+ const GHOST_TabletData *td = GHOST_GetTabletData(win->ghostwin);
+ /* if there's tablet data from an active tablet device then add it */
+ if ((td != NULL) && td->Active != GHOST_kTabletModeNone) {
+ return td->Pressure;
+ }
+ else {
+ return -1.0f;
+ }
+}
+
/* support for native pixel size */
/* mac retina opens window in size X, but it has up to 2 x more pixels */
int WM_window_pixels_x(wmWindow *win)