diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-10-25 08:06:47 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-10-25 08:06:47 +0300 |
commit | 6d49b623e2efce59b58bb1295024ab8ac492370a (patch) | |
tree | ebe29d04b2e9730dfb4f7cd733e63e2676794dfc /source/blender/editors/sculpt_paint | |
parent | 46587b3ccb0ec842500ce2c3f2359b78550aad0f (diff) |
WM: space, region type filtering for paint cursor
Avoids calling poll on mouse-move for unrelated space/region types.
Diffstat (limited to 'source/blender/editors/sculpt_paint')
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_cursor.c | 21 | ||||
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_image.c | 6 | ||||
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_stroke.c | 12 | ||||
-rw-r--r-- | source/blender/editors/sculpt_paint/sculpt_uv.c | 4 |
4 files changed, 33 insertions, 10 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_cursor.c b/source/blender/editors/sculpt_paint/paint_cursor.c index 7d94e63e2bc..294981e7303 100644 --- a/source/blender/editors/sculpt_paint/paint_cursor.c +++ b/source/blender/editors/sculpt_paint/paint_cursor.c @@ -41,6 +41,7 @@ #include "DNA_object_types.h" #include "DNA_scene_types.h" #include "DNA_screen_types.h" +#include "DNA_space_types.h" #include "DNA_userdef_types.h" #include "DNA_view3d_types.h" @@ -1153,8 +1154,14 @@ void paint_cursor_start(bContext *C, bool (*poll)(bContext *C)) { Paint *p = BKE_paint_get_active_from_context(C); - if (p && !p->paint_cursor) - p->paint_cursor = WM_paint_cursor_activate(CTX_wm_manager(C), poll, paint_draw_cursor, NULL); + if (p && !p->paint_cursor) { + p->paint_cursor = WM_paint_cursor_activate( + CTX_wm_manager(C), + SPACE_TYPE_ANY, RGN_TYPE_ANY, + poll, + paint_draw_cursor, + NULL); + } /* invalidate the paint cursors */ BKE_paint_invalidate_overlay_all(); @@ -1162,6 +1169,12 @@ void paint_cursor_start(bContext *C, bool (*poll)(bContext *C)) void paint_cursor_start_explicit(Paint *p, wmWindowManager *wm, bool (*poll)(bContext *C)) { - if (p && !p->paint_cursor) - p->paint_cursor = WM_paint_cursor_activate(wm, poll, paint_draw_cursor, NULL); + if (p && !p->paint_cursor) { + p->paint_cursor = WM_paint_cursor_activate( + wm, + SPACE_TYPE_ANY, RGN_TYPE_ANY, + poll, + paint_draw_cursor, + NULL); + } } diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c index 897a74eb497..aaf82d8ef2b 100644 --- a/source/blender/editors/sculpt_paint/paint_image.c +++ b/source/blender/editors/sculpt_paint/paint_image.c @@ -485,7 +485,11 @@ static PaintOperation *texture_paint_init(bContext *C, wmOperator *op, const flo } if ((brush->imagepaint_tool == PAINT_TOOL_FILL) && (brush->flag & BRUSH_USE_GRADIENT)) { - pop->cursor = WM_paint_cursor_activate(CTX_wm_manager(C), image_paint_poll, gradient_draw_line, pop); + pop->cursor = WM_paint_cursor_activate( + CTX_wm_manager(C), + SPACE_TYPE_ANY, RGN_TYPE_ANY, + image_paint_poll, gradient_draw_line, + pop); } settings->imapaint.flag |= IMAGEPAINT_DRAWING; diff --git a/source/blender/editors/sculpt_paint/paint_stroke.c b/source/blender/editors/sculpt_paint/paint_stroke.c index af27ad5d307..a1ae32f2e9a 100644 --- a/source/blender/editors/sculpt_paint/paint_stroke.c +++ b/source/blender/editors/sculpt_paint/paint_stroke.c @@ -1201,8 +1201,10 @@ int paint_stroke_modal(bContext *C, wmOperator *op, const wmEvent *event) return OPERATOR_FINISHED; if (paint_supports_smooth_stroke(br, mode)) - stroke->stroke_cursor = - WM_paint_cursor_activate(CTX_wm_manager(C), paint_poll, paint_draw_smooth_cursor, stroke); + stroke->stroke_cursor = WM_paint_cursor_activate( + CTX_wm_manager(C), + SPACE_TYPE_ANY, RGN_TYPE_ANY, + paint_poll, paint_draw_smooth_cursor, stroke); stroke->stroke_init = true; first_modal = true; @@ -1220,8 +1222,10 @@ int paint_stroke_modal(bContext *C, wmOperator *op, const wmEvent *event) stroke->timer = WM_event_add_timer(CTX_wm_manager(C), CTX_wm_window(C), TIMER, stroke->brush->rate); if (br->flag & BRUSH_LINE) { - stroke->stroke_cursor = - WM_paint_cursor_activate(CTX_wm_manager(C), paint_poll, paint_draw_line_cursor, stroke); + stroke->stroke_cursor = WM_paint_cursor_activate( + CTX_wm_manager(C), + SPACE_TYPE_ANY, RGN_TYPE_ANY, + paint_poll, paint_draw_line_cursor, stroke); } first_dab = true; diff --git a/source/blender/editors/sculpt_paint/sculpt_uv.c b/source/blender/editors/sculpt_paint/sculpt_uv.c index 8fafc545fa9..897539bddd7 100644 --- a/source/blender/editors/sculpt_paint/sculpt_uv.c +++ b/source/blender/editors/sculpt_paint/sculpt_uv.c @@ -248,7 +248,9 @@ void ED_space_image_uv_sculpt_update(Main *bmain, wmWindowManager *wm, Scene *sc BKE_paint_init(bmain, scene, ePaintSculptUV, PAINT_CURSOR_SCULPT); settings->uvsculpt->paint.paint_cursor = WM_paint_cursor_activate( - wm, uv_sculpt_brush_poll, + wm, + SPACE_IMAGE, RGN_TYPE_WINDOW, + uv_sculpt_brush_poll, brush_drawcursor_uvsculpt, NULL); } else { |