[Bf-blender-cvs] [e85ab2cdc2a] master: Fix T71868: Clay Strips brush collapsed geometry

Pablo Dobarro noreply at git.blender.org
Wed Nov 27 16:51:46 CET 2019


Commit: e85ab2cdc2a6905f4d2eb4a2acdc6db8e20fbeec
Author: Pablo Dobarro
Date:   Sun Nov 24 21:15:48 2019 +0100
Branches: master
https://developer.blender.org/rBe85ab2cdc2a6905f4d2eb4a2acdc6db8e20fbeec

Fix T71868: Clay Strips brush collapsed geometry

We are now modifying the relation between pressure and radius using
custom functions to improve the brushes, but dyntopo was not prepared
for this. This fix sends the unmodified radius to dyntopo so it modifies
the geometry correctly.

Reviewed By: jbakker

Maniphest Tasks: T71868

Differential Revision: https://developer.blender.org/D6299

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

M	source/blender/editors/sculpt_paint/sculpt.c
M	source/blender/editors/sculpt_paint/sculpt_intern.h

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

diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c
index 2e98d463945..5e1a36e8873 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -6989,9 +6989,11 @@ static void sculpt_update_cache_variants(bContext *C, Sculpt *sd, Object *ob, Po
   if (BKE_brush_use_size_pressure(scene, brush) &&
       paint_supports_dynamic_size(brush, PAINT_MODE_SCULPT)) {
     cache->radius = sculpt_brush_dynamic_size_get(brush, cache, cache->initial_radius);
+    cache->dyntopo_radius = cache->initial_radius * cache->pressure;
   }
   else {
     cache->radius = cache->initial_radius;
+    cache->dyntopo_radius = cache->initial_radius;
   }
 
   cache->radius_squared = cache->radius * cache->radius;
@@ -7603,11 +7605,12 @@ static void sculpt_stroke_update_step(bContext *C,
     BKE_pbvh_bmesh_detail_size_set(ss->pbvh, object_space_constant_detail);
   }
   else if (sd->flags & SCULPT_DYNTOPO_DETAIL_BRUSH) {
-    BKE_pbvh_bmesh_detail_size_set(ss->pbvh, ss->cache->radius * sd->detail_percent / 100.0f);
+    BKE_pbvh_bmesh_detail_size_set(ss->pbvh,
+                                   ss->cache->dyntopo_radius * sd->detail_percent / 100.0f);
   }
   else {
     BKE_pbvh_bmesh_detail_size_set(ss->pbvh,
-                                   (ss->cache->radius / (float)ups->pixel_radius) *
+                                   (ss->cache->dyntopo_radius / (float)ups->pixel_radius) *
                                        (float)(sd->detail_size * U.pixelsize) / 0.4f);
   }
 
diff --git a/source/blender/editors/sculpt_paint/sculpt_intern.h b/source/blender/editors/sculpt_paint/sculpt_intern.h
index 0b25ab31ce0..324ca250c86 100644
--- a/source/blender/editors/sculpt_paint/sculpt_intern.h
+++ b/source/blender/editors/sculpt_paint/sculpt_intern.h
@@ -318,6 +318,10 @@ typedef struct StrokeCache {
   float true_last_location[3];
   float location[3];
   float last_location[3];
+
+  /* This radius variable is not affected by pressure curves */
+  float dyntopo_radius;
+
   bool is_last_valid;
 
   bool pen_flip;



More information about the Bf-blender-cvs mailing list