[Bf-blender-cvs] [2672552cf7a] master: T61140 Shortcut Eraser and Eraser are not the same
Antonioya
noreply at git.blender.org
Sun Feb 3 13:27:53 CET 2019
Commit: 2672552cf7a7296be085d273aacc2505818cf9cc
Author: Antonioya
Date: Sun Feb 3 13:27:25 2019 +0100
Branches: master
https://developer.blender.org/rB2672552cf7a7296be085d273aacc2505818cf9cc
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.
===================================================================
M release/scripts/startup/bl_ui/space_view3d_toolbar.py
M source/blender/editors/gpencil/gpencil_paint.c
===================================================================
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;
More information about the Bf-blender-cvs
mailing list