diff options
author | Antonio Vazquez <blendergit@gmail.com> | 2019-09-09 17:20:21 +0300 |
---|---|---|
committer | Antonio Vazquez <blendergit@gmail.com> | 2019-09-09 17:20:40 +0300 |
commit | bb8d859a68061877d2c3ada2c182885cf89bb214 (patch) | |
tree | fa3ec370cb957fe1c15f0c98ef519475b80ce359 /source | |
parent | 3d2b0c9b4069b409b79a9761e9642f6bffcfd937 (diff) |
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.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/draw/engines/gpencil/gpencil_draw_utils.c | 15 |
1 files changed, 11 insertions, 4 deletions
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) || |