[Bf-blender-cvs] [8e08ffd3998] temp-gpencil-drw-engine: GPencil: New variable to check if the layer has blend

Antonioya noreply at git.blender.org
Sun Jun 30 16:54:39 CEST 2019


Commit: 8e08ffd399850bd190717a08fac8010427bf9b27
Author: Antonioya
Date:   Sun Jun 30 16:54:29 2019 +0200
Branches: temp-gpencil-drw-engine
https://developer.blender.org/rB8e08ffd399850bd190717a08fac8010427bf9b27

GPencil: New variable to check if the layer has blend

Also added some ToDo comments.

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

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_engine.c b/source/blender/draw/engines/gpencil/gpencil_engine.c
index b82b73adc32..646fb359836 100644
--- a/source/blender/draw/engines/gpencil/gpencil_engine.c
+++ b/source/blender/draw/engines/gpencil/gpencil_engine.c
@@ -571,6 +571,7 @@ static void gpencil_add_draw_data(void *vedata, Object *ob)
   GPENCIL_StorageList *stl = ((GPENCIL_Data *)vedata)->stl;
   bGPdata *gpd = (bGPdata *)ob->data;
   const bool is_multiedit = (bool)GPENCIL_MULTIEDIT_SESSIONS_ON(gpd);
+  tGPencilObjectCache_shgrp *array_elm = NULL;
 
   int i = stl->g_data->gp_cache_used - 1;
   tGPencilObjectCache *cache_ob = &stl->g_data->gp_object_cache[i];
@@ -585,6 +586,16 @@ static void gpencil_add_draw_data(void *vedata, Object *ob)
     }
   }
 
+  /* Verify if the object has layer blending */
+  cache_ob->has_layer_blend = false;
+  for (int e = 0; e < cache_ob->tot_layers; e++) {
+    array_elm = &cache_ob->shgrp_array[e];
+    if ((array_elm->mode != eGplBlendMode_Regular) || (array_elm->mask_layer)) {
+      cache_ob->has_layer_blend = true;
+      break;
+    }
+  }
+
   /* FX passses */
   cache_ob->has_fx = false;
   if ((!stl->storage->simplify_fx) && (!ELEM(cache_ob->shading_type[0], OB_WIRE, OB_SOLID)) &&
@@ -1025,6 +1036,12 @@ void GPENCIL_draw_scene(void *ved)
 
         cache_ob = &stl->g_data->gp_object_cache[i];
         Object *ob = cache_ob->ob;
+        /* TODO: To check if the object has Blend, verify the value of
+         * cache_ob->has_layer_blend
+         * Actually this variable is set to true if any layer has any blend mode
+         * different of Regular mode or the layer has the Masking enabled.
+         */
+
         /* TODO: To check if the object has VFX, verify the value of
          * cache_ob->has_fx
          */
diff --git a/source/blender/draw/engines/gpencil/gpencil_engine.h b/source/blender/draw/engines/gpencil/gpencil_engine.h
index 60bea97c67b..ee1ba805fad 100644
--- a/source/blender/draw/engines/gpencil/gpencil_engine.h
+++ b/source/blender/draw/engines/gpencil/gpencil_engine.h
@@ -84,6 +84,8 @@ typedef struct tGPencilObjectCache {
   int idx; /*original index, can change after sort */
   char *name;
 
+  bool has_layer_blend;
+
   /* effects */
   bool has_fx;
   ListBase shader_fx;



More information about the Bf-blender-cvs mailing list