diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2019-09-29 00:32:51 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2019-09-29 16:04:10 +0300 |
commit | c31a849a1474ef1d96805b67ad12c9be2173e003 (patch) | |
tree | cb93ca48d866bde34755ed282dfaf7bf9caefb2d /source/blender/editors/sculpt_paint/paint_stroke.c | |
parent | ba90d2efa58fe23a87f98e014bcc02ea951a6a49 (diff) |
Fix wrong sculpt cursor drawing when using "ignore_background_click"
Not all the necessary state got restored.
Diffstat (limited to 'source/blender/editors/sculpt_paint/paint_stroke.c')
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_stroke.c | 45 |
1 files changed, 24 insertions, 21 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_stroke.c b/source/blender/editors/sculpt_paint/paint_stroke.c index 51296fa5d44..137d7bd9d6c 100644 --- a/source/blender/editors/sculpt_paint/paint_stroke.c +++ b/source/blender/editors/sculpt_paint/paint_stroke.c @@ -901,20 +901,37 @@ PaintStroke *paint_stroke_new(bContext *C, return stroke; } -void paint_stroke_data_free(struct wmOperator *op) +void paint_stroke_free(bContext *C, wmOperator *op) { + PaintStroke *stroke = op->customdata; + UnifiedPaintSettings *ups = stroke->ups; + + ups->draw_anchored = false; + ups->stroke_active = false; + + if (stroke->timer) { + WM_event_remove_timer(CTX_wm_manager(C), CTX_wm_window(C), stroke->timer); + } + + if (stroke->rng) { + BLI_rng_free(stroke->rng); + } + + if (stroke->stroke_cursor) { + WM_paint_cursor_end(CTX_wm_manager(C), stroke->stroke_cursor); + } + + BLI_freelistN(&stroke->line); + BKE_paint_set_overlay_override(0); MEM_SAFE_FREE(op->customdata); } -static void stroke_done(struct bContext *C, struct wmOperator *op) +static void stroke_done(bContext *C, wmOperator *op) { - struct PaintStroke *stroke = op->customdata; + PaintStroke *stroke = op->customdata; UnifiedPaintSettings *ups = stroke->ups; - ups->draw_anchored = false; - ups->stroke_active = false; - /* reset rotation here to avoid doing so in cursor display */ if (!(stroke->brush->mtex.brush_angle_mode & MTEX_ANGLE_RAKE)) { ups->brush_rotation = 0.0f; @@ -934,21 +951,7 @@ static void stroke_done(struct bContext *C, struct wmOperator *op) } } - if (stroke->timer) { - WM_event_remove_timer(CTX_wm_manager(C), CTX_wm_window(C), stroke->timer); - } - - if (stroke->rng) { - BLI_rng_free(stroke->rng); - } - - if (stroke->stroke_cursor) { - WM_paint_cursor_end(CTX_wm_manager(C), stroke->stroke_cursor); - } - - BLI_freelistN(&stroke->line); - - paint_stroke_data_free(op); + paint_stroke_free(C, op); } /* Returns zero if the stroke dots should not be spaced, non-zero otherwise */ |