UI: In paint modes, don't overwrite a modal cursor with the paint cursor

In all paint and sculpt modes, it was practically impossible for modal
operators to set a modal cursor, because the cursor was immediately
overwritten by the paint cursor. In this patch the paint cursor function
checks for a modal cursor first. When a modal cursor exists, it isn't
overwritten by the paint cursor.

Pull Request: https://projects.blender.org/blender/blender/pulls/137893
This commit is contained in:
Sietse Brouwer
2025-04-29 22:33:49 +02:00
committed by Harley Acheson
parent 8c2888d578
commit 06624bbafb

View File

@@ -1454,9 +1454,10 @@ static void paint_cursor_sculpt_session_update_and_init(PaintCursorContext &pcon
static void paint_update_mouse_cursor(PaintCursorContext &pcontext)
{
if (pcontext.win->grabcursor != 0) {
if (pcontext.win->grabcursor != 0 || pcontext.win->modalcursor != 0) {
/* Don't set the cursor while it's grabbed, since this will show the cursor when interacting
* with the UI (dragging a number button for e.g.), see: #102792. */
* with the UI (dragging a number button for e.g.), see: #102792.
* And don't overwrite a modal cursor, allowing modal operators to set a cursor temporarily. */
return;
}
@@ -2160,8 +2161,9 @@ static void paint_draw_cursor(
if (!paint_cursor_is_brush_cursor_enabled(pcontext)) {
/* For Grease Pencil draw mode, we want to we only render a small mouse cursor (dot) if the
* paint cursor is disabled so that the default mouse cursor doesn't get in the way of tablet
* users. See #130089. */
if (pcontext.mode == PaintMode::GPencil) {
* users. See #130089. But don't overwrite a modal cursor, allowing modal operators to set one
* temporarily. */
if (pcontext.mode == PaintMode::GPencil && pcontext.win->modalcursor == 0) {
WM_cursor_set(pcontext.win, WM_CURSOR_DOT);
}
return;