[Bf-blender-cvs] [93216128790] greasepencil-object: Avoid drawing with Eraser brush
Antonio Vazquez
noreply at git.blender.org
Sat Mar 3 10:52:11 CET 2018
Commit: 932161287900c5c9658f6aec331161a89e7213f5
Author: Antonio Vazquez
Date: Sat Mar 3 10:51:55 2018 +0100
Branches: greasepencil-object
https://developer.blender.org/rB932161287900c5c9658f6aec331161a89e7213f5
Avoid drawing with Eraser brush
If the current brush is eraser and try to draw, cancel the operator.
This could be activated with the D key and must be forbidden.
===================================================================
M source/blender/editors/gpencil/gpencil_paint.c
===================================================================
diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c
index 4110a05a673..285fc657eca 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -2121,7 +2121,16 @@ static int gpencil_draw_init(bContext *C, wmOperator *op, const wmEvent *event)
{
tGPsdata *p;
eGPencil_PaintModes paintmode = RNA_enum_get(op->ptr, "mode");
+ ToolSettings *ts = CTX_data_tool_settings(C);
+ bGPDbrush *brush = BKE_gpencil_brush_getactive(ts);
+ /* if mode is draw and the brush is eraser, cancel */
+ if (paintmode != GP_PAINTMODE_ERASER) {
+ if ((brush) && (brush->type == GP_BRUSH_TYPE_ERASE)) {
+ return 0;
+ }
+ }
+
/* check context */
p = op->customdata = gp_session_initpaint(C, op);
if ((p == NULL) || (p->status == GP_STATUS_ERROR)) {
More information about the Bf-blender-cvs
mailing list