[Bf-blender-cvs] [2c1bc8e4518] temp-sculpt-cavity-mask: temp-sculpt-cavity-mask: Make requested patch changes

Joseph Eagar noreply at git.blender.org
Tue Sep 27 20:25:21 CEST 2022


Commit: 2c1bc8e45189e8242848cb2c5be5fe357e35b2d5
Author: Joseph Eagar
Date:   Tue Sep 27 11:25:03 2022 -0700
Branches: temp-sculpt-cavity-mask
https://developer.blender.org/rB2c1bc8e45189e8242848cb2c5be5fe357e35b2d5

temp-sculpt-cavity-mask: Make requested patch changes

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

M	release/scripts/startup/bl_ui/properties_paint_common.py
M	release/scripts/startup/bl_ui/space_view3d_toolbar.py
M	source/blender/blenkernel/intern/brush.cc
M	source/blender/editors/sculpt_paint/sculpt.c
M	source/blender/editors/sculpt_paint/sculpt_automasking.cc
M	source/blender/editors/sculpt_paint/sculpt_expand.c
M	source/blender/editors/sculpt_paint/sculpt_filter_color.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_ops.c
M	source/blender/makesrna/RNA_access.h
M	source/blender/makesrna/intern/rna_brush.c
M	source/blender/makesrna/intern/rna_internal.h
M	source/blender/makesrna/intern/rna_sculpt_paint.c

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

diff --git a/release/scripts/startup/bl_ui/properties_paint_common.py b/release/scripts/startup/bl_ui/properties_paint_common.py
index a68b3e208fc..a4a328fce1a 100644
--- a/release/scripts/startup/bl_ui/properties_paint_common.py
+++ b/release/scripts/startup/bl_ui/properties_paint_common.py
@@ -947,8 +947,11 @@ def brush_settings_advanced(layout, context, brush, popover=False):
         col.prop(brush, "use_automasking_cavity_inverted", text="Cavity (Inverted)")
 
         col.separator()
+        col.prop(brush, "automasking_boundary_edges_propagation_steps")
 
         if brush.use_automasking_cavity or brush.use_automasking_cavity_inverted:
+            col.separator()
+
             col.prop(brush, "automasking_cavity_factor", text="Cavity Factor")
             col.prop(brush, "automasking_cavity_blur_steps", text="Cavity Blur")
             col.prop(brush, "use_automasking_custom_cavity_curve", text="Use Curve")
@@ -956,8 +959,6 @@ def brush_settings_advanced(layout, context, brush, popover=False):
             if brush.use_automasking_custom_cavity_curve:
                 col.template_curve_mapping(brush, "automasking_cavity_curve")
 
-        col.prop(brush, "automasking_boundary_edges_propagation_steps")
-
         layout.separator()
 
         # sculpt plane settings
diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
index 94cf23a03f3..2d339e53a96 100644
--- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
@@ -975,8 +975,11 @@ class VIEW3D_PT_sculpt_options(Panel, View3DPaintPanel):
         col.prop(sculpt, "use_automasking_cavity_inverted", text="Cavity (Inverted)")
 
         col.separator()
+        col.prop(sculpt.brush, "automasking_boundary_edges_propagation_steps")
 
         if sculpt.use_automasking_cavity or sculpt.use_automasking_cavity_inverted:
+            col.separator()
+
             col2 = col.column()
             props = col2.operator("sculpt.mask_from_cavity", text="Mask From Cavity")
             props.use_automask_settings = True
@@ -991,8 +994,6 @@ class VIEW3D_PT_sculpt_options(Panel, View3DPaintPanel):
             if sculpt.use_automasking_custom_cavity_curve:
                 col2.template_curve_mapping(sculpt, "automasking_cavity_curve")
 
-        col2.prop(sculpt.brush, "automasking_boundary_edges_propagation_steps")
-
 
 class VIEW3D_PT_sculpt_options_gravity(Panel, View3DPaintPanel):
     bl_context = ".sculpt_mode"  # dot on purpose (access from topbar)
@@ -1016,7 +1017,7 @@ class VIEW3D_PT_sculpt_options_gravity(Panel, View3DPaintPanel):
         col.active = capabilities.has_gravity
         col.prop(sculpt, "gravity", slider=True, text="Factor")
         col.prop(sculpt, "gravity_object")
-    
+
 # TODO, move to space_view3d.py
 class VIEW3D_PT_sculpt_symmetry(Panel, View3DPaintPanel):
     bl_context = ".sculpt_mode"  # dot on purpose (access from topbar)
