[Bf-blender-cvs] [ca8184c] GPencil_Editing_Stage3: Fix: Grease Pencil eraser would operate on strokes that were not valid for the current context

Joshua Leung noreply at git.blender.org
Fri Dec 11 05:30:21 CET 2015


Commit: ca8184c6cceb727f46e6175f4dc835c112b225c2
Author: Joshua Leung
Date:   Fri Dec 11 15:55:03 2015 +1300
Branches: GPencil_Editing_Stage3
https://developer.blender.org/rBca8184c6cceb727f46e6175f4dc835c112b225c2

Fix: Grease Pencil eraser would operate on strokes that were not valid for the current context

For example, if a GP datablock was shared between two different types of editors
(e.g. 3D and Sequencer Preview), even the non-valid (and invisible) strokes would
get affected.

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

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 c45fe1b..04e9a77 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -965,7 +965,13 @@ static void gp_stroke_doeraser(tGPsdata *p)
 	/* loop over strokes, checking segments for intersections */
 	for (gps = gpf->strokes.first; gps; gps = gpn) {
 		gpn = gps->next;
-		gp_stroke_eraser_dostroke(p, p->mval, p->mvalo, p->radius, &rect, gpf, gps);
+		
+		/* Not all strokes in the datablock may be valid in the current editor/context
+		 * (e.g. 2D space strokes in the 3D view, if the same datablock is shared)
+		 */
+		if (ED_gpencil_stroke_can_use_direct(p->sa, gps)) {
+			gp_stroke_eraser_dostroke(p, p->mval, p->mvalo, p->radius, &rect, gpf, gps);
+		}
 	}
 }




More information about the Bf-blender-cvs mailing list