[Bf-blender-cvs] [0e2ec88e6ba] sculpt-dev: Tweak more brush channel settings

Joseph Eagar noreply at git.blender.org
Wed Sep 22 12:31:58 CEST 2021


Commit: 0e2ec88e6ba73dce264d4e0e25228e45aceda41d
Author: Joseph Eagar
Date:   Wed Sep 22 03:31:34 2021 -0700
Branches: sculpt-dev
https://developer.blender.org/rB0e2ec88e6ba73dce264d4e0e25228e45aceda41d

Tweak more brush channel settings

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

M	release/scripts/startup/bl_ui/properties_paint_common.py
M	source/blender/blenkernel/intern/brush_channel_define.h
M	source/blender/editors/sculpt_paint/sculpt_boundary.c
M	source/blender/editors/sculpt_paint/sculpt_filter_mesh.c
M	source/blender/editors/sculpt_paint/sculpt_intern.h
M	source/blender/editors/sculpt_paint/sculpt_smooth.c

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

diff --git a/release/scripts/startup/bl_ui/properties_paint_common.py b/release/scripts/startup/bl_ui/properties_paint_common.py
index 51356824491..3a7e9382046 100644
--- a/release/scripts/startup/bl_ui/properties_paint_common.py
+++ b/release/scripts/startup/bl_ui/properties_paint_common.py
@@ -1026,21 +1026,39 @@ def brush_settings(layout, context, brush, popover=False):
 
         elif sculpt_tool == 'SMOOTH':
             col = layout.column()
-            col.prop(brush, "boundary_smooth_factor")
+            UnifiedPaintPanel.channel_unified(
+                layout,
+                context,
+                brush,
+                "boundary_smooth",
+                slider = True
+                #text="Weight By Face Area",
+            )
 
             UnifiedPaintPanel.channel_unified(
                 layout,
                 context,
                 brush,
-                "use_weighted_smooth",
+                "use_weighted_smooth"
                 #text="Weight By Face Area",
-                slider=True,
+            )
+            UnifiedPaintPanel.channel_unified(
+                layout,
+                context,
+                brush,
+                "preserve_faceset_boundary"
             )
 
             #col.prop(brush, "use_weighted_smooth")
-            col.prop(brush, "preserve_faceset_boundary")
-            if brush.preserve_faceset_boundary:
-                col.prop(brush, "autosmooth_fset_slide")
+            #col.prop(brush, "preserve_faceset_boundary")
+
+            if brush.channels.channels["preserve_faceset_boundary"].bool_value:
+                UnifiedPaintPanel.channel_unified(
+                    layout,
+                    context,
+                    brush,
+                    "fset_slide"
+                )
 
             col.prop(brush, "smooth_deform_type")
 
diff --git a/source/blender/blenkernel/intern/brush_channel_define.h b/source/blender/blenkernel/intern/brush_channel_define.h
index c1d27e29593..0cb606c4f00 100644
--- a/source/blender/blenkernel/intern/brush_channel_define.h
+++ b/source/blender/blenkernel/intern/brush_channel_define.h
@@ -100,7 +100,7 @@
   MAKE_FLOAT_EX(autosmooth_projection, "Projection", "Amount of volume preserving projection", 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, false)
   MAKE_FLOAT_EX(topology_rake_projection, "Projection", "Amount of volume preserving projection", 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, false)
   MAKE_FLOAT(fset_slide, "Face Set Projection", "Stick face set boundaries to surface of mesh", 1.0f, 0.0f, 1.0f)
-  MAKE_FLOAT(boundary_smooth, "Boundary Smooth", "Smooth hard boundaries", 1.0f, 0.0f, 1.0f)
+  MAKE_FLOAT(boundary_smooth, "Boundary Smooth", "Smooth hard boundaries", 0.0f, 0.0f, 1.0f)
   MAKE_BOOL(topology_rake_use_spacing, "Use Spacing", "Use custom spacing for topology rake", false)
   MAKE_BOOL(autosmooth_use_spacing, "Use Spacing", "Use custom spacing for autosmooth", false)
   MAKE_FLOAT_EX(topology_rake_spacing, "Spacing", "Topology rake stroke spacing", 13.0f, 0.05f, 1000.0f, 0.1f, 300.0f, false)
