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.
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -112,6 +112,7 @@ typedef struct GPENCIL_Storage {
|
||||
bool is_playing;
|
||||
bool is_render;
|
||||
bool is_mat_preview;
|
||||
bool is_multiwindow;
|
||||
bool reset_cache;
|
||||
bool buffer_stroke;
|
||||
bool buffer_fill;
|
||||
|
||||
Reference in New Issue
Block a user