[Bf-blender-cvs] [e6766287d60] blender2.8: Fix T56827: Crash when enable onion skin in multiwindow

Antonioya noreply at git.blender.org
Tue Sep 18 23:19:02 CEST 2018


Commit: e6766287d60fbcd4778779e244831cfbd3fd27a1
Author: Antonioya
Date:   Tue Sep 18 23:18:48 2018 +0200
Branches: blender2.8
https://developer.blender.org/rBe6766287d60fbcd4778779e244831cfbd3fd27a1

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.

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

M	source/blender/draw/engines/gpencil/gpencil_engine.c
M	source/blender/draw/engines/gpencil/gpencil_engine.h

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

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;
diff --git a/source/blender/draw/engines/gpencil/gpencil_engine.h b/source/blender/draw/engines/gpencil/gpencil_engine.h
index eeec16838ec..066ab95c443 100644
--- a/source/blender/draw/engines/gpencil/gpencil_engine.h
+++ b/source/blender/draw/engines/gpencil/gpencil_engine.h
@@ -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;



More information about the Bf-blender-cvs mailing list