@@ -165,7 +165,7 @@ MAKE_FLOAT_EX(plane_offset, "Plane Offset", "Adjust plane on which the brush act
 MAKE_BOOL(original_normal, "Original Normal", "When locked keep using normal of surface where stroke was initiated", false)
 MAKE_BOOL(original_plane, "Original Plane", "When locked keep using the plane origin of surface where stroke was initiated", false)
 MAKE_BOOL(use_weighted_smooth, "Weight By Area", "Weight by face area to get a smoother result", true)
-MAKE_BOOL(preserve_faceset_boundary, "Keep FSet Boundary", "Preserve face set boundaries", true)
+MAKE_BOOL(preserve_faceset_boundary, "Preserve Faceset Boundary", "Preserve face set boundaries", true)
 MAKE_BOOL(hard_edge_mode, "Hard Edge Mode", "Forces all brushes into hard edge face set mode (sets face set slide to 0)", false)
 MAKE_BOOL(grab_silhouette, "Grab Silhouette", "Grabs trying to automask the silhouette of the object", false)
 MAKE_FLOAT(dyntopo_detail_percent, "Detail Percent", "Detail Percent", 25.0f, 0.0f, 1000.0f)
diff --git a/source/blender/editors/sculpt_paint/sculpt_boundary.c b/source/blender/editors/sculpt_paint/sculpt_boundary.c
index 08efea97c3b..1a85b6a6f36 100644
--- a/source/blender/editors/sculpt_paint/sculpt_boundary.c
+++ b/source/blender/editors/sculpt_paint/sculpt_boundary.c
@@ -1978,7 +1978,7 @@ static void SCULPT_boundary_autosmooth(SculptSession *ss, SculptBoundary *bounda
 
   const int max_iterations = 4;
   const float fract = 1.0f / max_iterations;
-  float bstrength = ss->cache->brush->autosmooth_factor;
+  float bstrength = SCULPT_get_float(ss, autosmooth, NULL, ss->cache->brush);
 
   CLAMP(bstrength, 0.0f, 1.0f);
 
@@ -1986,12 +1986,17 @@ static void SCULPT_boundary_autosmooth(SculptSession *ss, SculptBoundary *bounda
   const float last = max_iterations * (bstrength - count * fract);
 
   const float boundary_radius = ss->cache->radius * (1.0f + ss->cache->brush->boundary_offset) *
-                                ss->cache->brush->autosmooth_radius_factor;
+                                SCULPT_get_float(
+                                    ss, autosmooth_radius_scale, NULL, ss->cache->brush);
 
   BKE_curvemapping_init(ss->cache->brush->curve);
 
   BKE_pbvh_get_nodes(ss->pbvh, PBVH_Leaf, &nodes, &totnode);
 
+  float bound_smooth = SCULPT_get_float(ss, boundary_smooth, NULL, ss->cache->brush);
+  float projection = SCULPT_get_float(ss, autosmooth_projection, NULL, ss->cache->brush);
+  float slide_fset = SCULPT_get_float(ss, fset_slide, NULL, ss->cache->brush);
+
   for (int iteration = 0; iteration <= count; iteration++) {
     for (int i = 0; i < totnode; i++) {
       const float strength = (iteration != count) ? 1.0f : last;
@@ -2019,7 +2024,7 @@ static void SCULPT_boundary_autosmooth(SculptSession *ss, SculptBoundary *bounda
         float sco[3];
 
         SCULPT_neighbor_coords_average_interior(
-            ss, sco, vd.vertex, ss->cache->brush->autosmooth_projection, NULL, false);
+            ss, sco, vd.vertex, projection, slide_fset, bound_smooth, NULL, false);
 
         float *co = SCULPT_brush_deform_target_vertex_co_get(
             ss, ss->cache->brush->deform_target, &vd);
@@ -2042,7 +2047,9 @@ static void SCULPT_boundary_build_smoothco(SculptSession *ss, SculptBoundary *bo
 
   boundary->smoothco = MEM_calloc_arrayN(totvert, sizeof(float) * 3, "boundary->smoothco");
 
-  const float projection = 0.5f;
+  float bound_smooth = SCULPT_get_float(ss, boundary_smooth, NULL, ss->cache->brush);
+  float projection = SCULPT_get_float(ss, autosmooth_projection, NULL, ss->cache->brush);
+  float slide_fset = SCULPT_get_float(ss, fset_slide, NULL, ss->cache->brush);
 
   BKE_pbvh_get_nodes(ss->pbvh, PBVH_Leaf, &nodes, &totnode);
 
@@ -2058,7 +2065,8 @@ static void SCULPT_boundary_build_smoothco(SculptSession *ss, SculptBoundary *bo
 
         float sco[3];
 
-        SCULPT_neighbor_coords_average_interior(ss, sco, vd.vertex, projection, NULL, false);
+        SCULPT_neighbor_coords_average_interior(
+            ss, sco, vd.vertex, projection, slide_fset, bound_smooth, NULL, false);
 
         float *co = SCULPT_brush_deform_target_vertex_co_get(
             ss, ss->cache->brush->deform_target, &vd);
diff --git a/source/blender/editors/sculpt_paint/sculpt_filter_mesh.c b/source/blender/editors/sculpt_paint/sculpt_filter_mesh.c
index 3248da83f73..29cc8266bfb 100644
--- a/source/blender/editors/sculpt_paint/sculpt_filter_mesh.c
+++ b/source/blender/editors/sculpt_paint/sculpt_filter_mesh.c
@@ -363,13 +363,17 @@ static void mesh_filter_task_cb(void *__restrict userdata,
     }
 
     switch (filter_type) {
-      case MESH_FILTER_SMOOTH:
+      case MESH_FILTER_SMOOTH: {
+        // float bound_smooth = SCULPT_get_float(ss, boundary_smooth, ss->, ss->cache->brush);
+        // float projection = SCULPT_get_float(ss, autosmooth_projection, NULL, ss->cache->brush);
+        // float slide_fset = SCULPT_get_float(ss, fset_slide, NULL, ss->cache->brush);
+
         fade = clamp_f(fade, -1.0f, 1.0f);
-        SCULPT_neighbor_coords_average_interior(ss, avg, vd.vertex, 0.0f, NULL, false);
+        SCULPT_neighbor_coords_average_interior(ss, avg, vd.vertex, 0.0f, 1.0f, 0.0f, NULL, false);
         sub_v3_v3v3(val, avg, orig_co);
         madd_v3_v3v3fl(val, orig_co, val, fade);
         sub_v3_v3v3(disp, val, orig_co);
-        break;
+      } break;
       case MESH_FILTER_INFLATE:
         normal_short_to_float_v3(normal, orig_data.no);
         mul_v3_v3fl(disp, normal, fade);
diff --git a/source/blender/editors/sculpt_paint/sculpt_intern.h b/source/blender/editors/sculpt_paint/sculpt_intern.h
index 3512c35e2e3..202a822916c 100644
--- a/source/blender/editors/sculpt_paint/sculpt_intern.h
+++ b/source/blender/editors/sculpt_paint/sculpt_intern.h
@@ -701,8 +701,10 @@ void SCULPT_neighbor_color_average(SculptSession *ss, float result[4], SculptVer
 /* Mask the mesh boundaries smoothing only the mesh surface without using automasking. */
 void SCULPT_neighbor_coords_average_interior(SculptSession *ss,
                                              float result[3],
-                                             SculptVertRef index,
+                                             SculptVertRef vertex,
                                              float projection,
+                                             float slide_fset,
+                                             float bound_smooth,
                                              SculptCustomLayer *bound_scl,
                                              bool do_origco);
 
@@ -991,6 +993,8 @@ typedef struct SculptThreadedTaskData {
   SculptCustomLayer *scl, *scl2;
   bool do_origco;
   float *brush_color;
+
+  float fset_slide, bound_smooth;
 } SculptThreadedTaskData;
 
 /*************** Brush testing declarations ****************/
diff --git a/source/blender/editors/sculpt_paint/sculpt_smooth.c b/source/blender/editors/sculpt_paint/sculpt_smooth.c
index 03eacb6e646..8f1fced69cc 100644
--- a/source/blender/editors/sculpt_paint/sculpt_smooth.c
+++ b/source/blender/editors/sculpt_paint/sculpt_smooth.c
@@ -74,12 +74,14 @@
 #include <math.h>
 #include <stdlib.h>
 
-void SCULPT_neighbor_coords_average_in

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list