diff --git a/source/blender/blenkernel/intern/brush.cc b/source/blender/blenkernel/intern/brush.cc
index f7bbd50aafa..fb8a6785f64 100644
--- a/source/blender/blenkernel/intern/brush.cc
+++ b/source/blender/blenkernel/intern/brush.cc
@@ -1713,7 +1713,7 @@ void BKE_brush_sculpt_reset(Brush *br)
   /* Note that sculpt defaults where set when 0.5 was the default (now it's 1.0)
    * assign this so logic below can remain the same. */
   br->alpha = 0.5f;
-  
+
   /* Brush settings */
   switch (br->sculpt_tool) {
     case SCULPT_TOOL_DRAW_SHARP:
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c
index 588637daab8..de517785a0a 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -5412,7 +5412,7 @@ static bool sculpt_stroke_test_start(bContext *C, struct wmOperator *op, const f
       SCULPT_undo_push_begin_ex(ob, sculpt_tool_name(sd));
     }
 
-    SCULPT_stroke_id_inc(ob);
+    SCULPT_stroke_id_next(ob);
 
     return true;
   }
@@ -6012,7 +6012,7 @@ void SCULPT_fake_neighbors_free(Object *ob)
   sculpt_pose_fake_neighbors_free(ss);
 }
 
-void SCULPT_stroke_id_inc(Object *ob)
+void SCULPT_stroke_id_next(Object *ob)
 {
   /* Manually wrap in int32 space to avoid tripping up undefined behavior
    * sanitizers.
diff --git a/source/blender/editors/sculpt_paint/sculpt_automasking.cc b/source/blender/editors/sculpt_paint/sculpt_automasking.cc
index a59114c3da2..8334e59c3a4 100644
--- a/source/blender/editors/sculpt_paint/sculpt_automasking.cc
+++ b/source/blender/editors/sculpt_paint/sculpt_automasking.cc
@@ -360,16 +360,16 @@ int SCULPT_automasking_settings_hash(Object *ob, AutomaskingCache *automasking)
 
   if (automasking->settings.flags & BRUSH_AUTOMASKING_CAVITY_ALL) {
     hash = BLI_hash_int_2d(hash, automasking->settings.cavity_blur_steps);
-    hash = BLI_hash_int_2d(hash, (int)(automasking->settings.cavity_factor * 5000.0f));
+    hash = BLI_hash_int_2d(hash, *reinterpret_cast<uint*>(&automasking->settings.cavity_factor));
 
     if (automasking->settings.cavity_curve) {
       CurveMap *cm = automasking->settings.cavity_curve->cm;
 
       for (int i = 0; i < cm->totpoint; i++) {
-        hash = BLI_hash_int_2d(hash, (int)(cm->curve[i].x * 5000.0f));
-        hash = BLI_hash_int_2d(hash, (int)(cm->curve[i].y * 5000.0f));
-        hash = BLI_hash_int_2d(hash, (int)cm->curve[i].flag);
-        hash = BLI_hash_int_2d(hash, (int)cm->curve[i].shorty);
+        hash = BLI_hash_int_2d(hash, *reinterpret_cast<uint*>(&cm->curve[i].x));
+        hash = BLI_hash_int_2d(hash, *reinterpret_cast<uint*>(&cm->curve[i].y));
+        hash = BLI_hash_int_2d(hash, (uint)cm->curve[i].flag);
+        hash = BLI_hash_int_2d(hash, (uint)cm->curve[i].shorty);
       }
     }
   }
@@ -500,7 +500,7 @@ static void SCULPT_topology_automasking_init(Sculpt *sd, Object *ob)
   Brush *brush = BKE_paint_brush(&sd->paint);
 
   if (BKE_pbvh_type(ss->pbvh) == PBVH_FACES && !ss->pmap) {
-    BLI_assert_msg(0, "Topology masking: pmap missing");
+    BLI_assert_unreachable();
     return;
   }
 
diff --git a/source/blender/editors/sculpt_paint/sculpt_expand.c b/source/blender/editors/sculpt_paint/sculpt_expand.c
index 7235937bd52..ecf296fbd66 100644
--- a/source/blender/editors/sculpt_paint/sculpt_expand.c
+++ b/source/blender/editors/sculpt_paint/sculpt_expand.c
@@ -2102,7 +2102,7 @@ static int sculpt_expand_invoke(bContext *C, wmOperator *op, const wmEvent *even
   SculptSession *ss = ob->sculpt;
   Sculpt *sd = CTX_data_tool_settings(C)->sculpt;
 
-  SCULPT_stroke_id_inc(ob);
+  SCULPT_stroke_id_next(ob);
 
   /* Create and configure the Expand Cache. */
   ss->expand_cache = MEM_callocN(sizeof(ExpandCache), "expand cache");
diff --git a/source/blender/editors/sculpt_paint/sculpt_filter_color.c b/source/blender/editors/sculpt_paint/sculpt_filter_color.c
index 436e1587754..6d1fad1fc65 100644
--- a/source/blender/editors/sculpt_paint/sculpt_filter_color.c
+++ b/source/blender/editors/sculpt_paint/sculpt_filter_color.c
@@ -335,7 +335,7 @@ static int sculpt_color_filter_invoke(bContext *C, wmOperator *op, const wmEvent
   const bool use_automasking = SCULPT_is_automasking_enabled(sd, ss, NULL);
   if (use_automasking) {
     /* Increment stroke id for automasking system. */
-    SCULPT_stroke_id_inc(ob);
+    SCULPT_stroke_id_next(ob);
 
     /* Update the active face set manually as the paint cursor is not enabled when using the Mesh
      * Filter Tool. */
diff --git a/source/blender/editors/sculpt_paint/sculpt_filter_mesh.c b/source/blender/editors/sculpt_paint/sculpt_filter_mesh.c
index 5e6fa4701a7..0b68a527b59 100644
--- a/source/blender/editors/sculpt_paint/sculpt_filter_mesh.c
+++ b/source/blender/editors/sculpt_paint/sculpt_filter_mesh.c
@@ -682,7 +682,7 @@ static int sculpt_mesh_filter_invoke(bContext *C, wmOperator *op, const wmEvent
 
   if (use_automasking) {
     /* Increment stroke id for automasking system. */
-    SCULPT_stroke_id_inc(ob);
+    SCULPT_stroke_id_next(ob);
 
     /* Update the active face set manually as the paint cursor is not enabled when using the Mesh
      * Filter Tool. */
diff --git a/source/blender/editors/sculpt_paint/sculpt_intern.h b/source/blender/editors/sculpt_paint/sculpt_intern.h
index a88bba16990..91a218cc082 100644
--- a/source/blender/editors/sculpt_paint/sculpt_intern.h
+++ b/source/blender/editors/sculpt_paint/sculpt_intern.h
@@ -1849,7 +1849,7 @@ BLI_INLINE bool SCULPT_tool_is_face_sets(int tool)
 }
 
 void SCULPT_stroke_id_ensure(struct Object *ob);
-void SCULPT_stroke_id_inc(struct Object *ob);
+void SCULPT_stroke_id_next(struct Object *ob);
 bool SCULPT_tool_can_reuse_cavity_mask(int sculpt_tool);
 
 #ifdef __cplusplus
diff --git a/source/blender/editors/sculpt_paint/sculpt_ops.c b/source/blender/editors/sculpt_paint/sculpt_ops.c
index 16bf3a4009e..d5edd5708ad 100644
--- a/source/blender/editors/sculpt_paint/sculpt_ops.c
+++ b/source/blender/editors/sculpt_paint/sculpt_ops.c
@@ -1137,7 +1137,7 @@ static int sculpt_bake_cavity_exec(bContext *C, wmOperator *op)
   tdata.nodes = nodes;
   tdata.automasking = SCULPT_automasking_cache_init(&sd2, &brush2, ob);
 
-  SCULPT_stroke_id_inc(ob);
+  SCULPT_stroke_id_next(ob);
 
   TaskParallelSettings settings;
   BKE_pbvh_parallel_range_settings(&settings, true, totnode);
@@ -1208,8 +1208,6 @@ static void cavity_bake_ui(bContext *C, wmOperator *op)
       uiTemplateCurveMapping(layout, &sculpt_ptr, curve_prop, 'v', false, false, false, false);
     }
   }
-  // uiItemS(layout);
-  // row = uiLayoutRow(layout, false);
 }
 
 static void SCULPT_OT_mask_from_cavity(wmOperatorType *ot)
diff --git a/source/blender/makesrna/RNA_access.h b/source/blender/makesrna/RNA_access.h
index 1d8f8bebfd1..a7eacb03a63 100644
--- a/source/blender/makesrna/RNA_access.h
+++ b/source/blender/makesrna/RNA_access.h
@@ -905,7 +905,6 @@ eRNAOverrideStatus RNA_property_override_library_status(struct Main *bmainm,
 
 void RNA_struct_state_owner_set(const char *name);
 const char *RNA_struct_state_owner_get(void);
-extern const EnumPropertyItem RNA_automasking_flags[];
 
 #ifdef __cplusplus
 }
diff --git a/source/blender/makesrna/intern/rna_brush.c b/source/blender/mak

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list