[Bf-blender-cvs] [c209e0902df] sculpt-dev: Sculpt: Fixed a few sculpt color issues

Joseph Eagar noreply at git.blender.org
Wed Oct 6 06:56:34 CEST 2021


Commit: c209e0902df3d9c0f5b5bd0e5e58aaaa847b2957
Author: Joseph Eagar
Date:   Tue Oct 5 21:55:53 2021 -0700
Branches: sculpt-dev
https://developer.blender.org/rBc209e0902df3d9c0f5b5bd0e5e58aaaa847b2957

Sculpt: Fixed a few sculpt color issues

* Fixed broken smear brush
* Tweaked ui defaults a bit

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

M	release/scripts/startup/bl_ui/properties_paint_common.py
M	source/blender/blenkernel/BKE_blender_version.h
M	source/blender/blenkernel/BKE_brush_engine.h
M	source/blender/blenkernel/intern/brush_channel_define.h
M	source/blender/blenkernel/intern/brush_engine_presets.c
M	source/blender/blenloader/intern/versioning_300.c
M	source/blender/editors/sculpt_paint/sculpt.c
M	source/blender/editors/sculpt_paint/sculpt_paint_color.c
M	source/blender/makesrna/intern/rna_brush_engine.c

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

diff --git a/release/scripts/startup/bl_ui/properties_paint_common.py b/release/scripts/startup/bl_ui/properties_paint_common.py
index 812bfc01517..f7809f21af6 100644
--- a/release/scripts/startup/bl_ui/properties_paint_common.py
+++ b/release/scripts/startup/bl_ui/properties_paint_common.py
@@ -1113,7 +1113,7 @@ def brush_settings(layout, context, brush, popover=False):
                         brush,
                         "autosmooth_spacing",
                         slider=True,
