Sculpt: Fix zeroing of last position on stroke start

Fixes bug where clicking in empty space resets
viewport pivot in rotate around active mode
to zero.
This commit is contained in:
Joseph Eagar 2022-06-03 10:35:41 -07:00
parent 2681e480ea
commit 8e02b53ae7
1 changed files with 7 additions and 2 deletions

View File

@ -912,8 +912,13 @@ PaintStroke *paint_stroke_new(bContext *C,
rv3d->rflag |= RV3D_PAINTING;
}
zero_v3(ups->average_stroke_accum);
ups->average_stroke_counter = 0;
/* Preserve location from last stroke while applying and resetting
* ups->average_stroke_counter to 1.
*/
if (ups->average_stroke_counter) {
mul_v3_fl(ups->average_stroke_accum, 1.0f / (float)ups->average_stroke_counter);
ups->average_stroke_counter = 1;
}
/* initialize here to avoid initialization conflict with threaded strokes */
BKE_curvemapping_init(br->curve);