diff options
author | Joshua Leung <aligorith@gmail.com> | 2017-01-18 17:00:33 +0300 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2017-01-18 17:06:43 +0300 |
commit | 00edc600b0319fc239ae4cb9c0a98452b2d6c74e (patch) | |
tree | 531ef71c7e7cab3d2bbf1cc412ecd0bffc6999f7 /source/blender/editors/gpencil | |
parent | 7452af0f868b061a63648e9c351090462d7b01e8 (diff) |
Fix: Make it possible to erase strokes (on other layers) even if the active layer doesn't have any frames
Diffstat (limited to 'source/blender/editors/gpencil')
-rw-r--r-- | source/blender/editors/gpencil/gpencil_paint.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c index 74c7a45a24e..5879306b06c 100644 --- a/source/blender/editors/gpencil/gpencil_paint.c +++ b/source/blender/editors/gpencil/gpencil_paint.c @@ -1623,8 +1623,9 @@ static void gp_paint_initstroke(tGPsdata *p, eGPencil_PaintModes paintmode) * 2) Ensure that p->gpf refers to the frame used for the active layer * (to avoid problems with other tools which expect it to exist) */ - bGPDlayer *gpl; - for (gpl = p->gpd->layers.first; gpl; gpl = gpl->next) { + bool has_layer_to_erase = false; + + for (bGPDlayer *gpl = p->gpd->layers.first; gpl; gpl = gpl->next) { /* Skip if layer not editable */ if (gpencil_layer_is_editable(gpl) == false) continue; @@ -1638,6 +1639,7 @@ static void gp_paint_initstroke(tGPsdata *p, eGPencil_PaintModes paintmode) */ if (gpl->actframe && gpl->actframe->strokes.first) { gpl->actframe = BKE_gpencil_layer_getframe(gpl, CFRA, GP_GETFRAME_ADD_COPY); + has_layer_to_erase = true; } /* XXX: we omit GP_FRAME_PAINT here for now, @@ -1658,10 +1660,10 @@ static void gp_paint_initstroke(tGPsdata *p, eGPencil_PaintModes paintmode) } } - if (p->gpf == NULL) { + if (has_layer_to_erase == false) { p->status = GP_STATUS_ERROR; //if (G.debug & G_DEBUG) - printf("Error: No frame created for eraser on active layer (gpencil_paint_init)\n"); + printf("Error: Eraser will not be affecting anything (gpencil_paint_init)\n"); return; } } |