diff options
author | Antonioya <blendergit@gmail.com> | 2018-10-20 20:40:29 +0300 |
---|---|---|
committer | Antonioya <blendergit@gmail.com> | 2018-10-20 20:40:29 +0300 |
commit | 8c9f8d6cbb3ad176d4731649b22e97344f407aa4 (patch) | |
tree | 3e89d37bab9d1febd2acb098517e6af45ad4e1c0 /source/blender | |
parent | 541d07045b79cef52bdcf8bd1d90fc60793c9872 (diff) |
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.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/draw/engines/gpencil/gpencil_engine.c | 8 | ||||
-rw-r--r-- | source/blender/editors/gpencil/gpencil_paint.c | 3 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_gpencil_types.h | 2 |
3 files changed, 11 insertions, 2 deletions
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 */ |