[Bf-blender-cvs] [9a148879053] master: Sculpt: Fix scene spacing mode (phase 1)

Joseph Eagar noreply at git.blender.org
Sun Jul 17 01:47:43 CEST 2022


Commit: 9a1488790532b6a64dea66cbe696ac35c70e6793
Author: Joseph Eagar
Date:   Sat Jul 16 16:45:41 2022 -0700
Branches: master
https://developer.blender.org/rB9a1488790532b6a64dea66cbe696ac35c70e6793

Sculpt: Fix scene spacing mode (phase 1)

The scene spacing code was failing to
check if a raycast failed, which can happen
when sculpting the edges of objects in negative
mode.

Note I removed what I suspect was a hack put
in to fix this, spacing was clamped
to 0.001 scene units.

Scene spacing mode is actually quite broken,
so it will be fixed in a series of phases.

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

M	release/datafiles/locale
M	release/scripts/addons
M	source/blender/editors/sculpt_paint/paint_stroke.c
M	source/tools

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

diff --git a/release/datafiles/locale b/release/datafiles/locale
index 9a85b137951..a2eb5078914 160000
--- a/release/datafiles/locale
+++ b/release/datafiles/locale
@@ -1 +1 @@
-Subproject commit 9a85b13795157560b319235c63f5a13b0107ba41
+Subproject commit a2eb507891449a0b67582be9561840075513661d
diff --git a/release/scripts/addons b/release/scripts/addons
index bdf75cb276d..7a8502871c3 160000
--- a/release/scripts/addons
+++ b/release/scripts/addons
@@ -1 +1 @@
-Subproject commit bdf75cb276dfd3b5266c909de4c099c00c68a659
+Subproject commit 7a8502871c34db0343cc7de52d6b49b15a84238a
diff --git a/source/blender/editors/sculpt_paint/paint_stroke.c b/source/blender/editors/sculpt_paint/paint_stroke.c
index 1ee26935dc9..a4c942796d8 100644
--- a/source/blender/editors/sculpt_paint/paint_stroke.c
+++ b/source/blender/editors/sculpt_paint/paint_stroke.c
@@ -79,6 +79,8 @@ typedef struct PaintStroke {
 
   float last_mouse_position[2];
   float last_world_space_position[3];
+  float last_scene_spacing_delta[3];
+
   bool stroke_over_mesh;
   /* space distance covered so far */
   float stroke_distance;
@@ -550,8 +552,15 @@ static void paint_brush_stroke_add_step(
   stroke->last_pressure = pressure;
 
   if (paint_stroke_use_scene_spacing(brush, mode)) {
-    SCULPT_stroke_get_location(C, stroke->last_world_space_position, stroke->last_mouse_position);
-    mul_m4_v3(stroke->vc.obact->obmat, stroke->last_world_space_position);
+    float world_space_position[3];
+
+    if (SCULPT_stroke_get_location(C, world_space_position, stroke->last_mouse_position)) {
+      copy_v3_v3(stroke->last_world_space_position, world_space_position);
+      mul_m4_v3(stroke->vc.obact->obmat, stroke->last_world_space_position);
+    }
+    else {
+      add_v3_v3(stroke->last_world_space_position, stroke->last_scene_spacing_delta);
+    }
   }
 
   if (paint_stroke_use_jitter(mode, brush, stroke->stroke_mode == BRUSH_STROKE_INVERT)) {
@@ -698,7 +707,7 @@ static float paint_space_stroke_spacing(bContext *C,
   spacing *= stroke->zoom_2d;
 
   if (paint_stroke_use_scene_spacing(brush, mode)) {
-    return max_ff(0.001f, size_clamp * spacing / 50.0f);
+    return size_clamp * spacing / 50.0f;
   }
   return max_ff(stroke->zoom_2d, size_clamp * spacing / 50.0f);
 }
@@ -838,6 +847,8 @@ static int paint_space_stroke(bContext *C,
                     stroke->last_world_space_position,
                     final_world_space_position);
         ED_view3d_project_v2(region, final_world_space_position, mouse);
+
+        mul_v3_v3fl(stroke->last_scene_spacing_delta, d_world_space_position, spacing);
       }
       else {
         mouse[0] = stroke->last_mouse_position[0] + dmouse[0] * spacing;
diff --git a/source/tools b/source/tools
index 01b4c0e4a17..da8bdd7244c 160000
--- a/source/tools
+++ b/source/tools
@@ -1 +1 @@
-Subproject commit 01b4c0e4a172819414229445c314be34527bf412
+Subproject commit da8bdd7244c7b6c2eadf4c949ff391d0cc430275



More information about the Bf-blender-cvs mailing list