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-14 18:12:11 +0300
committerAntonioya <blendergit@gmail.com>2019-02-14 18:52:14 +0300
commita2510434bb3121a39a792c60bde35e100c0c6e00 (patch)
treead4a6a2e5c5f5f908d8da02f9d937bce56a42a6c /source/blender/editors
parentfa7149893a6c9d61ba840475b6d96172b0d55a67 (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.c10
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)