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
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.
-rw-r--r--release/scripts/startup/bl_ui/space_view3d_toolbar.py5
-rw-r--r--source/blender/editors/gpencil/gpencil_paint.c22
2 files changed, 23 insertions, 4 deletions
diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
index 2155db9e722..3bfd2242a7c 100644
--- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
@@ -1485,10 +1485,7 @@ class VIEW3D_PT_tools_grease_pencil_brush(View3DPanel, Panel):
if brush is not None:
gp_settings = brush.gpencil_settings
- # XXX: Items in "sub" currently show up beside the brush selector in a separate column
- if brush.gpencil_tool == 'ERASE':
- sub.prop(gp_settings, "use_default_eraser", text="")
- elif brush.gpencil_tool in {'DRAW', 'FILL'}:
+ if brush.gpencil_tool in {'DRAW', 'FILL'}:
layout.row(align=True).template_ID(gp_settings, "material")
if not self.is_popover:
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;