[Bf-blender-cvs] [8e02b53ae75] master: Sculpt: Fix zeroing of last position on stroke start

Joseph Eagar noreply at git.blender.org
Fri Jun 3 19:41:15 CEST 2022


Commit: 8e02b53ae755742c6c2192e4def58be55deb1f98
Author: Joseph Eagar
Date:   Fri Jun 3 10:35:41 2022 -0700
Branches: master
https://developer.blender.org/rB8e02b53ae755742c6c2192e4def58be55deb1f98

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.

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

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 210cffcbcda..c3c69bf4e0a 100644
--- a/source/blender/editors/sculpt_paint/paint_stroke.c
+++ b/source/blender/editors/sculpt_paint/paint_stroke.c
@@ -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);



More information about the Bf-blender-cvs mailing list