-                        text="Spacing")
+                        text="Smooth Spacing")
 
             UnifiedPaintPanel.prop_unified(box,
                 context,
@@ -1161,7 +1161,7 @@ def brush_settings(layout, context, brush, popover=False):
                         brush,
                         "topology_rake_spacing",
                         slider=True,
-                        text="Spacing")
+                        text="Rake Spacing")
 
                 UnifiedPaintPanel.prop_unified(box,
                     context,
diff --git a/source/blender/blenkernel/BKE_blender_version.h b/source/blender/blenkernel/BKE_blender_version.h
index ceb19e87b40..d8112de760d 100644
--- a/source/blender/blenkernel/BKE_blender_version.h
+++ b/source/blender/blenkernel/BKE_blender_version.h
@@ -39,7 +39,7 @@ extern "C" {
 
 /* Blender file format version. */
 #define BLENDER_FILE_VERSION BLENDER_VERSION
-#define BLENDER_FILE_SUBVERSION 33
+#define BLENDER_FILE_SUBVERSION 34
 
 /* Minimum Blender version that supports reading file written with the current
  * version. Older Blender versions will test this and show a warning if the file
diff --git a/source/blender/blenkernel/BKE_brush_engine.h b/source/blender/blenkernel/BKE_brush_engine.h
index 58cc33170cd..ea539b27c23 100644
--- a/source/blender/blenkernel/BKE_brush_engine.h
+++ b/source/blender/blenkernel/BKE_brush_engine.h
@@ -309,8 +309,14 @@ extern void BKE_brush_channelset_to_unified_settings(BrushChannelSet *chset,
 
 void BKE_brush_init_toolsettings(struct Sculpt *sd);
 void BKE_brush_builtin_create(struct Brush *brush, int tool);
+
 BrushCommandList *BKE_brush_commandlist_create();
+void BKE_brush_commandlist_start(BrushCommandList *list,
+                                 struct Brush *brush,
+                                 BrushChannelSet *chset_final);
+
 void BKE_brush_commandlist_free(BrushCommandList *cl);
+
 BrushCommand *BKE_brush_commandlist_add(BrushCommandList *cl,
                                         BrushChannelSet *chset_template,
                                         bool auto_inherit);
diff --git a/source/blender/blenkernel/intern/brush_channel_define.h b/source/blender/blenkernel/intern/brush_channel_define.h
index 9df57642975..fe23ca93fbc 100644
--- a/source/blender/blenkernel/intern/brush_channel_define.h
+++ b/source/blender/blenkernel/intern/brush_channel_define.h
@@ -194,7 +194,7 @@ places in rna_engine_codebase are relevent:
   {-1}
 })
 
-  MAKE_FLOAT_EX(spacing, "Spacing", "", 10.0f, 0.25f, 1000.0f, 1.0f, 500.0f, false)
+  MAKE_FLOAT_EX(spacing, "Spacing", "", 10.0f, 0.25f, 1000.0f, 1.0f, 200.0f, false)
   MAKE_FLOAT_EX(topology_rake, "Topology Rake", "Automatically align edges to the brush direction to "
                            "generate cleaner topology and define sharp features. "
                            "Best used on low-poly meshes as it has a performance impact", 0.0f, 0.0f, 5.0f, 0.0f, 2.0f, false)
@@ -335,7 +335,7 @@ MAKE_FLOAT_EX(vcol_boundary_exponent, "Exponent", "Hardening exponent (smaller v
 MAKE_FLOAT_EX(vcol_boundary_radius_scale, "Radius Scale",
   "Scale brush radius for vcol boundary hardening",
   1.0f, 0.0001f, 100.0f, 0.001f, 3.0f, false)
-MAKE_FLOAT_EX(vcol_boundary_spacing, "Spacing", "Spacing for vcol boundary hardening", 15, 0.25, 5000, 0.5, 300, false)
+MAKE_FLOAT_EX(vcol_boundary_spacing, "Color Hardening Spacing", "Spacing for vcol boundary hardening", 15, 0.25, 5000, 0.5, 300, false)
 MAKE_BOOL(invert_to_scrape_fill,"Invert to Scrape or Fill",
                         "Use Scrape or Fill tool when inverting this brush instead of "
                         "inverting its displacement direction", true)
@@ -568,6 +568,15 @@ MAKE_ENUM(array_deform_type, "Deformation", "Deformation type that is used in th
 
 MAKE_INT_EX(array_count, "Count", "Number of copies", 2, 1, 10000, 1, 50)
 
+MAKE_ENUM(smear_deform_type, "Deformation", "Deformation type that is used in the brush", BRUSH_SMEAR_DEFORM_DRAG, {
+      {BRUSH_SMEAR_DEFORM_DRAG, "DRAG", "NONE", "Drag", ""},
+      {BRUSH_SMEAR_DEFORM_PINCH, "PINCH", "NONE", "Pinch", ""},
+      {BRUSH_SMEAR_DEFORM_EXPAND, "EXPAND", "NONE", "Expand", ""},
+      {-1}
+})
+
+MAKE_FLOAT(smear_deform_blend, "Smear Blend", "Blend with existing paint", 1.0f, 0.0f, 1.0f)
+
 //MAKE_FLOAT3_EX
 /* clang-format on */
 #if defined(BRUSH_CHANNEL_DEFINE_TYPES) || defined(BRUSH_CHANNEL_DEFINE_EXTERNAL)
diff --git a/source/blender/blenkernel/intern/brush_engine_presets.c b/source/blender/blenkernel/intern/brush_engine_presets.c
index f32b4ae3f24..a22180c3d2b 100644
--- a/source/blender/blenkernel/intern/brush_engine_presets.c
+++ b/source/blender/blenkernel/intern/brush_engine_presets.c
@@ -268,6 +268,9 @@ static bool check_builtin_init()
   // SETCAT(direction, "Basic");
   SETCAT(accumulate, "Basic");
 
+  SETCAT(smear_deform_type, "Smear");
+  SETCAT(smear_deform_blend, "Smear");
+
   SETCAT(tip_roundness, "Basic");
   SETCAT(hardness, "Basic");
   SETCAT(tip_scale_x, "Basic");
@@ -331,6 +334,15 @@ static bool check_builtin_init()
   SETCAT(color, "Color");
   SETCAT(secondary_color, "Color");
   SETCAT(blend, "Color");
+  SETCAT(wet_mix, "Color");
+  SETCAT(wet_persistence, "Color");
+  SETCAT(density, "Color");
+  SETCAT(flow, "Color");
+
+  SETCAT(vcol_boundary_spacing, "Color Boundary Hardening");
+  SETCAT(vcol_boundary_radius_scale, "Color Boundary Hardening");
+  SETCAT(vcol_boundary_exponent, "Color Boundary Hardening");
+  SETCAT(vcol_boundary_factor, "Color Boundary Hardening");
 
   return true;
 }
@@ -456,6 +468,7 @@ static BrushSettingsMap brush_settings_map[] = {
   DEF(smooth_deform_type, smooth_deform_type, INT, INT)
   DEF(array_deform_type, array_deform_type, INT, INT)
   DEF(array_count, array_count, INT, INT)
+  DEF(smear_deform_type, smear_deform_type, INT, INT)
 };
 
 static const int brush_settings_map_len = ARRAY_SIZE(brush_settings_map);
@@ -1095,6 +1108,8 @@ void BKE_brush_builtin_patch(Brush *brush, int tool)
       break;
     case SCULPT_TOOL_SMEAR:
       ADDCH(rate);
+      ADDCH(smear_deform_type);
+      ADDCH(smear_deform_blend);
       break;
     case SCULPT_TOOL_SLIDE_RELAX:
       ADDCH(slide_deform_type);
@@ -1286,6 +1301,14 @@ void BKE_brush_channelset_ui_init(Brush *brush, int tool)
       SHOWCTX(use_grab_active_vertex);
       SHOWALL(grab_silhouette);
       break;
+    case SCULPT_TOOL_SMEAR:
+      SHOWWRK(smear_deform_type);
+      SHOWCTX(smear_deform_type);
+      SHOWWRK(spacing);
+
+      // hrm, not sure this is such a good idea - joeedh
+      // SHOWALL(smear_deform_blend);
+      break;
     case SCULPT_TOOL_CLAY_STRIPS:
       SHOWWRK(area_radius_factor);
       SHOWWRK(plane_offset);
@@ -1397,6 +1420,9 @@ void BKE_brush_channelset_ui_init(Brush *brush, int tool)
       SHOWWRK(rate);
       SHOWALL(blend);
 
+      SHOWWRK(use_smoothed_rake);
+      SHOWCTX(use_smoothed_rake);
+
       SHOWCTX(color);
       SHOWCTX(blend);
       break;
@@ -1519,6 +1545,7 @@ void BKE_brush_builtin_create(Brush *brush, int tool)
       BRUSHSET_LOOKUP(chset, strength)->mappings[BRUSH_MAPPING_PRESSURE].flag &=
           ~BRUSH_MAPPING_ENABLED;
       BRUSHSET_SET_BOOL(chset, dyntopo_disabled, true);
+      BRUSHSET_SET_BOOL(chset, use_space_attenuation, false);
       break;
 
     case SCULPT_TOOL_LAYER:
diff --git a/source/blender/blenloader/intern/versioning_300.c b/source/blender/blenloader/intern/versioning_300.c
index 99e5a6ad21c..5020eb180d9 100644
--- a/source/blender/blenloader/intern/versioning_300.c
+++ b/source/blender/blenloader/intern/versioning_300.c
@@ -1788,6 +1788,14 @@ void blo_do_versions_300(FileData *fd, Library *UNUSED(lib), Main *bmain)
     }
   }
 
