diff options
author | Pablo Dobarro <pablodp606@gmail.com> | 2019-09-26 17:14:02 +0300 |
---|---|---|
committer | Pablo Dobarro <pablodp606@gmail.com> | 2019-09-26 17:15:18 +0300 |
commit | a0d4c2e607fc91a99e1272b1e975ec45e02c94fc (patch) | |
tree | 5ee645d73b3623e1e7d186dfde82b47f2a929f99 /source | |
parent | 4d89667663869b2140e9f3e74172b5c83a30a6db (diff) |
Sculpt: Brush default settings
- Update default values of current tools
- Create default values for new sculpt tools
- Update the color of the cursor to match the color of the tool icon
Reviewed By: jbakker, brecht
Maniphest Tasks: T68745
Differential Revision: https://developer.blender.org/D5813
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/intern/brush.c | 132 | ||||
-rw-r--r-- | source/blender/blenloader/intern/versioning_defaults.c | 40 |
2 files changed, 126 insertions, 46 deletions
diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c index 29c4ae624e9..bd372237e91 100644 --- a/source/blender/blenkernel/intern/brush.c +++ b/source/blender/blenkernel/intern/brush.c @@ -812,11 +812,13 @@ void BKE_brush_sculpt_reset(Brush *br) /* Use the curve presets by default */ br->curve_preset = BRUSH_CURVE_SMOOTH; - if (br->sculpt_tool == SCULPT_TOOL_DRAW_SHARP) { - br->curve_preset = BRUSH_CURVE_POW4; - } + /* Brush settings */ switch (br->sculpt_tool) { + case SCULPT_TOOL_DRAW_SHARP: + br->flag |= BRUSH_DIR_IN; + br->curve_preset = BRUSH_CURVE_POW4; + br->spacing = 5; case SCULPT_TOOL_CLAY: br->flag |= BRUSH_FRONTFACE; break; @@ -824,41 +826,9 @@ void BKE_brush_sculpt_reset(Brush *br) br->flag |= BRUSH_DIR_IN; br->alpha = 0.25; break; - case SCULPT_TOOL_FILL: - br->add_col[1] = 1; - br->sub_col[0] = 0.25; - br->sub_col[1] = 1; - break; - case SCULPT_TOOL_FLATTEN: - br->add_col[1] = 1; - br->sub_col[0] = 0.25; - br->sub_col[1] = 1; - break; - case SCULPT_TOOL_INFLATE: - br->add_col[0] = 0.750000; - br->add_col[1] = 0.750000; - br->add_col[2] = 0.750000; - br->sub_col[0] = 0.250000; - br->sub_col[1] = 0.250000; - br->sub_col[2] = 0.250000; - break; - case SCULPT_TOOL_NUDGE: - br->add_col[0] = 0.250000; - br->add_col[1] = 1.000000; - br->add_col[2] = 0.250000; - break; - case SCULPT_TOOL_PINCH: - br->add_col[0] = 0.750000; - br->add_col[1] = 0.750000; - br->add_col[2] = 0.750000; - br->sub_col[0] = 0.250000; - br->sub_col[1] = 0.250000; - br->sub_col[2] = 0.250000; - break; case SCULPT_TOOL_SCRAPE: - br->add_col[1] = 1.000000; - br->sub_col[0] = 0.250000; - br->sub_col[1] = 1.000000; + br->alpha = 1.0f; + br->spacing = 7; break; case SCULPT_TOOL_ROTATE: br->alpha = 1.0; @@ -866,22 +836,92 @@ void BKE_brush_sculpt_reset(Brush *br) case SCULPT_TOOL_SMOOTH: br->flag &= ~BRUSH_SPACE_ATTEN; br->spacing = 5; - br->add_col[0] = 0.750000; - br->add_col[1] = 0.750000; - br->add_col[2] = 0.750000; + br->alpha = 0.7f; break; - case SCULPT_TOOL_GRAB: - case SCULPT_TOOL_ELASTIC_DEFORM: - case SCULPT_TOOL_POSE: case SCULPT_TOOL_SNAKE_HOOK: case SCULPT_TOOL_THUMB: br->size = 75; br->flag &= ~BRUSH_ALPHA_PRESSURE; br->flag &= ~BRUSH_SPACE; br->flag &= ~BRUSH_SPACE_ATTEN; - br->add_col[0] = 0.250000; - br->add_col[1] = 1.000000; - br->add_col[2] = 0.250000; + break; + case SCULPT_TOOL_ELASTIC_DEFORM: + br->elastic_deform_volume_preservation = 0.4f; + br->elastic_deform_type = BRUSH_ELASTIC_DEFORM_GRAB_TRISCALE; + br->flag &= ~BRUSH_ALPHA_PRESSURE; + br->flag &= ~BRUSH_SPACE; + br->flag &= ~BRUSH_SPACE_ATTEN; + break; + case SCULPT_TOOL_POSE: + br->flag &= ~BRUSH_ALPHA_PRESSURE; + br->flag &= ~BRUSH_SPACE; + br->flag &= ~BRUSH_SPACE_ATTEN; + break; + case SCULPT_TOOL_GRAB: + br->alpha = 0.4f; + br->size = 75; + br->flag &= ~BRUSH_ALPHA_PRESSURE; + br->flag &= ~BRUSH_SPACE; + br->flag &= ~BRUSH_SPACE_ATTEN; + break; + default: + break; + } + + /* Cursor colors */ + switch (br->sculpt_tool) { + case SCULPT_TOOL_DRAW: + case SCULPT_TOOL_DRAW_SHARP: + case SCULPT_TOOL_CLAY: + case SCULPT_TOOL_CLAY_STRIPS: + case SCULPT_TOOL_LAYER: + case SCULPT_TOOL_INFLATE: + case SCULPT_TOOL_BLOB: + case SCULPT_TOOL_CREASE: + br->add_col[0] = 0.65f; + br->add_col[1] = 0.85f; + br->add_col[2] = 0.9f; + br->sub_col[0] = 0.65f; + br->sub_col[1] = 0.85f; + br->sub_col[2] = 0.9f; + break; + + case SCULPT_TOOL_SMOOTH: + case SCULPT_TOOL_FLATTEN: + case SCULPT_TOOL_FILL: + case SCULPT_TOOL_SCRAPE: + br->add_col[0] = 1.0f; + br->add_col[1] = 0.39f; + br->add_col[2] = 0.39f; + br->sub_col[0] = 1.0f; + br->sub_col[1] = 0.39f; + br->sub_col[2] = 0.39f; + break; + + case SCULPT_TOOL_PINCH: + case SCULPT_TOOL_GRAB: + case SCULPT_TOOL_SNAKE_HOOK: + case SCULPT_TOOL_THUMB: + case SCULPT_TOOL_NUDGE: + case SCULPT_TOOL_ROTATE: + case SCULPT_TOOL_ELASTIC_DEFORM: + case SCULPT_TOOL_POSE: + br->add_col[0] = 1.0f; + br->add_col[1] = 1.0f; + br->add_col[2] = 0.39f; + br->sub_col[0] = 1.0f; + br->sub_col[1] = 1.0f; + br->sub_col[2] = 0.39f; + break; + + case SCULPT_TOOL_SIMPLIFY: + case SCULPT_TOOL_MASK: + br->add_col[0] = 0.750000; + br->add_col[1] = 0.750000; + br->add_col[2] = 0.750000; + br->sub_col[0] = 0.750000; + br->sub_col[1] = 0.750000; + br->sub_col[2] = 0.750000; break; default: break; diff --git a/source/blender/blenloader/intern/versioning_defaults.c b/source/blender/blenloader/intern/versioning_defaults.c index 87c8869622a..15d200f72d9 100644 --- a/source/blender/blenloader/intern/versioning_defaults.c +++ b/source/blender/blenloader/intern/versioning_defaults.c @@ -41,6 +41,7 @@ #include "DNA_light_types.h" #include "BKE_appdir.h" +#include "BKE_brush.h" #include "BKE_colortools.h" #include "BKE_layer.h" #include "BKE_library.h" @@ -285,6 +286,10 @@ static void blo_update_defaults_scene(Main *bmain, Scene *scene) CURVEMAP_SLOPE_POSITIVE); } + if (ts->sculpt) { + ts->sculpt->paint.symmetry_flags |= PAINT_SYMMETRY_FEATHER; + } + /* Correct default startup UV's. */ Mesh *me = BLI_findstring(&bmain->meshes, "Cube", offsetof(ID, name) + 2); if (me && (me->totloop == 24) && (me->mloopuv != NULL)) { @@ -423,5 +428,40 @@ void BLO_update_defaults_startup_blend(Main *bmain, const char *app_template) if (brush) { brush->spacing = 3.0; } + + brush = BLI_findstring(&bmain->brushes, "Draw Sharp", offsetof(ID, name) + 2); + if (!brush) { + brush = BKE_brush_add(bmain, "Draw Sharp", OB_MODE_SCULPT); + id_us_min(&brush->id); + brush->sculpt_tool = SCULPT_TOOL_DRAW_SHARP; + } + + brush = BLI_findstring(&bmain->brushes, "Elastic Deform", offsetof(ID, name) + 2); + if (!brush) { + brush = BKE_brush_add(bmain, "Elastic Defrom", OB_MODE_SCULPT); + id_us_min(&brush->id); + brush->sculpt_tool = SCULPT_TOOL_ELASTIC_DEFORM; + } + + brush = BLI_findstring(&bmain->brushes, "Pose", offsetof(ID, name) + 2); + if (!brush) { + brush = BKE_brush_add(bmain, "Pose", OB_MODE_SCULPT); + id_us_min(&brush->id); + brush->sculpt_tool = SCULPT_TOOL_POSE; + } + + brush = BLI_findstring(&bmain->brushes, "Simplify", offsetof(ID, name) + 2); + if (!brush) { + brush = BKE_brush_add(bmain, "Simplify", OB_MODE_SCULPT); + id_us_min(&brush->id); + brush->sculpt_tool = SCULPT_TOOL_SIMPLIFY; + } + + /* Use the same tool icon color in the brush cursor */ + for (Brush *brush = bmain->brushes.first; brush; brush = brush->id.next) { + if (brush->sculpt_tool) { + BKE_brush_sculpt_reset(brush); + } + } } } |