[Bf-blender-cvs] [5b8b99cf8a3] sculpt-dev: sculpt-dev: Fix stroke id error in smooth code

Joseph Eagar noreply at git.blender.org
Sun Oct 23 01:27:51 CEST 2022


Commit: 5b8b99cf8a3ce5df591ab02b2a2e2a24cd288d8c
Author: Joseph Eagar
Date:   Sat Oct 22 16:26:54 2022 -0700
Branches: sculpt-dev
https://developer.blender.org/rB5b8b99cf8a3ce5df591ab02b2a2e2a24cd288d8c

sculpt-dev: Fix stroke id error in smooth code

Also dialed up quality of roll mapping distance to
curve function to fix a few artifacts.

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

M	source/blender/blenlib/BLI_arc_spline.hh
M	source/blender/editors/sculpt_paint/sculpt_intern.h
M	source/blender/editors/sculpt_paint/sculpt_smooth.c

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

diff --git a/source/blender/blenlib/BLI_arc_spline.hh b/source/blender/blenlib/BLI_arc_spline.hh
index 9c7078a4970..00cdc5be8e1 100644
--- a/source/blender/blenlib/BLI_arc_spline.hh
+++ b/source/blender/blenlib/BLI_arc_spline.hh
@@ -592,7 +592,7 @@ template<typename Float, int axes = 2> class BezierSpline {
       return Vector();
     }
 
-    const int steps = 5;
+    const int steps = 12;
     Float s = 0.0, ds = length / steps;
     Float mindis = FLT_MAX;
     Vector minp;
diff --git a/source/blender/editors/sculpt_paint/sculpt_intern.h b/source/blender/editors/sculpt_paint/sculpt_intern.h
index da78153dfd3..e532e26d210 100644
--- a/source/blender/editors/sculpt_paint/sculpt_intern.h
+++ b/source/blender/editors/sculpt_paint/sculpt_intern.h
@@ -2546,6 +2546,7 @@ typedef enum StrokeIDUser {
   STROKEID_USER_BOUNDARY = 1 << 1,
   STROKEID_USER_SCULPTVERT = 1 << 2,
   STROKEID_USER_PREV_COLOR = 1 << 3,
+  STROKEID_USER_SMOOTH = 1 << 4,
 } StrokeIDUser;
 
 BLI_INLINE bool SCULPT_stroke_id_test(SculptSession *ss, PBVHVertRef vertex, StrokeIDUser user)
diff --git a/source/blender/editors/sculpt_paint/sculpt_smooth.c b/source/blender/editors/sculpt_paint/sculpt_smooth.c
index 1a90cb9e8cb..c2158a083ef 100644
--- a/source/blender/editors/sculpt_paint/sculpt_smooth.c
+++ b/source/blender/editors/sculpt_paint/sculpt_smooth.c
@@ -1530,10 +1530,8 @@ static void do_enhance_details_brush_dir_task_cb_ex(void *__restrict userdata,
   SculptBrushTestFn sculpt_brush_test_sq_fn = SCULPT_brush_test_init(
       ss, &test, data->brush->falloff_shape);
 
-  SculptAttribute *strokeid_scl = data->scl2;
   SculptAttribute *scl = data->scl;
 
-  const uint current_stroke_id = (uint)ss->stroke_id;
   bool modified = false;
 
   BKE_pbvh_vertex_iter_begin (ss->pbvh, data->nodes[n], vd, PBVH_ITER_UNIQUE) {
@@ -1541,10 +1539,8 @@ static void do_enhance_details_brush_dir_task_cb_ex(void *__restrict userdata,
       continue;
     }
 
-    uint *strokeid = SCULPT_vertex_attr_get(vd.vertex, strokeid_scl);
 
-    if ((*strokeid) >> 1UL != current_stroke_id) {
-      *strokeid = current_stroke_id << 1UL;
+    if (SCULPT_stroke_id_test(ss, vd.vertex, STROKEID_USER_SMOOTH)) {
       modified = true;
 
       float avg[3];
@@ -1588,8 +1584,6 @@ static void do_enhance_details_brush_dir2_task_cb_ex(void *__restrict userdata,
   SculptAttribute *scl = data->scl;
   bool use_area_weights = data->use_area_cos;
 
-  // const uint current_stroke_id = (uint)ss->stroke_id;
-
   int lastvalence = 8;
   float *areas = MEM_malloc_arrayN(lastvalence, sizeof(float), __func__);
 
@@ -1610,8 +1604,6 @@ static void do_enhance_details_brush_dir2_task_cb_ex(void *__restrict userdata,
       BKE_pbvh_get_vert_face_areas(ss->pbvh, vd.vertex, areas, valence);
     }
 
-    // uint *strokeid = SCULPT_vertex_attr_get(vd.vertex, strokeid_scl);
-
     /* this check here is overly restrictive,
        we already get filtered by whether stage
        1 did anything */
@@ -1778,8 +1770,7 @@ void SCULPT_enhance_details_brush(
                                  .cd_temp = 0,
                                  .cd_temp2 = 0,
                                  .nodes = nodes,
-                                 .scl = scl,
-                                 .scl2 = strokeid_scl};
+                                 .scl = scl};
 
   TaskParallelSettings settings;
   BKE_pbvh_parallel_range_settings(&settings, true, totnode);



More information about the Bf-blender-cvs mailing list