Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntonioya <blendergit@gmail.com>2018-12-10 12:41:47 +0300
committerAntonioya <blendergit@gmail.com>2018-12-10 22:17:49 +0300
commitbcb5293b9b8094d842d74bd7ac9ce98d6b773555 (patch)
tree22d40011b3f52751575b92328a8892c1041d791a /source/blender/draw
parent9def295d5765057796619f4d4534a15fcaa75096 (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/draw')
-rw-r--r--source/blender/draw/engines/gpencil/gpencil_cache_utils.c2
-rw-r--r--source/blender/draw/engines/gpencil/gpencil_draw_utils.c20
-rw-r--r--source/blender/draw/engines/gpencil/gpencil_engine.h2
3 files changed, 20 insertions, 4 deletions
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,