diff options
author | Antonioya <blendergit@gmail.com> | 2018-09-19 00:18:48 +0300 |
---|---|---|
committer | Antonioya <blendergit@gmail.com> | 2018-09-19 00:18:48 +0300 |
commit | e6766287d60fbcd4778779e244831cfbd3fd27a1 (patch) | |
tree | 006ccec31e192fe11eba38c79c5b32f95a86204d /source/blender/draw/engines/gpencil/gpencil_engine.c | |
parent | ad5067193701651be9cec5c2b1e5c51018dd4bb4 (diff) |
Fix T56827: Crash when enable onion skin in multiwindow
The problem was the cache was not set as dirty if one of the window had the overlay disabled.
Diffstat (limited to 'source/blender/draw/engines/gpencil/gpencil_engine.c')
-rw-r--r-- | source/blender/draw/engines/gpencil/gpencil_engine.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/source/blender/draw/engines/gpencil/gpencil_engine.c b/source/blender/draw/engines/gpencil/gpencil_engine.c index aa033dd36e0..3198c856f10 100644 --- a/source/blender/draw/engines/gpencil/gpencil_engine.c +++ b/source/blender/draw/engines/gpencil/gpencil_engine.c @@ -47,6 +47,8 @@ #include "ED_screen.h" #include "ED_gpencil.h" +#include "WM_api.h" + extern char datatoc_gpencil_fill_vert_glsl[]; extern char datatoc_gpencil_fill_frag_glsl[]; extern char datatoc_gpencil_stroke_vert_glsl[]; @@ -287,6 +289,7 @@ void GPENCIL_cache_init(void *vedata) GPENCIL_PassList *psl = ((GPENCIL_Data *)vedata)->psl; GPENCIL_StorageList *stl = ((GPENCIL_Data *)vedata)->stl; const DRWContextState *draw_ctx = DRW_context_state_get(); + wmWindowManager *wm = NULL; Scene *scene = draw_ctx->scene; View3D *v3d = draw_ctx->v3d; @@ -337,8 +340,13 @@ void GPENCIL_cache_init(void *vedata) "GPencil Edit Pass", DRW_STATE_WRITE_COLOR | DRW_STATE_BLEND); - /* detect if playing animation */ + /* detect if playing animation and multiwindow */ if (draw_ctx->evil_C) { + wm = CTX_wm_manager(draw_ctx->evil_C); + if ((wm) && (wm->windows.first != wm->windows.last)) { + stl->storage->is_multiwindow = true; + } + bool playing = ED_screen_animation_playing(CTX_wm_manager(draw_ctx->evil_C)) != NULL; if (playing != stl->storage->is_playing) { stl->storage->reset_cache = true; @@ -348,6 +356,7 @@ void GPENCIL_cache_init(void *vedata) else { stl->storage->is_playing = false; stl->storage->reset_cache = false; + stl->storage->is_multiwindow = false; } /* save render state */ stl->storage->is_render = DRW_state_is_image_render(); @@ -559,6 +568,13 @@ void GPENCIL_cache_populate(void *vedata, Object *ob) if (ob->type == OB_GPENCIL && ob->data) { bGPdata *gpd = (bGPdata *)ob->data; + /* if multiwindow and onion, set as dirty */ + if ((stl->storage->is_multiwindow) && + (gpd->flag & (GP_DATA_SHOW_ONIONSKINS | GP_ONION_GHOST_ALWAYS))) + { + gpd->flag |= GP_DATA_CACHE_IS_DIRTY; + } + /* when start/stop animation the cache must be set as dirty to reset all data */ if (stl->storage->reset_cache) { gpd->flag |= GP_DATA_CACHE_IS_DIRTY; |