From f881ff129f785ed9491be04bc3dad6645903ddaa Mon Sep 17 00:00:00 2001 From: Pablo Dobarro Date: Mon, 6 Apr 2020 19:35:42 +0200 Subject: Fix Shift-Smooth mode using wrong parameters When using the shift-smooth mode, sculpt_update_cache_invariants is changing the brush datablock of the paint session if it finds a brush named "Smooth" (which is a huge hack the brush management project should try to solve). This is done after the PaintStroke data in the modal operator is created, which holds a reference to the active brush in the paint session that was active when the operator started. Because of this, the StrokeCache was getting the correct smooth brush values but the paint modal operator was applying the wrong ones from the previous brush. This was causing the smooth brush behaves unpredictably depending on the current active brush. This patch updates the brush in PaintStroke on each modal callback, so it always gets the values from the current active brush in the Paint Session. The way brush switching works and a way to make it more flexible needs to be discussed in the future as part of the brush management project. The default smooth brush parameters and curves will probably need to be updated after this change, as previously they were set using an incorrect behavior. Reviewed By: jbakker Differential Revision: https://developer.blender.org/D7354 --- source/blender/editors/sculpt_paint/paint_stroke.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source/blender/editors/sculpt_paint') diff --git a/source/blender/editors/sculpt_paint/paint_stroke.c b/source/blender/editors/sculpt_paint/paint_stroke.c index e7bc75be45d..7887aaaf658 100644 --- a/source/blender/editors/sculpt_paint/paint_stroke.c +++ b/source/blender/editors/sculpt_paint/paint_stroke.c @@ -1340,7 +1340,7 @@ int paint_stroke_modal(bContext *C, wmOperator *op, const wmEvent *event) Paint *p = BKE_paint_get_active_from_context(C); ePaintMode mode = BKE_paintmode_get_active_from_context(C); PaintStroke *stroke = op->customdata; - Brush *br = stroke->brush; + Brush *br = stroke->brush = BKE_paint_brush(p); PaintSample sample_average; float mouse[2]; bool first_dab = false; -- cgit v1.2.3