Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPablo Dobarro <pablodp606@gmail.com>2019-10-08 19:10:02 +0300
committerPablo Dobarro <pablodp606@gmail.com>2019-11-21 21:06:42 +0300
commita482d940bc16d02e03ac6adf0d24c281ca99a2fa (patch)
treedb648d82d2d97740f28005fe7d59e6d6160c1d23
parenta47f694b86524459aa51c73f6cd65daf9c36e625 (diff)
Sculpt: Invert Scrape to Fill
After adding normal radius, the main use of the Scrape brush is to create flat surfaces with sharp edges. In that case, it does not make sense to have our current "Peaks" version of the brush as its inverted version. The correct inverted version of Scrape for this use case is the Fill brush. This way you can use this tool to crease both concave and convex sharp edges and to fix the artifacts one version produces with its inverted version. I think we should merge these two tools into one, but for now, this solution keeps compatibility with the old behavior. Reviewed By: jbakker Differential Revision: https://developer.blender.org/D6022
-rw-r--r--release/scripts/startup/bl_ui/space_view3d_toolbar.py6
-rw-r--r--source/blender/blenkernel/intern/brush.c2
-rw-r--r--source/blender/blenloader/intern/versioning_270.c4
-rw-r--r--source/blender/editors/sculpt_paint/sculpt.c19
-rw-r--r--source/blender/makesdna/DNA_brush_types.h2
-rw-r--r--source/blender/makesrna/intern/rna_brush.c8
6 files changed, 36 insertions, 5 deletions
diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
index 2f260b59c4f..724264fe494 100644
--- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
@@ -428,6 +428,12 @@ class VIEW3D_PT_tools_brush(Panel, View3DPaintPanel):
row.prop(brush, "pose_offset")
row = col.row()
row.prop(brush, "pose_smooth_iterations")
+ elif brush.sculpt_tool == 'SCRAPE':
+ row = col.row()
+ row.prop(brush, "invert_to_scrape_fill", text = "Invert to Fill")
+ elif brush.sculpt_tool == 'FILL':
+ row = col.row()
+ row.prop(brush, "invert_to_scrape_fill", text = "Invert to Scrape")
elif brush.sculpt_tool == 'GRAB':
col.separator()
row = col.row()
diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c
index 8d256132aa4..8ba1aa20a26 100644
--- a/source/blender/blenkernel/intern/brush.c
+++ b/source/blender/blenkernel/intern/brush.c
@@ -955,9 +955,11 @@ void BKE_brush_sculpt_reset(Brush *br)
br->alpha = 0.25;
break;
case SCULPT_TOOL_SCRAPE:
+ case SCULPT_TOOL_FILL:
br->alpha = 1.0f;
br->spacing = 7;
br->flag |= BRUSH_ACCUMULATE;
+ br->flag |= BRUSH_INVERT_TO_SCRAPE_FILL;
break;
case SCULPT_TOOL_ROTATE:
br->alpha = 1.0;
diff --git a/source/blender/blenloader/intern/versioning_270.c b/source/blender/blenloader/intern/versioning_270.c
index a3dc177262e..8a8a5ade476 100644
--- a/source/blender/blenloader/intern/versioning_270.c
+++ b/source/blender/blenloader/intern/versioning_270.c
@@ -1747,8 +1747,8 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain)
for (Brush *br = bmain->brushes.first; br; br = br->id.next) {
br->falloff_angle = DEG2RADF(80);
/* These flags are used for new feautres. They are not related to falloff_angle */
- br->flag &= ~(BRUSH_FLAG_UNUSED_1 | BRUSH_ORIGINAL_PLANE | BRUSH_GRAB_ACTIVE_VERTEX |
- BRUSH_SCENE_SPACING | BRUSH_FRONTFACE_FALLOFF);
+ br->flag &= ~(BRUSH_INVERT_TO_SCRAPE_FILL | BRUSH_ORIGINAL_PLANE |
+ BRUSH_GRAB_ACTIVE_VERTEX | BRUSH_SCENE_SPACING | BRUSH_FRONTFACE_FALLOFF);
}
for (Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) {
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c
index c30986a4d4b..ff559acf361 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -1731,6 +1731,9 @@ static float brush_strength(const Sculpt *sd,
* normalized diameter */
float flip = dir * invert * pen_flip;
+ if (brush->flag & BRUSH_INVERT_TO_SCRAPE_FILL) {
+ flip = 1.0f;
+ }
/* Pressure final value after being tweaked depending on the brush */
float final_pressure;
@@ -5945,6 +5948,8 @@ static void do_brush_action(Sculpt *sd, Object *ob, Brush *brush, UnifiedPaintSe
sculpt_pose_brush_init(sd, ob, ss, brush, ss->cache->location, ss->cache->radius);
}
+ bool invert = ss->cache->pen_flip || ss->cache->invert || brush->flag & BRUSH_DIR_IN;
+
/* Apply one type of brush action */
switch (brush->sculpt_tool) {
case SCULPT_TOOL_DRAW:
@@ -5996,10 +6001,20 @@ static void do_brush_action(Sculpt *sd, Object *ob, Brush *brush, UnifiedPaintSe
do_multiplane_scrape_brush(sd, ob, nodes, totnode);
break;
case SCULPT_TOOL_FILL:
- do_fill_brush(sd, ob, nodes, totnode);
+ if (invert && brush->flag & BRUSH_INVERT_TO_SCRAPE_FILL) {
+ do_scrape_brush(sd, ob, nodes, totnode);
+ }
+ else {
+ do_fill_brush(sd, ob, nodes, totnode);
+ }
break;
case SCULPT_TOOL_SCRAPE:
- do_scrape_brush(sd, ob, nodes, totnode);
+ if (invert && brush->flag & BRUSH_INVERT_TO_SCRAPE_FILL) {
+ do_fill_brush(sd, ob, nodes, totnode);
+ }
+ else {
+ do_scrape_brush(sd, ob, nodes, totnode);
+ }
break;
case SCULPT_TOOL_MASK:
do_mask_brush(sd, ob, nodes, totnode);
diff --git a/source/blender/makesdna/DNA_brush_types.h b/source/blender/makesdna/DNA_brush_types.h
index 8c502941438..8f9bc1ddedb 100644
--- a/source/blender/makesdna/DNA_brush_types.h
+++ b/source/blender/makesdna/DNA_brush_types.h
@@ -416,7 +416,7 @@ typedef enum eBrushGradientSourceFill {
/* Brush.flag */
typedef enum eBrushFlags {
BRUSH_AIRBRUSH = (1 << 0),
- BRUSH_FLAG_UNUSED_1 = (1 << 1), /* cleared */
+ BRUSH_INVERT_TO_SCRAPE_FILL = (1 << 1),
BRUSH_ALPHA_PRESSURE = (1 << 2),
BRUSH_SIZE_PRESSURE = (1 << 3),
BRUSH_JITTER_PRESSURE = (1 << 4),
diff --git a/source/blender/makesrna/intern/rna_brush.c b/source/blender/makesrna/intern/rna_brush.c
index 8bc6b252d30..cd641c3d372 100644
--- a/source/blender/makesrna/intern/rna_brush.c
+++ b/source/blender/makesrna/intern/rna_brush.c
@@ -2060,6 +2060,14 @@ static void rna_def_brush(BlenderRNA *brna)
prop, "Show Cursor Preview", "Preview the scrape planes in the cursor during the stroke");
RNA_def_property_update(prop, 0, "rna_Brush_update");
+ prop = RNA_def_property(srna, "invert_to_scrape_fill", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_INVERT_TO_SCRAPE_FILL);
+ RNA_def_property_ui_text(prop,
+ "Invert to Scrape or Fill",
+ "Use Scrape or Fill tool when inverting this brush instead of "
+ "inverting its displacement direction");
+ RNA_def_property_update(prop, 0, "rna_Brush_update");
+
prop = RNA_def_property(srna, "use_pressure_strength", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_ALPHA_PRESSURE);
RNA_def_property_ui_icon(prop, ICON_STYLUS_PRESSURE, 0);