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:
authorBrecht Van Lommel <brechtvanlommel@gmail.com>2019-06-16 21:16:28 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2019-06-16 21:29:22 +0300
commit40a8c4908818bdf1c4628a389803a9a26e2d68f1 (patch)
treebf1eed08131bad513b737e4016b5557c8d86768d
parent087a4898676d744d4aaa46a59b47186825495820 (diff)
Revert new grease pencil cursor for paint modes
This reverts commit a412f49e7580a and 873c756e5dd73. The change was only supposed to affect grease pencil, but also changed the cursor for sculpt mode, where it's not clearly visible. Since this has not been quickly resolved I'm reverting the commit. Ref D5036.
-rw-r--r--release/scripts/startup/bl_ui/space_toolsystem_toolbar.py17
-rw-r--r--source/blender/editors/gpencil/gpencil_paint.c24
-rw-r--r--source/blender/makesrna/intern/rna_wm_api.c1
-rw-r--r--source/blender/windowmanager/intern/wm_cursors.c60
-rw-r--r--source/blender/windowmanager/wm_cursors.h1
5 files changed, 32 insertions, 71 deletions
diff --git a/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py b/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
index 59d38cc8ae4..5fcf117ecf1 100644
--- a/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
@@ -60,7 +60,6 @@ def generate_from_enum_ex(
idname=idname_prefix + name,
label=name,
icon=icon_prefix + idname.lower(),
- cursor='PAINT_CROSSHAIR',
data_block=idname,
**tooldef_keywords,
)
@@ -200,7 +199,7 @@ class _defs_annotate:
idname="builtin.annotate_line",
label="Annotate Line",
icon="ops.gpencil.draw.line",
- cursor='PAINT_CROSSHAIR',
+ cursor='CROSSHAIR',
keymap="Generic Tool: Annotate Line",
draw_settings=draw_settings,
)
@@ -211,7 +210,7 @@ class _defs_annotate:
idname="builtin.annotate_polygon",
label="Annotate Polygon",
icon="ops.gpencil.draw.poly",
- cursor='PAINT_CROSSHAIR',
+ cursor='CROSSHAIR',
keymap="Generic Tool: Annotate Polygon",
draw_settings=draw_settings,
)
@@ -226,7 +225,7 @@ class _defs_annotate:
idname="builtin.annotate_eraser",
label="Annotate Eraser",
icon="ops.gpencil.draw.eraser",
- cursor='PAINT_CROSSHAIR', # XXX: Always show brush circle when enabled
+ cursor='CROSSHAIR', # XXX: Always show brush circle when enabled
keymap="Generic Tool: Annotate Eraser",
draw_settings=draw_settings,
)
@@ -1287,7 +1286,7 @@ class _defs_gpencil_paint:
idname="builtin.line",
label="Line",
icon="ops.gpencil.primitive_line",
- cursor='PAINT_CROSSHAIR',
+ cursor='CROSSHAIR',
widget=None,
keymap=(),
)
@@ -1298,7 +1297,7 @@ class _defs_gpencil_paint:
idname="builtin.box",
label="Box",
icon="ops.gpencil.primitive_box",
- cursor='PAINT_CROSSHAIR',
+ cursor='CROSSHAIR',
widget=None,
keymap=(),
)
@@ -1309,7 +1308,7 @@ class _defs_gpencil_paint:
idname="builtin.circle",
label="Circle",
icon="ops.gpencil.primitive_circle",
- cursor='PAINT_CROSSHAIR',
+ cursor='CROSSHAIR',
widget=None,
keymap=(),
)
@@ -1320,7 +1319,7 @@ class _defs_gpencil_paint:
idname="builtin.arc",
label="Arc",
icon="ops.gpencil.primitive_arc",
- cursor='PAINT_CROSSHAIR',
+ cursor='CROSSHAIR',
widget=None,
keymap=(),
)
@@ -1331,7 +1330,7 @@ class _defs_gpencil_paint:
idname="builtin.curve",
label="Curve",
icon="ops.gpencil.primitive_curve",
- cursor='PAINT_CROSSHAIR',
+ cursor='CROSSHAIR',
widget=None,
keymap=(),
)
diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c
index 041704d8473..c5e91bd2cab 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -2392,6 +2392,10 @@ 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);
@@ -2405,6 +2409,8 @@ 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);
@@ -2469,6 +2475,18 @@ 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)
+{
+ 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 */
+ }
+ else {
+ WM_cursor_modal_set(p->win, CURSOR_NONE);
+ }
+}
+
/* update UI indicators of status, including cursor and header prints */
static void gpencil_draw_status_indicators(bContext *C, tGPsdata *p)
{
@@ -3183,6 +3201,11 @@ static int gpencil_draw_invoke(bContext *C, wmOperator *op, const wmEvent *event
else {
ED_gpencil_toggle_brush_cursor(C, true, NULL);
}
+ /* set cursor
+ * NOTE: This may change later (i.e. intentionally via brush toggle,
+ * or unintentionally if the user scrolls outside the area)...
+ */
+ gpencil_draw_cursor_set(p);
/* only start drawing immediately if we're allowed to do so... */
if (RNA_boolean_get(op->ptr, "wait_for_input") == false) {
@@ -3749,6 +3772,7 @@ static int gpencil_draw_modal(bContext *C, wmOperator *op, const wmEvent *event)
else {
/* update status indicators - cursor, header, etc. */
gpencil_draw_status_indicators(C, p);
+ gpencil_draw_cursor_set(p); /* cursor may have changed outside our control - T44084 */
}
/* process last operations before exiting */
diff --git a/source/blender/makesrna/intern/rna_wm_api.c b/source/blender/makesrna/intern/rna_wm_api.c
index 3748a2fdbb6..1fea87df10c 100644
--- a/source/blender/makesrna/intern/rna_wm_api.c
+++ b/source/blender/makesrna/intern/rna_wm_api.c
@@ -59,7 +59,6 @@ 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 905569d6da2..cd140eba55a 100644
--- a/source/blender/windowmanager/intern/wm_cursors.c
+++ b/source/blender/windowmanager/intern/wm_cursors.c
@@ -1546,65 +1546,5 @@ 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,
- /* can invert color */
- true,
- };
-
- 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 6192b7c228e..6793937c413 100644
--- a/source/blender/windowmanager/wm_cursors.h
+++ b/source/blender/windowmanager/wm_cursors.h
@@ -91,7 +91,6 @@ enum {
BC_E_ARROWCURSOR,
BC_W_ARROWCURSOR,
BC_STOPCURSOR,
- BC_PAINTCROSSCURSOR,
/* --- ALWAYS LAST ----- */
BC_NUMCURSORS,
};