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
This commit is contained in:
Pablo Dobarro 2020-04-06 19:35:42 +02:00
parent f12589d335
commit f881ff129f
1 changed files with 1 additions and 1 deletions

View File

@ -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;