[Bf-blender-cvs] [4c54390] GPencil_EditStrokes: Fix: Stroke filling was incorrectly propagated to the following layers

Joshua Leung noreply at git.blender.org
Sat Nov 8 13:34:19 CET 2014


Commit: 4c5439075b64a2e9fafb7e38ef1650f56ebccd99
Author: Joshua Leung
Date:   Sun Nov 9 01:34:07 2014 +1300
Branches: GPencil_EditStrokes
https://developer.blender.org/rB4c5439075b64a2e9fafb7e38ef1650f56ebccd99

Fix: Stroke filling was incorrectly propagated to the following layers

This was noticeable when the enabling onion skinning on a layer without
fills which follows one which does.

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

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

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

diff --git a/source/blender/editors/gpencil/drawgpencil.c b/source/blender/editors/gpencil/drawgpencil.c
index 9098b3a..8188738 100644
--- a/source/blender/editors/gpencil/drawgpencil.c
+++ b/source/blender/editors/gpencil/drawgpencil.c
@@ -979,17 +979,25 @@ static void gp_draw_data(bGPdata *gpd, int offsx, int offsy, int winx, int winy,
 		glLineWidth(lthick);
 		glPointSize((float)(gpl->thickness + 2));
 		
-		/* apply xray layer setting */
-		if (gpl->flag & GP_LAYER_NO_XRAY) dflag |=  GP_DRAWDATA_NO_XRAY;
-		else dflag &= ~GP_DRAWDATA_NO_XRAY;
+		/* Add layer drawing settings to the set of "draw flags" 
+		 * NOTE: If the setting doesn't apply, it *must* be cleared,
+		 *       as dflag's carry over from the previous layer
+		 */
+#define GP_DRAWFLAG_APPLY(condition, draw_flag_value)     { \
+			if (condition) dflag |= (draw_flag_value);      \
+			else           dflag &= ~(draw_flag_value);     \
+		} (void)0
+		
+		/* xray... */
+		GP_DRAWFLAG_APPLY((gpl->flag & GP_LAYER_NO_XRAY), GP_DRAWDATA_NO_XRAY);
 		
-		/* apply volumetric setting */
-		if (gpl->flag & GP_LAYER_VOLUMETRIC) dflag |= GP_DRAWDATA_VOLUMETRIC;
-		else dflag &= ~GP_DRAWDATA_VOLUMETRIC;
+		/* volumetric strokes... */
+		GP_DRAWFLAG_APPLY((gpl->flag & GP_LAYER_VOLUMETRIC), GP_DRAWDATA_VOLUMETRIC);
 		
-		/* apply fill setting */
+		/* fill strokes... */
 		// XXX: this is not a very good limit
-		if (gpl->fill[3] > 0.001f)  dflag |= GP_DRAWDATA_FILL;
+		GP_DRAWFLAG_APPLY((gpl->fill[3] > 0.001f), GP_DRAWDATA_FILL);
+#undef GP_DRAWFLAG_APPLY
 		
 		/* draw 'onionskins' (frame left + right) */
 		if ((gpl->flag & GP_LAYER_ONIONSKIN) && !(dflag & GP_DRAWDATA_NO_ONIONS)) {




More information about the Bf-blender-cvs mailing list