diff options
author | Antonio Vazquez <blendergit@gmail.com> | 2019-06-07 13:59:47 +0300 |
---|---|---|
committer | Antonio Vazquez <blendergit@gmail.com> | 2019-06-07 13:59:47 +0300 |
commit | a412f49e7580a96ff3088dd2f763efe3a814c131 (patch) | |
tree | 4c4077c7e3fcab2cdc2e736a59d5c4d8f4ae8a5f /source | |
parent | 1f93f9e9820890a9389b603df8e3c4623a6f73a5 (diff) |
GPencil: Create new CURSOR for paint modes
This new cursor is used instead of the ARROW because it was too disruptive while you are drawing.
The change affects all paint modes that are used Brushes.
See D5036 for details.
Reviewers: @brecht @billreynish @mendio
Cursor designed by: @billreynish
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/editors/gpencil/gpencil_paint.c | 10 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_wm_api.c | 1 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_cursors.c | 61 | ||||
-rw-r--r-- | source/blender/windowmanager/wm_cursors.h | 1 |
4 files changed, 67 insertions, 6 deletions
diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c index cd1ebc91fbb..fc888ba95f4 100644 --- a/source/blender/editors/gpencil/gpencil_paint.c +++ b/source/blender/editors/gpencil/gpencil_paint.c @@ -2392,10 +2392,6 @@ static void gpencil_draw_exit(bContext *C, wmOperator *op) WM_cursor_modal_restore(CTX_wm_window(C)); } else { - /* or restore paint if 3D view */ - if ((p) && (p->paintmode == GP_PAINTMODE_ERASER)) { - WM_cursor_modal_set(p->win, CURSOR_STD); - } /* drawing batch cache is dirty now */ bGPdata *gpd = CTX_data_gpencil_data(C); @@ -2409,8 +2405,6 @@ static void gpencil_draw_exit(bContext *C, wmOperator *op) gpencil_undo_finish(); /* cleanup */ - WM_cursor_modal_set(p->win, CURSOR_STD); - gp_paint_cleanup(p); gp_session_cleanup(p); ED_gpencil_toggle_brush_cursor(C, true, NULL); @@ -2478,6 +2472,9 @@ static int gpencil_draw_init(bContext *C, wmOperator *op, const wmEvent *event) /* ensure that the correct cursor icon is set */ static void gpencil_draw_cursor_set(tGPsdata *p) { + return; + /* Disable while we get a better cursor handling for direct input devices (Cintiq/Ipad)*/ +#if 0 Brush *brush = p->brush; if ((p->paintmode == GP_PAINTMODE_ERASER) || (brush->gpencil_tool == GPAINT_TOOL_ERASE)) { WM_cursor_modal_set(p->win, BC_CROSSCURSOR); /* XXX need a better cursor */ @@ -2485,6 +2482,7 @@ static void gpencil_draw_cursor_set(tGPsdata *p) else { WM_cursor_modal_set(p->win, CURSOR_NONE); } +#endif } /* update UI indicators of status, including cursor and header prints */ diff --git a/source/blender/makesrna/intern/rna_wm_api.c b/source/blender/makesrna/intern/rna_wm_api.c index 1fea87df10c..3748a2fdbb6 100644 --- a/source/blender/makesrna/intern/rna_wm_api.c +++ b/source/blender/makesrna/intern/rna_wm_api.c @@ -59,6 +59,7 @@ const EnumPropertyItem rna_enum_window_cursor_items[] = { {BC_NS_SCROLLCURSOR, "SCROLL_Y", 0, "Scroll-Y", ""}, {BC_NSEW_SCROLLCURSOR, "SCROLL_XY", 0, "Scroll-XY", ""}, {BC_EYEDROPPER_CURSOR, "EYEDROPPER", 0, "Eyedropper", ""}, + {BC_PAINTCROSSCURSOR, "PAINT_CROSSHAIR", 0, "Paint Crosshair", ""}, {0, NULL, 0, NULL, NULL}, }; diff --git a/source/blender/windowmanager/intern/wm_cursors.c b/source/blender/windowmanager/intern/wm_cursors.c index 490a05a40d6..44395b0b201 100644 --- a/source/blender/windowmanager/intern/wm_cursors.c +++ b/source/blender/windowmanager/intern/wm_cursors.c @@ -1571,5 +1571,66 @@ void wm_init_cursor_data(void) END_CURSOR_BLOCK; + /********************** PaintCross Cursor ***********************/ + BEGIN_CURSOR_BLOCK; + static char paintcross_sbm[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + }; + + static char paintcross_smsk[] = { + 0x00, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x0e, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, + }; + + static char paintcross_sbm_large[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + }; + + static char paintcross_smsk_large[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0xc0, 0x00, + 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0xc0, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x00, 0xc0, 0x0f, + 0xfc, 0x00, 0xc0, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, + 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, + 0xc0, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + }; + + static BCursor PaintCrossCursor = { + /*small*/ + paintcross_sbm, + paintcross_smsk, + 16, + 16, + 7, + 7, + /*big*/ + paintcross_sbm_large, + paintcross_smsk_large, + 32, + 32, + 15, + 15, + /*color*/ + BC_BLACK, + BC_WHITE, + }; + + BlenderCursor[BC_PAINTCROSSCURSOR] = &PaintCrossCursor; + END_CURSOR_BLOCK; + /********************** Put the cursors in the array ***********************/ } diff --git a/source/blender/windowmanager/wm_cursors.h b/source/blender/windowmanager/wm_cursors.h index b4b0bcf0149..46fdb4baa5b 100644 --- a/source/blender/windowmanager/wm_cursors.h +++ b/source/blender/windowmanager/wm_cursors.h @@ -92,6 +92,7 @@ enum { BC_E_ARROWCURSOR, BC_W_ARROWCURSOR, BC_STOPCURSOR, + BC_PAINTCROSSCURSOR, /* --- ALWAYS LAST ----- */ BC_NUMCURSORS, }; |