[Bf-blender-cvs] [674bc2e4b44] sculpt-dev: Sculpt Symmetrize: Initial commit

Pablo Dobarro noreply at git.blender.org
Sun Apr 18 18:15:05 CEST 2021


Commit: 674bc2e4b44ad3abda88bce682197758ee217a89
Author: Pablo Dobarro
Date:   Fri Apr 16 00:38:47 2021 +0200
Branches: sculpt-dev
https://developer.blender.org/rB674bc2e4b44ad3abda88bce682197758ee217a89

Sculpt Symmetrize: Initial commit

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

M	source/blender/blenloader/intern/versioning_defaults.c
M	source/blender/editors/sculpt_paint/sculpt.c
M	source/blender/makesdna/DNA_brush_enums.h
M	source/blender/makesrna/intern/rna_brush.c

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

diff --git a/source/blender/blenloader/intern/versioning_defaults.c b/source/blender/blenloader/intern/versioning_defaults.c
index eeb5c4ef6c3..9d2553055a4 100644
--- a/source/blender/blenloader/intern/versioning_defaults.c
+++ b/source/blender/blenloader/intern/versioning_defaults.c
@@ -766,6 +766,14 @@ void BLO_update_defaults_startup_blend(Main *bmain, const char *app_template)
       brush->sculpt_tool = SCULPT_TOOL_SCENE_PROJECT;
     }
 
+    brush_name = "Symmetryze";
+    brush = BLI_findstring(&bmain->brushes, brush_name, offsetof(ID, name) + 2);
+    if (!brush) {
+      brush = BKE_brush_add(bmain, brush_name, OB_MODE_SCULPT);
+      id_us_min(&brush->id);
+      brush->sculpt_tool = SCULPT_TOOL_SYMMETRIZE;
+    }
+
     /* Use the same tool icon color in the brush cursor */
     for (brush = bmain->brushes.first; brush; brush = brush->id.next) {
       if (brush->ob_mode & OB_MODE_SCULPT) {
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c
index 16e7813b1db..04262d66a81 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -2390,6 +2390,7 @@ static float brush_strength(const Sculpt *sd,
     case SCULPT_TOOL_DRAW:
     case SCULPT_TOOL_DRAW_SHARP:
     case SCULPT_TOOL_LAYER:
+    case SCULPT_TOOL_SYMMETRIZE:
       return alpha * flip * pressure * overlap * feather;
     case SCULPT_TOOL_DISPLACEMENT_ERASER:
       return alpha * pressure * overlap * feather;
@@ -3532,6 +3533,7 @@ static void do_draw_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode)
   mul_v3_v3(offset, ss->cache->scale);
   mul_v3_fl(offset, bstrength);
 
+
   /* XXX - this shouldn't be necessary, but sculpting crashes in blender2.8 otherwise
    * initialize before threads so they can do curve mapping. */
   BKE_curvemapping_init(brush->curve);
@@ -7222,6 +7224,8 @@ static const char *sculpt_tool_name(Sculpt *sd)
       return "Fairing Brush";
     case SCULPT_TOOL_SCENE_PROJECT:
       return "Scene Project";
+    case SCULPT_TOOL_SYMMETRIZE:
+      return "Symmetrize Brush";
   }
 
   return "Sculpting";
diff --git a/source/blender/makesdna/DNA_brush_enums.h b/source/blender/makesdna/DNA_brush_enums.h
index 05952b0b954..1bc218267c7 100644
--- a/source/blender/makesdna/DNA_brush_enums.h
+++ b/source/blender/makesdna/DNA_brush_enums.h
@@ -476,6 +476,7 @@ typedef enum eBrushSculptTool {
   SCULPT_TOOL_DISPLACEMENT_SMEAR = 32,
   SCULPT_TOOL_FAIRING = 33,
   SCULPT_TOOL_SCENE_PROJECT = 34,
+  SCULPT_TOOL_SYMMETRIZE = 35,
 } eBrushSculptTool;
 
 /* Brush.uv_sculpt_tool */
diff --git a/source/blender/makesrna/intern/rna_brush.c b/source/blender/makesrna/intern/rna_brush.c
index f94af82feb6..da6ba5c5b63 100644
--- a/source/blender/makesrna/intern/rna_brush.c
+++ b/source/blender/makesrna/intern/rna_brush.c
@@ -140,6 +140,7 @@ const EnumPropertyItem rna_enum_brush_sculpt_tool_items[] = {
     {SCULPT_TOOL_FAIRING, "FAIRING", ICON_BRUSH_MASK, "Fairing", ""},
     {SCULPT_TOOL_SCENE_PROJECT, "SCENE_PROJECT", ICON_BRUSH_MASK, "Scene Project", ""},
     {SCULPT_TOOL_DRAW_FACE_SETS, "DRAW_FACE_SETS", ICON_BRUSH_MASK, "Draw Face Sets", ""},
+    {SCULPT_TOOL_SYMMETRIZE, "SYMMETRIZE", ICON_BRUSH_SCULPT_DRAW, "Symmetrize", ""},
     {0, NULL, 0, NULL, NULL},
 };
 /* clang-format on */



More information about the Bf-blender-cvs mailing list