[Bf-blender-cvs] [8c9f8d6cbb3] blender2.8: GP: Fix duplication when draw strokes in multiple windows

Antonioya noreply at git.blender.org
Sat Oct 20 19:40:40 CEST 2018


Commit: 8c9f8d6cbb3ad176d4731649b22e97344f407aa4
Author: Antonioya
Date:   Sat Oct 20 19:40:29 2018 +0200
Branches: blender2.8
https://developer.blender.org/rB8c9f8d6cbb3ad176d4731649b22e97344f407aa4

GP: Fix duplication when draw strokes in multiple windows

The stroke must be visible only in the current region and only visible when the stroke is completed.

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

M	source/blender/draw/engines/gpencil/gpencil_engine.c
M	source/blender/editors/gpencil/gpencil_paint.c
M	source/blender/makesdna/DNA_gpencil_types.h

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

diff --git a/source/blender/draw/engines/gpencil/gpencil_engine.c b/source/blender/draw/engines/gpencil/gpencil_engine.c
index f371de066a9..71e3c6a22ef 100644
--- a/source/blender/draw/engines/gpencil/gpencil_engine.c
+++ b/source/blender/draw/engines/gpencil/gpencil_engine.c
@@ -579,8 +579,12 @@ void GPENCIL_cache_populate(void *vedata, Object *ob)
 			gpencil_add_draw_data(vedata, ob);
 		}
 
-		/* draw current painting strokes */
-		if (draw_ctx->obact == ob) {
+		/* draw current painting strokes
+		* (only if region is equal to originated paint region)
+		*/
+		if ((draw_ctx->obact == ob) &&
+			((gpd->runtime.ar == NULL) || (gpd->runtime.ar == draw_ctx->ar)))
+		{
 			DRW_gpencil_populate_buffer_strokes(&e_data, vedata, ts, ob);
 		}
 
diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c
index 3650ae644fb..711f77c5890 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -1875,6 +1875,9 @@ static bool gp_session_initdata(bContext *C, wmOperator *op, tGPsdata *p)
 	/* lock axis */
 	p->lock_axis = ts->gp_sculpt.lock_axis;
 
+	/* region where paint was originated */
+	p->gpd->runtime.ar = CTX_wm_region(C);
+
 	return 1;
 }
 
diff --git a/source/blender/makesdna/DNA_gpencil_types.h b/source/blender/makesdna/DNA_gpencil_types.h
index b420c595c6e..858008afd91 100644
--- a/source/blender/makesdna/DNA_gpencil_types.h
+++ b/source/blender/makesdna/DNA_gpencil_types.h
@@ -34,6 +34,7 @@
 #include "DNA_ID.h"
 #include "DNA_brush_types.h"
 
+struct ARegion;
 struct AnimData;
 struct CurveMapping;
 struct GHash;
@@ -306,6 +307,7 @@ typedef enum eGPDlayer_OnionFlag {
 
 /* Runtime temp data for bGPdata */
 typedef struct bGPdata_Runtime {
+	struct ARegion *ar;         /* last region where drawing was originated */
 	void *sbuffer;				/* stroke buffer (can hold GP_STROKE_BUFFER_MAX) */
 
 	/* GP Object drawing */



More information about the Bf-blender-cvs mailing list