diff options
author | Antonio Vazquez <blendergit@gmail.com> | 2019-10-14 16:50:46 +0300 |
---|---|---|
committer | Antonio Vazquez <blendergit@gmail.com> | 2019-10-14 16:53:39 +0300 |
commit | 841e9695806921ff2c99c55a95cb06ad6312e64d (patch) | |
tree | c837c9d564388961f69a3b0d67ab072e732d69e6 | |
parent | 80fe0ac7ff8cf44cc7f3706ea47270a1e794e1ff (diff) |
GPencil: Fix unreported duplicated brushes
The eraser and fill brushes were duplicated due a bug introduced by versioning code.
-rw-r--r-- | source/blender/blenkernel/intern/brush.c | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c index 597a5c78a8d..fe740f4898e 100644 --- a/source/blender/blenkernel/intern/brush.c +++ b/source/blender/blenkernel/intern/brush.c @@ -590,7 +590,10 @@ void BKE_brush_gpencil_presets(Main *bmain, ToolSettings *ts) brush->smooth_stroke_factor = SMOOTH_STROKE_FACTOR; /* Fill brush. */ - brush = BKE_brush_add_gpencil(bmain, ts, "Fill Area"); + brush = BLI_findstring(&bmain->brushes, "Fill Area", offsetof(ID, name) + 2); + if (brush == NULL) { + brush = BKE_brush_add_gpencil(bmain, ts, "Fill Area"); + } brush->size = 20.0f; brush->gpencil_settings->flag |= GP_BRUSH_ENABLE_CURSOR; @@ -618,7 +621,10 @@ void BKE_brush_gpencil_presets(Main *bmain, ToolSettings *ts) brush->smooth_stroke_factor = SMOOTH_STROKE_FACTOR; /* Soft Eraser brush. */ - brush = BKE_brush_add_gpencil(bmain, ts, "Eraser Soft"); + brush = BLI_findstring(&bmain->brushes, "Eraser Soft", offsetof(ID, name) + 2); + if (brush == NULL) { + brush = BKE_brush_add_gpencil(bmain, ts, "Eraser Soft"); + } brush->size = 30.0f; brush->gpencil_settings->draw_strength = 0.5f; brush->gpencil_settings->flag |= (GP_BRUSH_ENABLE_CURSOR | GP_BRUSH_DEFAULT_ERASER); @@ -631,7 +637,10 @@ void BKE_brush_gpencil_presets(Main *bmain, ToolSettings *ts) brush->gpencil_settings->era_thickness_f = 10.0f; /* Hard Eraser brush. */ - brush = BKE_brush_add_gpencil(bmain, ts, "Eraser Hard"); + brush = BLI_findstring(&bmain->brushes, "Eraser Hard", offsetof(ID, name) + 2); + if (brush == NULL) { + brush = BKE_brush_add_gpencil(bmain, ts, "Eraser Hard"); + } brush->size = 30.0f; brush->gpencil_settings->draw_strength = 1.0f; brush->gpencil_settings->flag |= (GP_BRUSH_ENABLE_CURSOR | GP_BRUSH_DEFAULT_ERASER); @@ -643,7 +652,10 @@ void BKE_brush_gpencil_presets(Main *bmain, ToolSettings *ts) brush->gpencil_tool = GPAINT_TOOL_ERASE; /* Point Eraser brush. */ - brush = BKE_brush_add_gpencil(bmain, ts, "Eraser Point"); + brush = BLI_findstring(&bmain->brushes, "Eraser Point", offsetof(ID, name) + 2); + if (brush == NULL) { + brush = BKE_brush_add_gpencil(bmain, ts, "Eraser Point"); + } brush->size = 30.0f; brush->gpencil_settings->flag |= GP_BRUSH_ENABLE_CURSOR; brush->gpencil_settings->eraser_mode = GP_BRUSH_ERASER_HARD; @@ -652,7 +664,10 @@ void BKE_brush_gpencil_presets(Main *bmain, ToolSettings *ts) brush->gpencil_tool = GPAINT_TOOL_ERASE; /* Stroke Eraser brush. */ - brush = BKE_brush_add_gpencil(bmain, ts, "Eraser Stroke"); + brush = BLI_findstring(&bmain->brushes, "Eraser Stroke", offsetof(ID, name) + 2); + if (brush == NULL) { + brush = BKE_brush_add_gpencil(bmain, ts, "Eraser Stroke"); + } brush->size = 30.0f; brush->gpencil_settings->flag |= GP_BRUSH_ENABLE_CURSOR; brush->gpencil_settings->eraser_mode = GP_BRUSH_ERASER_STROKE; |