[Bf-blender-cvs] [38e61c04eaa] sculpt-dev: Sculpt Expand: Fix texture strength when switching falloffs

Pablo Dobarro noreply at git.blender.org
Sun Feb 14 20:02:51 CET 2021


Commit: 38e61c04eaa2cc67be176339afc8ce1f0079dea4
Author: Pablo Dobarro
Date:   Sun Feb 14 19:12:48 2021 +0100
Branches: sculpt-dev
https://developer.blender.org/rB38e61c04eaa2cc67be176339afc8ce1f0079dea4

Sculpt Expand: Fix texture strength when switching falloffs

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

M	source/blender/editors/sculpt_paint/paint_cursor.c
M	source/blender/editors/sculpt_paint/sculpt_expand.c
M	source/blender/makesrna/intern/rna_sculpt_paint.c

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

diff --git a/source/blender/editors/sculpt_paint/paint_cursor.c b/source/blender/editors/sculpt_paint/paint_cursor.c
index 6c22f96e8ea..27d49170c8d 100644
--- a/source/blender/editors/sculpt_paint/paint_cursor.c
+++ b/source/blender/editors/sculpt_paint/paint_cursor.c
@@ -1639,11 +1639,7 @@ static void paint_cursor_draw_3d_view_brush_cursor_inactive(PaintCursorContext *
   /* Transform Pivot. */
   if (pcontext->paint && pcontext->paint->flags & PAINT_SCULPT_SHOW_PIVOT) {
     cursor_draw_point_screen_space(
-        pcontext->pos,
-        pcontext->region,
-        pcontext->ss->pivot_pos,
-        pcontext->vc.obact->obmat,
-        2);
+        pcontext->pos, pcontext->region, pcontext->ss->pivot_pos, pcontext->vc.obact->obmat, 2);
   }
 
   if (brush->sculpt_tool == SCULPT_TOOL_BOUNDARY) {
diff --git a/source/blender/editors/sculpt_paint/sculpt_expand.c b/source/blender/editors/sculpt_paint/sculpt_expand.c
index 4901129c5ea..363dcbeede0 100644
--- a/source/blender/editors/sculpt_paint/sculpt_expand.c
+++ b/source/blender/editors/sculpt_paint/sculpt_expand.c
@@ -157,7 +157,8 @@ static float sculpt_expand_falloff_value_vertex_get(SculptSession *ss,
   const float avg = BKE_brush_sample_tex_3d(
       expand_cache->scene, expand_cache->brush, vertex_co, rgba, 0, ss->tex_pool);
 
-  const float distorsion = (avg - 0.5f) * expand_cache->texture_distorsion_strength;
+  const float distorsion = (avg - 0.5f) * expand_cache->texture_distorsion_strength *
+                           expand_cache->max_falloff_factor;
   return expand_cache->falloff_factor[i] + distorsion;
 }
 
@@ -171,7 +172,8 @@ static float sculpt_expand_max_vertex_falloff_factor_get(ExpandCache *expand_cac
     return expand_cache->max_falloff_factor;
   }
 
-  return expand_cache->max_falloff_factor + (0.5f * expand_cache->texture_distorsion_strength);
+  return expand_cache->max_falloff_factor +
+         (0.5f * expand_cache->texture_distorsion_strength * expand_cache->max_falloff_factor);
 }
 
 static bool sculpt_expand_state_get(SculptSession *ss, ExpandCache *expand_cache, const int i)
@@ -868,12 +870,12 @@ static void sculpt_expand_cache_data_free(ExpandCache *expand_cache)
   MEM_SAFE_FREE(expand_cache);
 }
 
-static void sculpt_expand_cache_free(SculptSession *ss) {
-    sculpt_expand_cache_data_free(ss->expand_cache);
-    ss->expand_cache = NULL;
+static void sculpt_expand_cache_free(SculptSession *ss)
+{
+  sculpt_expand_cache_data_free(ss->expand_cache);
+  ss->expand_cache = NULL;
 }
 
-
 static void sculpt_expand_restore_face_set_data(SculptSession *ss, ExpandCache *expand_cache)
 {
   PBVHNode **nodes;
@@ -1524,11 +1526,11 @@ static int sculpt_expand_modal(bContext *C, wmOperator *op, const wmEvent *event
         break;
       }
       case SCULPT_EXPAND_MODAL_TEXTURE_DISTORSION_INCREASE: {
-        expand_cache->texture_distorsion_strength += expand_cache->max_falloff_factor * SCULPT_EXPAND_TEXTURE_DISTORSION_STEP;
+        expand_cache->texture_distorsion_strength += SCULPT_EXPAND_TEXTURE_DISTORSION_STEP;
         break;
       }
       case SCULPT_EXPAND_MODAL_TEXTURE_DISTORSION_DECREASE: {
-        expand_cache->texture_distorsion_strength -= expand_cache->max_falloff_factor * SCULPT_EXPAND_TEXTURE_DISTORSION_STEP;
+        expand_cache->texture_distorsion_strength -= SCULPT_EXPAND_TEXTURE_DISTORSION_STEP;
         expand_cache->texture_distorsion_strength = max_ff(
             expand_cache->texture_distorsion_strength, 0.0f);
         break;
diff --git a/source/blender/makesrna/intern/rna_sculpt_paint.c b/source/blender/makesrna/intern/rna_sculpt_paint.c
index c33df5cc987..63015a38c03 100644
--- a/source/blender/makesrna/intern/rna_sculpt_paint.c
+++ b/source/blender/makesrna/intern/rna_sculpt_paint.c
@@ -620,8 +620,7 @@ static void rna_def_paint(BlenderRNA *brna)
 
   prop = RNA_def_property(srna, "show_sculpt_pivot", PROP_BOOLEAN, PROP_NONE);
   RNA_def_property_boolean_sdna(prop, NULL, "flags", PAINT_SCULPT_SHOW_PIVOT);
-  RNA_def_property_ui_text(
-      prop, "Show Pivot", "Show Transform Tool Sculpt Pivot");
+  RNA_def_property_ui_text(prop, "Show Pivot", "Show Transform Tool Sculpt Pivot");
   RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
 
   prop = RNA_def_property(srna, "use_sculpt_delay_updates", PROP_BOOLEAN, PROP_NONE);



More information about the Bf-blender-cvs mailing list