[Bf-blender-cvs] [d04e8f41ae9] blender2.8: Cleanup GP: Change playing field to boolean

Antonioya noreply at git.blender.org
Tue Aug 7 13:56:46 CEST 2018


Commit: d04e8f41ae9675a99eb0f7996a12ad64bd03b9cc
Author: Antonioya
Date:   Tue Aug 7 13:56:30 2018 +0200
Branches: blender2.8
https://developer.blender.org/rBd04e8f41ae9675a99eb0f7996a12ad64bd03b9cc

Cleanup GP: Change playing field to boolean

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

M	source/blender/draw/engines/gpencil/gpencil_draw_utils.c
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_draw_utils.c b/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
index 4d2942e08fd..dba5f7b9c20 100644
--- a/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
+++ b/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
@@ -754,7 +754,7 @@ static void gpencil_draw_strokes(
 	DRWShadingGroup *strokegrp;
 	float viewmatrix[4][4];
 	const bool is_multiedit = (bool)GPENCIL_MULTIEDIT_SESSIONS_ON(gpd);
-	const bool playing = (bool)stl->storage->playing;
+	const bool playing = stl->storage->is_playing;
 	const bool is_render = (bool)stl->storage->is_render;
 	const bool is_mat_preview = (bool)stl->storage->is_mat_preview;
 	const bool overlay_multiedit = v3d != NULL ? (v3d->gp_flag & V3D_GP_SHOW_MULTIEDIT_LINES) : true;
@@ -1141,7 +1141,7 @@ void DRW_gpencil_populate_multiedit(GPENCIL_e_data *e_data, void *vedata, Scene
 	cache->cache_idx = 0;
 
 	/* check if playing animation */
-	bool playing = (bool)stl->storage->playing;
+	bool playing = stl->storage->is_playing;
 
 	/* draw strokes */
 	for (bGPDlayer *gpl = gpd->layers.first; gpl; gpl = gpl->next) {
@@ -1187,7 +1187,7 @@ void DRW_gpencil_populate_datablock(GPENCIL_e_data *e_data, void *vedata, Scene
 	const bool overlay = v3d != NULL ? (bool)((v3d->flag2 & V3D_RENDER_OVERRIDE) == 0) : true;
 
 	/* check if playing animation */
-	bool playing = (bool)stl->storage->playing;
+	bool playing = stl->storage->is_playing;
 
 	GpencilBatchCache *cache = gpencil_batch_cache_get(ob, cfra_eval);
 	cache->cache_idx = 0;
diff --git a/source/blender/draw/engines/gpencil/gpencil_engine.c b/source/blender/draw/engines/gpencil/gpencil_engine.c
index ae1f853d87c..668869a2f89 100644
--- a/source/blender/draw/engines/gpencil/gpencil_engine.c
+++ b/source/blender/draw/engines/gpencil/gpencil_engine.c
@@ -327,9 +327,9 @@ void GPENCIL_cache_init(void *vedata)
 		        DRW_STATE_WRITE_COLOR | DRW_STATE_BLEND);
 
 		/* detect if playing animation */
-		stl->storage->playing = 0;
+		stl->storage->is_playing = false;
 		if (draw_ctx->evil_C) {
-			stl->storage->playing = ED_screen_animation_playing(CTX_wm_manager(draw_ctx->evil_C)) != NULL ? 1 : 0;
+			stl->storage->is_playing = ED_screen_animation_playing(CTX_wm_manager(draw_ctx->evil_C)) != NULL ? true : false;
 		}
 
 		if (obact_gpd) {
@@ -337,7 +337,7 @@ void GPENCIL_cache_init(void *vedata)
 			* and this produces errors. To be sure, we set cache as dirty because the frame
 			* is changing.
 			*/
-			if (stl->storage->playing == 1) {
+			if (stl->storage->is_playing == true) {
 				obact_gpd->flag |= GP_DATA_CACHE_IS_DIRTY;
 			}
 			/* if render, set as dirty to update all data */
@@ -351,9 +351,9 @@ void GPENCIL_cache_init(void *vedata)
 		stl->storage->is_mat_preview = (bool)stl->storage->is_render && STREQ(scene->id.name + 2, "preview");
 
 		/* save simplify flags (can change while drawing, so it's better to save) */
-		stl->storage->simplify_fill = GP_SIMPLIFY_FILL(scene, stl->storage->playing);
-		stl->storage->simplify_modif = GP_SIMPLIFY_MODIF(scene, stl->storage->playing);
-		stl->storage->simplify_fx = GP_SIMPLIFY_FX(scene, stl->storage->playing);
+		stl->storage->simplify_fill = GP_SIMPLIFY_FILL(scene, stl->storage->is_playing);
+		stl->storage->simplify_modif = GP_SIMPLIFY_MODIF(scene, stl->storage->is_playing);
+		stl->storage->simplify_fx = GP_SIMPLIFY_FX(scene, stl->storage->is_playing);
 
 		/* save pixsize */
 		stl->storage->pixsize = DRW_viewport_pixelsize_get();
@@ -364,7 +364,7 @@ void GPENCIL_cache_init(void *vedata)
 		/* detect if painting session */
 		if ((obact_gpd) &&
 		    (obact_gpd->flag & GP_DATA_STROKE_PAINTMODE) &&
-		    (stl->storage->playing == 0))
+		    (stl->storage->is_playing == false))
 		{
 			if (((obact_gpd->runtime.sbuffer_sflag & GP_STROKE_ERASER) == 0) &&
 			    (obact_gpd->runtime.sbuffer_size > 1))
@@ -637,7 +637,7 @@ void GPENCIL_draw_scene(void *ved)
 	const DRWContextState *draw_ctx = DRW_context_state_get();
 	View3D *v3d = draw_ctx->v3d;
 	Object *obact = draw_ctx->obact;
-	const bool playing = (bool)stl->storage->playing;
+	const bool playing = stl->storage->is_playing;
 	const bool is_render = stl->storage->is_render;
 
 	/* paper pass to display a confortable area to draw over complex scenes with geometry */
diff --git a/source/blender/draw/engines/gpencil/gpencil_engine.h b/source/blender/draw/engines/gpencil/gpencil_engine.h
index 96a82e91010..738b04337c1 100644
--- a/source/blender/draw/engines/gpencil/gpencil_engine.h
+++ b/source/blender/draw/engines/gpencil/gpencil_engine.h
@@ -105,7 +105,7 @@ typedef struct GPENCIL_Storage {
 	int keep_size;
 	float obj_scale;
 	float pixfactor;
-	int playing;
+	bool is_playing;
 	bool is_render;
 	bool is_mat_preview;
 	const float *pixsize;



More information about the Bf-blender-cvs mailing list