draw the brush size with pressure applied (when the tablet is used), nice to see the actual size used.
This commit is contained in:
@@ -595,6 +595,18 @@ static void paint_draw_cursor(bContext *C, int x, int y, void *UNUSED(unused))
|
|||||||
|
|
||||||
/* draw brush outline */
|
/* draw brush outline */
|
||||||
glTranslatef(translation[0], translation[1], 0);
|
glTranslatef(translation[0], translation[1], 0);
|
||||||
|
|
||||||
|
/* draw an inner brush */
|
||||||
|
if (BKE_brush_use_size_pressure(scene, brush)) {
|
||||||
|
const wmWindow *win = CTX_wm_window(C);
|
||||||
|
const float pressure = WM_cursor_pressure(win);
|
||||||
|
if (pressure != -1.0f && pressure != 0.0f) {
|
||||||
|
/* inner at full alpha */
|
||||||
|
glutil_draw_lined_arc(0.0, M_PI * 2.0, final_radius * pressure, 40);
|
||||||
|
/* outer at half alpha */
|
||||||
|
glColor4f(outline_col[0], outline_col[1], outline_col[2], outline_alpha * 0.5f);
|
||||||
|
}
|
||||||
|
}
|
||||||
glutil_draw_lined_arc(0.0, M_PI * 2.0, final_radius, 40);
|
glutil_draw_lined_arc(0.0, M_PI * 2.0, final_radius, 40);
|
||||||
glTranslatef(-translation[0], -translation[1], 0);
|
glTranslatef(-translation[0], -translation[1], 0);
|
||||||
|
|
||||||
|
@@ -131,6 +131,7 @@ void *WM_paint_cursor_activate(struct wmWindowManager *wm,
|
|||||||
void WM_paint_cursor_end(struct wmWindowManager *wm, void *handle);
|
void WM_paint_cursor_end(struct wmWindowManager *wm, void *handle);
|
||||||
|
|
||||||
void WM_cursor_warp (struct wmWindow *win, int x, int y);
|
void WM_cursor_warp (struct wmWindow *win, int x, int y);
|
||||||
|
float WM_cursor_pressure (const struct wmWindow *win);
|
||||||
|
|
||||||
/* event map */
|
/* event map */
|
||||||
int WM_userdef_event_map(int kmitype);
|
int WM_userdef_event_map(int kmitype);
|
||||||
|
@@ -2655,6 +2655,10 @@ static void update_tablet_data(wmWindow *win, wmEvent *event)
|
|||||||
event->custom = EVT_DATA_TABLET;
|
event->custom = EVT_DATA_TABLET;
|
||||||
event->customdata = wmtab;
|
event->customdata = wmtab;
|
||||||
event->customdatafree = 1;
|
event->customdatafree = 1;
|
||||||
|
// printf("%s: using tablet %.5f\n", wmtab->Pressure, __func__);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// printf("%s: not using tablet\n", __func__);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -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 */
|
/* support for native pixel size */
|
||||||
/* mac retina opens window in size X, but it has up to 2 x more pixels */
|
/* mac retina opens window in size X, but it has up to 2 x more pixels */
|
||||||
int WM_window_pixels_x(wmWindow *win)
|
int WM_window_pixels_x(wmWindow *win)
|
||||||
|
Reference in New Issue
Block a user