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:
authorAntonioya <blendergit@gmail.com>2019-02-03 15:27:25 +0300
committerAntonioya <blendergit@gmail.com>2019-02-03 15:27:47 +0300
commit2672552cf7a7296be085d273aacc2505818cf9cc (patch)
tree7decbae77b979c764be8207eef404d26ad04e28f /source/blender/editors/gpencil
parent2a237377ce390509bfd18cf70f645d17d8bc92aa (diff)
T61140 Shortcut Eraser and Eraser are not the same
Set default eraser with the last eraser used, and remove the toggle button from UI panel.
Diffstat (limited to 'source/blender/editors/gpencil')
-rw-r--r--source/blender/editors/gpencil/gpencil_paint.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c
index 4f44d46ae90..b24f6f445b9 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -1765,6 +1765,25 @@ static Brush *gp_get_default_eraser(Main *bmain, ToolSettings *ts)
}
}
+/* helper to set default eraser and disable others */
+static Brush *gp_set_default_eraser(Main *bmain, Brush *brush_dft)
+{
+ if (brush_dft == NULL) {
+ return;
+ }
+
+ for (Brush *brush = bmain->brush.first; brush; brush = brush->id.next) {
+ if (brush->gpencil_tool == GPAINT_TOOL_ERASE) {
+ if (brush == brush_dft) {
+ brush->gpencil_settings->flag |= GP_BRUSH_DEFAULT_ERASER;
+ }
+ else if (brush->gpencil_settings->flag & GP_BRUSH_DEFAULT_ERASER) {
+ brush->gpencil_settings->flag &= ~GP_BRUSH_DEFAULT_ERASER;
+ }
+ }
+ }
+}
+
/* initialize a drawing brush */
static void gp_init_drawing_brush(bContext *C, tGPsdata *p)
{
@@ -1791,6 +1810,9 @@ static void gp_init_drawing_brush(bContext *C, tGPsdata *p)
else {
p->eraser = paint->brush;
}
+ /* set new eraser as default */
+ gp_set_default_eraser(p->bmain, p->eraser);
+
/* use radius of eraser */
p->radius = (short)p->eraser->size;