diff options
author | Antonioya <blendergit@gmail.com> | 2019-02-14 18:12:11 +0300 |
---|---|---|
committer | Antonioya <blendergit@gmail.com> | 2019-02-14 18:52:14 +0300 |
commit | a2510434bb3121a39a792c60bde35e100c0c6e00 (patch) | |
tree | ad4a6a2e5c5f5f908d8da02f9d937bce56a42a6c /source/blender/editors | |
parent | fa7149893a6c9d61ba840475b6d96172b0d55a67 (diff) |
GP: Do not draw in Locked or Invisible layers
It's weird to draw in a layer where the stroke cannot be seen or is not saved.
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/gpencil/gpencil_paint.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c index fdde5d16266..8fc7978aa44 100644 --- a/source/blender/editors/gpencil/gpencil_paint.c +++ b/source/blender/editors/gpencil/gpencil_paint.c @@ -3132,6 +3132,16 @@ static int gpencil_draw_invoke(bContext *C, wmOperator *op, const wmEvent *event RNA_enum_set(op->ptr, "mode", GP_PAINTMODE_ERASER); } + /* do not draw in locked or invisible layers */ + eGPencil_PaintModes paintmode = RNA_enum_get(op->ptr, "mode"); + if (paintmode != GP_PAINTMODE_ERASER) { + bGPDlayer *gpl = CTX_data_active_gpencil_layer(C); + if ((gpl) && ((gpl->flag & GP_LAYER_LOCKED) || (gpl->flag & GP_LAYER_HIDE))) { + BKE_report(op->reports, RPT_ERROR, "Active layer is locked or hide"); + return OPERATOR_CANCELLED; + } + } + /* try to initialize context data needed while drawing */ if (!gpencil_draw_init(C, op, event)) { if (op->customdata) |