Commit: 5fd3d1fda44fdc5da4b279309004996b1deaa3b4
Author: Antonioya
Date:   Fri Aug 3 10:28:27 2018 +0200
Branches: blender2.8
https://developer.blender.org/rB5fd3d1fda44fdc5da4b279309004996b1deaa3b4

Fix T56217: Segment Fault when using the Fill Brush on Blank GP Object

The error was in any GP object without layers.

Also added a check to avoid paint in a locked layer.

===================================================================

M       source/blender/editors/gpencil/gpencil_fill.c

===================================================================

diff --git a/source/blender/editors/gpencil/gpencil_fill.c 
b/source/blender/editors/gpencil/gpencil_fill.c
index 253f0db865e..ec90c826a27 100644
--- a/source/blender/editors/gpencil/gpencil_fill.c
+++ b/source/blender/editors/gpencil/gpencil_fill.c
@@ -987,7 +987,9 @@ static tGPDfill *gp_session_init_fill(bContext *C, 
wmOperator *UNUSED(op))
        /* set GP datablock */
        tgpf->gpd = gpd;
        tgpf->gpl = BKE_gpencil_layer_getactive(gpd);
-
+       if (tgpf->gpl == NULL) {
+               tgpf->gpl = BKE_gpencil_layer_addnew(tgpf->gpd, 
DATA_("GP_Layer"), true);
+       }
        tgpf->lock_axis = ts->gp_sculpt.lock_axis;
 
        tgpf->oldkey = -1;
@@ -1087,6 +1089,12 @@ static void gpencil_fill_cancel(bContext *C, wmOperator 
*op)
 static int gpencil_fill_init(bContext *C, wmOperator *op)
 {
        tGPDfill *tgpf;
+       /* cannot paint in locked layer */
+       bGPdata *gpd = CTX_data_gpencil_data(C);
+       bGPDlayer *gpl = BKE_gpencil_layer_getactive(gpd);
+       if ((gpl) && (gpl->flag & GP_LAYER_LOCKED)) {
+               return 0;
+       }
 
        /* check context */
        tgpf = op->customdata = gp_session_init_fill(C, op);

_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to