[Bf-blender-cvs] [881df30a46f] temp_bmesh_multires: Cavity masking now has a checkbox in the UI, instead of simply turning itself on if the concave mask factor is > 0.

Joseph Eagar noreply at git.blender.org
Thu Apr 8 07:50:16 CEST 2021


Commit: 881df30a46ff87dd9509fac76963c3e704a6373c
Author: Joseph Eagar
Date:   Wed Apr 7 22:49:39 2021 -0700
Branches: temp_bmesh_multires
https://developer.blender.org/rB881df30a46ff87dd9509fac76963c3e704a6373c

Cavity masking now has a checkbox in the UI, instead of simply turning
itself on if the concave mask factor is > 0.

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

M	release/scripts/startup/bl_ui/properties_paint_common.py
M	source/blender/editors/sculpt_paint/sculpt_automasking.c
M	source/blender/makesdna/DNA_brush_defaults.h
M	source/blender/makesrna/intern/rna_brush.c

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

diff --git a/release/scripts/startup/bl_ui/properties_paint_common.py b/release/scripts/startup/bl_ui/properties_paint_common.py
index 983f9ae9121..6285793e815 100644
--- a/release/scripts/startup/bl_ui/properties_paint_common.py
+++ b/release/scripts/startup/bl_ui/properties_paint_common.py
@@ -926,8 +926,13 @@ def brush_settings_advanced(layout, context, brush, popover=False):
         # topology automasking
         col.prop(brush, "use_automasking_topology", text="Topology")
 
-        col.prop(brush, "concave_mask_factor", text="Cavity Factor");
-        col.prop(brush, "invert_automasking_concavity", text="Invert Cavity Mask");
+        col.prop(brush, "use_automasking_concave")
+
+        col2 = col.column()
+        col2.enabled = brush.use_automasking_concave
+
+        col2.prop(brush, "concave_mask_factor", text="Cavity Factor");
+        col2.prop(brush, "invert_automasking_concavity", text="Invert Cavity Mask");
 
         # face masks automasking
         col.prop(brush, "use_automasking_face_sets", text="Face Sets")
diff --git a/source/blender/editors/sculpt_paint/sculpt_automasking.c b/source/blender/editors/sculpt_paint/sculpt_automasking.c
index 6427d6eeb4f..4dbf03eaef7 100644
--- a/source/blender/editors/sculpt_paint/sculpt_automasking.c
+++ b/source/blender/editors/sculpt_paint/sculpt_automasking.c
@@ -145,7 +145,7 @@ float SCULPT_automasking_factor_get(AutomaskingCache *automasking,
     return mask;
   }
 
-  do_concave = ss->cache->brush->concave_mask_factor > 0.0f ||
+  do_concave = ss->cache->brush->concave_mask_factor > 0.0f &&
                (automasking->settings.flags & BRUSH_AUTOMASKING_CONCAVITY);
 
   /* If the cache is initialized with valid info, use the cache. This is used when the
@@ -373,10 +373,6 @@ static void SCULPT_automasking_cache_settings_update(AutomaskingCache *automaski
 {
   automasking->settings.flags = sculpt_automasking_mode_effective_bits(sd, brush);
 
-  if (brush->concave_mask_factor != 0.0f) {
-    automasking->settings.flags |= BRUSH_AUTOMASKING_CONCAVITY;
-  }
-
   automasking->settings.initial_face_set = SCULPT_active_face_set_get(ss);
   automasking->settings.concave_factor = brush->concave_mask_factor;
 }
diff --git a/source/blender/makesdna/DNA_brush_defaults.h b/source/blender/makesdna/DNA_brush_defaults.h
index 5f2d1fefae3..bb986cba79d 100644
--- a/source/blender/makesdna/DNA_brush_defaults.h
+++ b/source/blender/makesdna/DNA_brush_defaults.h
@@ -111,7 +111,8 @@
  \
     .mtex = _DNA_DEFAULT_MTex, \
     .mask_mtex = _DNA_DEFAULT_MTex, \
-    .dyntopo = {0.4f, 25.0f, 3.0f, DYNTOPO_COLLAPSE|DYNTOPO_SUBDIVIDE, DYNTOPO_DETAIL_RELATIVE, DYNTOPO_INHERIT_ALL, 25}\
+    .dyntopo = {0.4f, 25.0f, 3.0f, DYNTOPO_COLLAPSE|DYNTOPO_SUBDIVIDE, DYNTOPO_DETAIL_RELATIVE, DYNTOPO_INHERIT_ALL, 25},\
+    .concave_mask_factor = 0.75f\
   }
 
 /** \} */
diff --git a/source/blender/makesrna/intern/rna_brush.c b/source/blender/makesrna/intern/rna_brush.c
index 91d213c4210..8f16fb0c5f1 100644
--- a/source/blender/makesrna/intern/rna_brush.c
+++ b/source/blender/makesrna/intern/rna_brush.c
@@ -2941,7 +2941,6 @@ static void rna_def_brush(BlenderRNA *brna)
 
   prop = RNA_def_property(srna, "concave_mask_factor", PROP_FLOAT, PROP_FACTOR);
   RNA_def_property_float_sdna(prop, NULL, "concave_mask_factor");
-  RNA_def_property_float_default(prop, 0);
   RNA_def_property_range(prop, 0.0f, 1.0f);
   RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.001, 3);
   RNA_def_property_ui_text(
@@ -3115,6 +3114,13 @@ static void rna_def_brush(BlenderRNA *brna)
                            "Invert mask to expose convex instead of concave areas");
   RNA_def_property_update(prop, 0, "rna_Brush_update");
 
+  prop = RNA_def_property(srna, "use_automasking_concave", PROP_BOOLEAN, PROP_NONE);
+  RNA_def_property_boolean_sdna(prop, NULL, "automasking_flags", BRUSH_AUTOMASKING_CONCAVITY);
+  RNA_def_property_ui_text(prop,
+                           "Cavity Auto-Masking",
+                           "Filter verts by concavity; use with paint brushes");
+  RNA_def_property_update(prop, 0, "rna_Brush_update");
+
   prop = RNA_def_property(srna, "use_automasking_topology", PROP_BOOLEAN, PROP_NONE);
   RNA_def_property_boolean_sdna(prop, NULL, "automasking_flags", BRUSH_AUTOMASKING_TOPOLOGY);
   RNA_def_property_ui_text(prop,



More information about the Bf-blender-cvs mailing list