[Bf-blender-cvs] [f881ff129f7] master: Fix Shift-Smooth mode using wrong parameters

Pablo Dobarro noreply at git.blender.org
Tue Apr 14 20:56:27 CEST 2020


Commit: f881ff129f785ed9491be04bc3dad6645903ddaa
Author: Pablo Dobarro
Date:   Mon Apr 6 19:35:42 2020 +0200
Branches: master
https://developer.blender.org/rBf881ff129f785ed9491be04bc3dad6645903ddaa

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

===================================================================

M	source/blender/editors/sculpt_paint/paint_stroke.c

===================================================================

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;



More information about the Bf-blender-cvs mailing list