[Bf-blender-cvs] [00edc600b0] master: Fix: Make it possible to erase strokes (on other layers) even if the active layer doesn't have any frames

Joshua Leung noreply at git.blender.org
Wed Jan 18 15:11:46 CET 2017


Commit: 00edc600b0319fc239ae4cb9c0a98452b2d6c74e
Author: Joshua Leung
Date:   Thu Jan 19 03:00:33 2017 +1300
Branches: master
https://developer.blender.org/rB00edc600b0319fc239ae4cb9c0a98452b2d6c74e

Fix: Make it possible to erase strokes (on other layers) even if the active layer doesn't have any frames

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

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 74c7a45a24..5879306b06 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;
 		}
 	}




More information about the Bf-blender-cvs mailing list