[Bf-blender-cvs] [ba584f68194] sculpt-dev: Fix mask expand

Joseph Eagar noreply at git.blender.org
Thu Oct 7 15:17:10 CEST 2021


Commit: ba584f6819421a142ef7f56d1424c5faa4650728
Author: Joseph Eagar
Date:   Thu Oct 7 02:19:42 2021 -0700
Branches: sculpt-dev
https://developer.blender.org/rBba584f6819421a142ef7f56d1424c5faa4650728

Fix mask expand

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

M	release/datafiles/locale
M	release/scripts/addons
M	release/scripts/modules/rna_prop_ui.py
M	source/blender/editors/sculpt_paint/sculpt_expand.c
M	source/blender/editors/sculpt_paint/sculpt_mask_expand.c

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

diff --git a/release/datafiles/locale b/release/datafiles/locale
index 8ce0741c51a..3d01b77226f 160000
--- a/release/datafiles/locale
+++ b/release/datafiles/locale
@@ -1 +1 @@
-Subproject commit 8ce0741c51afec6a12b78c1ce21a7779e1f51c69
+Subproject commit 3d01b77226fcd99024ffaa0c12a6c14f22914d9f
diff --git a/release/scripts/addons b/release/scripts/addons
index eed6d6cc132..e45804a3bb7 160000
--- a/release/scripts/addons
+++ b/release/scripts/addons
@@ -1 +1 @@
-Subproject commit eed6d6cc132d194efe018996d43a36ebc8d91ad4
+Subproject commit e45804a3bb753006b6aeeef78327359fc724633c
diff --git a/release/scripts/modules/rna_prop_ui.py b/release/scripts/modules/rna_prop_ui.py
index 6d92c94a85c..ff7a78d1eba 100644
--- a/release/scripts/modules/rna_prop_ui.py
+++ b/release/scripts/modules/rna_prop_ui.py
@@ -89,6 +89,9 @@ def rna_idprop_ui_prop_default_set(item, prop, value):
     ui_data.update(default=value)
 
 
+def rna_idprop_ui_prop_get(item, prop, create=False):
+    return rna_idprop_ui_create(item, prop, 0.0)
+
 def rna_idprop_ui_create(
         item, prop, *, default,
         min=0.0, max=1.0,
diff --git a/source/blender/editors/sculpt_paint/sculpt_expand.c b/source/blender/editors/sculpt_paint/sculpt_expand.c
index 6c0be63d643..2aae45e893f 100644
--- a/source/blender/editors/sculpt_paint/sculpt_expand.c
+++ b/source/blender/editors/sculpt_paint/sculpt_expand.c
@@ -622,7 +622,9 @@ static float *sculpt_expand_spherical_falloff_create(Object *ob, const SculptVer
  * boundary to a falloff value of 0. Then, it propagates that falloff to the rest of the mesh so it
  * stays parallel to the boundary, increasing the falloff value by 1 on each step.
  */
-static float *sculpt_expand_boundary_topology_falloff_create(Sculpt *sd, Object *ob, const SculptVertRef v)
+static float *sculpt_expand_boundary_topology_falloff_create(Sculpt *sd,
+                                                             Object *ob,
+                                                             const SculptVertRef v)
 {
   SculptSession *ss = ob->sculpt;
   const int totvert = SCULPT_vertex_count_get(ss);
@@ -1407,9 +1409,8 @@ static void sculpt_expand_cancel(bContext *C, wmOperator *UNUSED(op))
 /**
  * Callback to update mask data per PBVH node.
  */
-static void sculpt_expand_mask_update_task_cb(void *__restrict userdata,
-                                              const int i,
-                                              const TaskParallelTLS *__restrict UNUSED(tls))
+ATTR_NO_OPT static void sculpt_expand_mask_update_task_cb(
+    void *__restrict userdata, const int i, const TaskParallelTLS *__restrict UNUSED(tls))
 {
   SculptThreadedTaskData *data = userdata;
   SculptSession *ss = data->ob->sculpt;
@@ -1433,7 +1434,12 @@ static void sculpt_expand_mask_update_task_cb(void *__restrict userdata,
     }
 
     if (expand_cache->preserve) {
-      new_mask = max_ff(new_mask, expand_cache->original_mask[vd.index]);
+      if (expand_cache->invert) {
+        new_mask = min_ff(new_mask, expand_cache->original_mask[vd.index]);
+      }
+      else {
+        new_mask = max_ff(new_mask, expand_cache->original_mask[vd.index]);
+      }
     }
 
     if (new_mask == initial_mask) {
diff --git a/source/blender/editors/sculpt_paint/sculpt_mask_expand.c b/source/blender/editors/sculpt_paint/sculpt_mask_expand.c
index a890a488701..715d6b48605 100644
--- a/source/blender/editors/sculpt_paint/sculpt_mask_expand.c
+++ b/source/blender/editors/sculpt_paint/sculpt_mask_expand.c
@@ -117,7 +117,8 @@ static void sculpt_expand_task_cb(void *__restrict userdata,
     int vi = vd.index;
     float final_mask = *vd.mask;
     if (data->mask_expand_use_normals) {
-      if (ss->filter_cache->normal_factor[BKE_pbvh_vertex_index_to_table(ss->pbvh, SCULPT_active_vertex_get(ss))] <
+      if (ss->filter_cache->normal_factor[BKE_pbvh_vertex_index_to_table(
+              ss->pbvh, SCULPT_active_vertex_get(ss))] <
           ss->filter_cache->normal_factor[vd.index]) {
         final_mask = 1.0f;
       }
@@ -309,8 +310,11 @@ typedef struct MaskExpandFloodFillData {
   bool use_normals;
 } MaskExpandFloodFillData;
 
-static bool mask_expand_floodfill_cb(
-    SculptSession *ss, SculptVertRef from_vref, SculptVertRef to_vref, bool is_duplicate, void *userdata)
+static bool mask_expand_floodfill_cb(SculptSession *ss,
+                                     SculptVertRef from_vref,
+                                     SculptVertRef to_vref,
+                                     bool is_duplicate,
+                                     void *userdata)
 {
   MaskExpandFloodFillData *data = userdata;
 
@@ -424,7 +428,8 @@ static int sculpt_mask_expand_invoke(bContext *C, wmOperator *op, const wmEvent
 
   ss->filter_cache->mask_update_last_it = 1;
   ss->filter_cache->mask_update_current_it = 1;
-  ss->filter_cache->mask_update_it[BKE_pbvh_vertex_index_to_table(ss->pbvh, SCULPT_active_vertex_get(ss))] = 0;
+  ss->filter_cache
+      ->mask_update_it[BKE_pbvh_vertex_index_to_table(ss->pbvh, SCULPT_active_vertex_get(ss))] = 0;
 
   copy_v3_v3(ss->filter_cache->mask_expand_initial_co, SCULPT_active_vertex_co_get(ss));



More information about the Bf-blender-cvs mailing list