[Bf-blender-cvs] [eea78bd1125] sculpt-dev: PBVH depth: Improve detection with normal orientation in trim

Pablo Dobarro noreply at git.blender.org
Sun Feb 7 20:46:28 CET 2021


Commit: eea78bd11251a8aa42c35553fa396a422ae80e61
Author: Pablo Dobarro
Date:   Sun Feb 7 19:33:35 2021 +0100
Branches: sculpt-dev
https://developer.blender.org/rBeea78bd11251a8aa42c35553fa396a422ae80e61

PBVH depth: Improve detection with normal orientation in trim

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

M	source/blender/editors/sculpt_paint/paint_mask.c
M	source/blender/editors/sculpt_paint/sculpt_expand.c

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

diff --git a/source/blender/editors/sculpt_paint/paint_mask.c b/source/blender/editors/sculpt_paint/paint_mask.c
index fddb5ab5592..a5868f0c4b5 100644
--- a/source/blender/editors/sculpt_paint/paint_mask.c
+++ b/source/blender/editors/sculpt_paint/paint_mask.c
@@ -1098,9 +1098,17 @@ static void sculpt_gesture_trim_calculate_depth(bContext *C, SculptGestureContex
       /* When using normal orientation, if the stroke started over the mesh, position the mid point
        * at 0 distance from the shape plane. This positions the trimming shape half inside of the
        * surface. */
-      mid_point_depth = ss->gesture_initial_hit ?
-                            0.0f :
-                            (trim_operation->depth_back + trim_operation->depth_front) * 0.5f;
+      if (SCULPT_GESTURE_TRIM_LOCATION_DEPTH_VOLUME) {
+        mid_point_depth = ss->gesture_initial_hit ?
+                              dist_signed_to_plane_v3(world_space_gesture_initial_location,
+                                                      shape_plane) :
+                              (trim_operation->depth_back + trim_operation->depth_front) * 0.5f;
+      }
+      else {
+        mid_point_depth = ss->gesture_initial_hit ?
+                              0.0f :
+                              (trim_operation->depth_back + trim_operation->depth_front) * 0.5f;
+      }
     }
 
     Sculpt *sd = CTX_data_tool_settings(C)->sculpt;
diff --git a/source/blender/editors/sculpt_paint/sculpt_expand.c b/source/blender/editors/sculpt_paint/sculpt_expand.c
index e3d4eed8ce1..6c8e138abd7 100644
--- a/source/blender/editors/sculpt_paint/sculpt_expand.c
+++ b/source/blender/editors/sculpt_paint/sculpt_expand.c
@@ -119,7 +119,7 @@ static EnumPropertyItem prop_sculpt_expand_target_type_items[] = {
 static bool sculpt_expand_state_get(SculptSession *ss, ExpandCache *expand_cache, const int i)
 {
   if (!SCULPT_vertex_visible_get(ss, i)) {
-      return false;
+    return false;
   }
 
   bool enabled = false;
@@ -147,12 +147,11 @@ static bool sculpt_expand_state_get(SculptSession *ss, ExpandCache *expand_cache
 static bool sculpt_expand_face_state_get(SculptSession *ss, ExpandCache *expand_cache, const int f)
 {
   if (ss->face_sets[f] <= 0) {
-      return false;
+    return false;
   }
 
   bool enabled = false;
 
-
   if (expand_cache->snap_enabled_face_sets) {
     const int face_set = ss->face_sets[f];
     enabled = BLI_gset_haskey(expand_cache->snap_enabled_face_sets, POINTER_FROM_INT(face_set));
@@ -1305,7 +1304,7 @@ static int sculpt_expand_modal(bContext *C, wmOperator *op, const wmEvent *event
       case SCULPT_EXPAND_MODAL_BRUSH_GRADIENT_TOGGLE: {
         expand_cache->brush_gradient = !expand_cache->brush_gradient;
         if (expand_cache->brush_gradient) {
-            expand_cache->falloff_gradient = true;
+          expand_cache->falloff_gradient = true;
         }
         break;
       }



More information about the Bf-blender-cvs mailing list