diff options
author | Antonioya <blendergit@gmail.com> | 2018-12-10 12:41:47 +0300 |
---|---|---|
committer | Antonioya <blendergit@gmail.com> | 2018-12-10 22:17:49 +0300 |
commit | bcb5293b9b8094d842d74bd7ac9ce98d6b773555 (patch) | |
tree | 22d40011b3f52751575b92328a8892c1041d791a /source/blender | |
parent | 9def295d5765057796619f4d4534a15fcaa75096 (diff) |
GP: Enable Object Onion Skin by default
Now, the main switchis on, and the layer onion skin is off.
Diffstat (limited to 'source/blender')
4 files changed, 22 insertions, 7 deletions
diff --git a/source/blender/blenkernel/intern/gpencil.c b/source/blender/blenkernel/intern/gpencil.c index dd1a2520991..2753a5adbaa 100644 --- a/source/blender/blenkernel/intern/gpencil.c +++ b/source/blender/blenkernel/intern/gpencil.c @@ -381,8 +381,6 @@ bGPDlayer *BKE_gpencil_layer_addnew(bGPdata *gpd, const char *name, bool setacti /* thickness parameter represents "thickness change", not absolute thickness */ gpl->thickness = 0; gpl->opacity = 1.0f; - /* onion-skinning settings */ - gpl->onion_flag |= GP_LAYER_ONIONSKIN; } /* auto-name */ @@ -415,7 +413,8 @@ bGPdata *BKE_gpencil_data_addnew(Main *bmain, const char name[]) /* general flags */ gpd->flag |= GP_DATA_VIEWALIGN; gpd->flag |= GP_DATA_STROKE_FORCE_RECALC; - + /* always enable object onion skin swith */ + gpd->flag |= GP_DATA_SHOW_ONIONSKINS; /* GP object specific settings */ ARRAY_SET_ITEMS(gpd->line_color, 0.6f, 0.6f, 0.6f, 0.5f); diff --git a/source/blender/draw/engines/gpencil/gpencil_cache_utils.c b/source/blender/draw/engines/gpencil/gpencil_cache_utils.c index 5478c4a60b9..63af8ecc141 100644 --- a/source/blender/draw/engines/gpencil/gpencil_cache_utils.c +++ b/source/blender/draw/engines/gpencil/gpencil_cache_utils.c @@ -186,7 +186,7 @@ static bool gpencil_batch_cache_valid(GpencilBatchCache *cache, bGPdata *gpd, in else if (gpd->flag & GP_DATA_CACHE_IS_DIRTY) { valid = false; } - else if (gpd->flag & GP_DATA_SHOW_ONIONSKINS) { + else if (DRW_gpencil_onion_active(gpd)) { /* if onion, set as dirty always * This reduces performance, but avoid any crash in the multiple * overlay and multiwindow options and keep all windows working diff --git a/source/blender/draw/engines/gpencil/gpencil_draw_utils.c b/source/blender/draw/engines/gpencil/gpencil_draw_utils.c index eaae8033b8b..a0e9d124e6b 100644 --- a/source/blender/draw/engines/gpencil/gpencil_draw_utils.c +++ b/source/blender/draw/engines/gpencil/gpencil_draw_utils.c @@ -366,6 +366,20 @@ static DRWShadingGroup *DRW_gpencil_shgroup_fill_create( return grp; } +/* check if some onion is enabled */ +bool DRW_gpencil_onion_active(bGPdata *gpd) +{ + if ((gpd->flag & GP_DATA_SHOW_ONIONSKINS) == 0) { + return false; + } + for (bGPDlayer *gpl = gpd->layers.first; gpl; gpl = gpl->next) { + if (gpl->onion_flag & GP_LAYER_ONIONSKIN) { + return true; + } + } + return false; +} + /* create shading group for strokes */ DRWShadingGroup *DRW_gpencil_shgroup_stroke_create( GPENCIL_e_data *e_data, GPENCIL_Data *vedata, DRWPass *pass, GPUShader *shader, Object *ob, @@ -1499,7 +1513,8 @@ void DRW_gpencil_populate_datablock( bGPDframe *derived_gpf = NULL; const bool main_onion = v3d != NULL ? (v3d->gp_flag & V3D_GP_SHOW_ONION_SKIN) : true; - const bool do_onion = (bool)((gpd->flag & GP_DATA_STROKE_WEIGHTMODE) == 0) && main_onion; + const bool do_onion = (bool)((gpd->flag & GP_DATA_STROKE_WEIGHTMODE) == 0) && + main_onion && DRW_gpencil_onion_active(gpd); const bool overlay = v3d != NULL ? (bool)((v3d->flag2 & V3D_RENDER_OVERRIDE) == 0) : true; const bool time_remap = BKE_gpencil_has_time_modifiers(ob); @@ -1585,8 +1600,7 @@ void DRW_gpencil_populate_datablock( /* draw onion skins */ if (!ID_IS_LINKED(&gpd->id)) { - if ((gpd->flag & GP_DATA_SHOW_ONIONSKINS) && - (do_onion) && (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)) { diff --git a/source/blender/draw/engines/gpencil/gpencil_engine.h b/source/blender/draw/engines/gpencil/gpencil_engine.h index b8b526cb873..4aaf81ea5fd 100644 --- a/source/blender/draw/engines/gpencil/gpencil_engine.h +++ b/source/blender/draw/engines/gpencil/gpencil_engine.h @@ -385,6 +385,8 @@ struct tGPencilObjectCache *gpencil_object_cache_add( struct tGPencilObjectCache *cache_array, struct Object *ob, int *gp_cache_size, int *gp_cache_used); +bool DRW_gpencil_onion_active(struct bGPdata *gpd); + /* shading groups cache functions */ struct GpencilBatchGroup *gpencil_group_cache_add( struct GpencilBatchGroup *cache_array, |