diff options
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/intern/brush.c | 2 | ||||
-rw-r--r-- | source/blender/blenloader/intern/versioning_270.c | 4 | ||||
-rw-r--r-- | source/blender/editors/sculpt_paint/sculpt.c | 19 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_brush_types.h | 2 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_brush.c | 8 |
5 files changed, 30 insertions, 5 deletions
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); |