[Bf-blender-cvs] [f9751889df3] blender-v3.2-release: Fix T81715: Unprojected radius mode messes up sculpt texture radius

Joseph Eagar noreply at git.blender.org
Sun May 15 09:36:30 CEST 2022


Commit: f9751889df35c81501c60abd1af98252d80ea3fc
Author: Joseph Eagar
Date:   Sun May 15 00:33:22 2022 -0700
Branches: blender-v3.2-release
https://developer.blender.org/rBf9751889df35c81501c60abd1af98252d80ea3fc

Fix T81715: Unprojected radius mode messes up sculpt texture radius

We really need to fix how unprojected radius (scene unit) works.
What happened is the paint code updates the brush's normal radius
with the current unprojected pixel radius, which was then
used by texture brush tiled mode.

To fix this I just cached the pixel radius at stroke start in
UnifiedPaintSettings->start_pixel_radius.

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

M	release/scripts/addons
M	source/blender/blenkernel/intern/brush.c
M	source/blender/editors/sculpt_paint/paint_stroke.c
M	source/blender/makesdna/DNA_scene_types.h
M	source/tools

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

diff --git a/release/scripts/addons b/release/scripts/addons
index 67e43f9083b..7025cd28ede 160000
--- a/release/scripts/addons
+++ b/release/scripts/addons
@@ -1 +1 @@
-Subproject commit 67e43f9083b79b33f5aa6ac4d1630946804d9534
+Subproject commit 7025cd28ede25eb44208722f842e35b10325c6cc
diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c
index 0593db34e20..3f243d04965 100644
--- a/source/blender/blenkernel/intern/brush.c
+++ b/source/blender/blenkernel/intern/brush.c
@@ -2029,7 +2029,7 @@ float BKE_brush_sample_tex_3d(const Scene *scene,
       /* leave the coordinates relative to the screen */
 
       /* use unadjusted size for tiled mode */
-      invradius = 1.0f / BKE_brush_size_get(scene, br);
+      invradius = 1.0f / ups->start_pixel_radius;
 
       x = point_2d[0];
       y = point_2d[1];
@@ -2142,7 +2142,7 @@ float BKE_brush_sample_masktex(
       /* leave the coordinates relative to the screen */
 
       /* use unadjusted size for tiled mode */
-      invradius = 1.0f / BKE_brush_size_get(scene, br);
+      invradius = 1.0f / ups->start_pixel_radius;
 
       x = point_2d[0];
       y = point_2d[1];
diff --git a/source/blender/editors/sculpt_paint/paint_stroke.c b/source/blender/editors/sculpt_paint/paint_stroke.c
index d2005473512..210cffcbcda 100644
--- a/source/blender/editors/sculpt_paint/paint_stroke.c
+++ b/source/blender/editors/sculpt_paint/paint_stroke.c
@@ -923,6 +923,8 @@ PaintStroke *paint_stroke_new(bContext *C,
 
   BKE_paint_set_overlay_override(br->overlay_flags);
 
+  ups->start_pixel_radius = BKE_brush_size_get(CTX_data_scene(C), br);
+
   return stroke;
 }
 
diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h
index bfe967fcde5..1be27e0354c 100644
--- a/source/blender/makesdna/DNA_scene_types.h
+++ b/source/blender/makesdna/DNA_scene_types.h
@@ -1255,8 +1255,7 @@ typedef struct UnifiedPaintSettings {
    * In case of anchored brushes contains the anchored radius */
   float pixel_radius;
   float initial_pixel_radius;
-
-  char _pad[4];
+  float start_pixel_radius;
 
   /* drawing pressure */
   float size_pressure_value;
diff --git a/source/tools b/source/tools
index c1586ae2959..53b7c02a062 160000
--- a/source/tools
+++ b/source/tools
@@ -1 +1 @@
-Subproject commit c1586ae29595713b597c22f6baa08d6cce423767
+Subproject commit 53b7c02a062c3d6ec6b38ce670836321b4e78fab



More information about the Bf-blender-cvs mailing list