[Bf-blender-cvs] [a2510434bb3] master: GP: Do not draw in Locked or Invisible layers
Antonioya
noreply at git.blender.org
Thu Feb 14 16:52:21 CET 2019
Commit: a2510434bb3121a39a792c60bde35e100c0c6e00
Author: Antonioya
Date: Thu Feb 14 16:12:11 2019 +0100
Branches: master
https://developer.blender.org/rBa2510434bb3121a39a792c60bde35e100c0c6e00
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.
===================================================================
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 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)
More information about the Bf-blender-cvs
mailing list