+  if (!MAIN_VERSION_ATLEAST(bmain, 300, 34)) {
+    LISTBASE_FOREACH (Brush *, brush, &bmain->brushes) {
+      if (brush->channels && brush->sculpt_tool == SCULPT_TOOL_SMEAR) {
+        BRUSHSET_SET_BOOL(brush->channels, use_space_attenuation, false);
+        BKE_brush_channelset_ui_init(brush, brush->sculpt_tool);
+      }
+    }
+  }
   if (!MAIN_VERSION_ATLEAST(bmain, 300, 27)) {
     LISTBASE_FOREACH (Brush *, brush, &bmain->brushes) {
       if (brush->channels) {
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c
index d1c8912307f..c62cf12c576 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -8795,6 +8795,7 @@ void do_brush_action(Sculpt *sd, Object *ob, Brush *brush, UnifiedPaintSettings
     /* Update last stroke position. */
     ups->last_stroke_valid = true;
 
+    copy_v3_v3(ss->cache->true_last_location, ss->cache->true_location);
     return;
   }
 
@@ -9235,10 +9236,6 @@ void do_brush_action(Sculpt *sd, Object *ob, Brush *brush, UnifiedPaintSettings
   ups->last_stroke_valid = true;
 }
 
-void BKE_brush_commandlist_start(BrushCommandList *list,
-                                 Brush *brush,
-                                 BrushChannelSet *chset_final);
-
 static void SCULPT_run_command_list(
     Sculpt *sd, Object *ob, Brush *brush, BrushCommandList *list, UnifiedPaintSettings *ups)
 {
diff --git a/source/blender/editors/sculpt_paint/sculpt_paint_color.c b/source/blender/editors/sculpt_paint/sculpt_paint_color.c
index f5411c1aaf2..97ee7ba3552 100644
--- a/source/blender/editors/sculpt_paint/sculpt_paint_color.c
+++ b/source/blender/editors/sculpt_paint/sculpt_paint_color.c
@@ -31,6 +31,7 @@
 
 #include "DNA_mesh_types.h"
 #include "DNA_meshdata_types.h"
+#include "DNA_scene_types.h"
 
 #include "BKE_brush.h"
 #include "BKE_colortools.h"
@@ -138,7 +139,7 @@ static void do_paint_brush_task_cb_ex(void *__restrict userdata,
 
   IMB_colormanagement_srgb_to_scene_linear_v3(brush_colo

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list