[Bf-blender-cvs] [bb8d859a680] master: GPencil: Fix unreported problem when main Onion switch is disabled

Antonio Vazquez noreply at git.blender.org
Mon Sep 9 16:20:44 CEST 2019


Commit: bb8d859a68061877d2c3ada2c182885cf89bb214
Author: Antonio Vazquez
Date:   Mon Sep 9 16:20:21 2019 +0200
Branches: master
https://developer.blender.org/rBbb8d859a68061877d2c3ada2c182885cf89bb214

GPencil: Fix unreported problem when main Onion switch is disabled

The main switch was not checked and the function was doing all calculations, but the data was not used. This makes all slower than expected because the user had the Onion Skinning disabled, but internally was running.

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

M	source/blender/draw/engines/gpencil/gpencil_draw_utils.c

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

diff --git a/source/blender/draw/engines/gpencil/gpencil_draw_utils.c b/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
index 3d1aad827c5..e8a7981cb66 100644
--- a/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
+++ b/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
@@ -2004,6 +2004,16 @@ void gpencil_populate_datablock(GPENCIL_e_data *e_data,
   bGPdata *gpd_eval = (bGPdata *)ob->data;
   bGPdata *gpd = (bGPdata *)DEG_get_original_id(&gpd_eval->id);
 
+  const bool main_onion = draw_ctx->v3d != NULL ?
+                              (draw_ctx->v3d->gp_flag & V3D_GP_SHOW_ONION_SKIN) :
+                              true;
+  const bool playing = stl->storage->is_playing;
+  const bool overlay = draw_ctx->v3d != NULL ?
+                           (bool)((draw_ctx->v3d->flag2 & V3D_HIDE_OVERLAYS) == 0) :
+                           true;
+  const bool do_onion = (bool)((gpd->flag & GP_DATA_STROKE_WEIGHTMODE) == 0) && overlay &&
+                        main_onion && !playing && gpencil_onion_active(gpd);
+
   View3D *v3d = draw_ctx->v3d;
   int cfra_eval = (int)DEG_get_ctime(draw_ctx->depsgraph);
 
@@ -2013,9 +2023,6 @@ void gpencil_populate_datablock(GPENCIL_e_data *e_data,
   float opacity;
   bGPDframe *gpf = NULL;
 
-  /* check if playing animation */
-  const bool playing = stl->storage->is_playing;
-
   GpencilBatchCache *cache = gpencil_batch_cache_get(ob, cfra_eval);
 
   /* if object is duplicate, only create shading groups */
@@ -2074,7 +2081,7 @@ void gpencil_populate_datablock(GPENCIL_e_data *e_data,
 
     /* draw onion skins */
     if (!ID_IS_LINKED(&gpd->id)) {
-      if ((gpl->onion_flag & GP_LAYER_ONIONSKIN) &&
+      if ((do_onion) && (gpl->onion_flag & GP_LAYER_ONIONSKIN) &&
           ((!playing) || (gpd->onion_flag & GP_ONION_GHOST_ALWAYS)) && (!cache_ob->is_dup_ob) &&
           (gpd->id.us <= 1)) {
         if ((!stl->storage->is_render) ||



More information about the Bf-blender-cvs mailing list