[Bf-blender-cvs] [578db1e1a63] greasepencil-object: GPencil: Object mode always use Vertex Paint mix

Antonio Vazquez noreply at git.blender.org
Sat Nov 30 13:47:54 CET 2019


Commit: 578db1e1a63dcf84df3c210fbd3f9a95298b08eb
Author: Antonio Vazquez
Date:   Sat Nov 30 13:47:45 2019 +0100
Branches: greasepencil-object
https://developer.blender.org/rB578db1e1a63dcf84df3c210fbd3f9a95298b08eb

GPencil: Object mode always use Vertex Paint mix

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

M	source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
M	source/blender/draw/engines/gpencil/gpencil_draw_utils.c
M	source/blender/draw/engines/gpencil/gpencil_engine.h

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

diff --git a/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c b/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
index 0826a52cbee..bdd85d85f70 100644
--- a/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
+++ b/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
@@ -160,7 +160,7 @@ void gpencil_get_point_geom(GpencilBatchCacheElem *be,
   int totvertex = gps->totpoints;
   float mix_color[4];
 
-  const float vpaint_mix = gpencil_get_vertex_paint_factor(v3d);
+  const float vpaint_mix = gpencil_get_vertex_paint_factor(ob, v3d);
   const bool attenuate = (GPENCIL_VERTEX_MODE(gpd) &&
                           GPENCIL_ANY_VERTEX_MASK(ts->gpencil_selectmode_vertex));
 
@@ -272,7 +272,7 @@ void gpencil_get_stroke_geom(struct GpencilBatchCacheElem *be,
   Object *ob = draw_ctx->obact;
   bGPdata *gpd = ob ? (bGPdata *)ob->data : NULL;
 
-  const float vpaint_mix = gpencil_get_vertex_paint_factor(v3d);
+  const float vpaint_mix = gpencil_get_vertex_paint_factor(ob, v3d);
   const bool attenuate = (GPENCIL_VERTEX_MODE(gpd) &&
                           GPENCIL_ANY_VERTEX_MASK(ts->gpencil_selectmode_vertex));
 
diff --git a/source/blender/draw/engines/gpencil/gpencil_draw_utils.c b/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
index 5ecd0342d4d..912e9f7a3d3 100644
--- a/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
+++ b/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
@@ -972,13 +972,19 @@ static DRWShadingGroup *gpencil_shgroup_point_create(GPENCIL_e_data *e_data,
 }
 
 /* Get vertex Paint factor */
-float gpencil_get_vertex_paint_factor(View3D *v3d)
+float gpencil_get_vertex_paint_factor(Object *ob, View3D *v3d)
 {
   if (v3d) {
+    /* If Object mode always use Vertex Paint mix. */
+    if ((ob) && (ob->mode == OB_MODE_OBJECT)) {
+      return 1.0f;
+    }
+
     float vpaint_mix = ((v3d->shading.type < OB_MATERIAL) &&
                         (v3d->shading.color_type == V3D_SHADING_MATERIAL_COLOR)) ?
                            0.0f :
                            v3d->overlay.gpencil_vertex_paint_opacity;
+
     return vpaint_mix;
   }
 
@@ -1001,7 +1007,7 @@ static void gpencil_add_fill_vertexdata(GpencilBatchCache *cache,
   View3D *v3d = draw_ctx->v3d;
   bGPdata *gpd = ob ? (bGPdata *)ob->data : NULL;
 
-  const float vpaint_mix = gpencil_get_vertex_paint_factor(v3d);
+  const float vpaint_mix = gpencil_get_vertex_paint_factor(ob, v3d);
   const bool attenuate = (GPENCIL_VERTEX_MODE(gpd) &&
                           GPENCIL_ANY_VERTEX_MASK(ts->gpencil_selectmode_vertex));
 
diff --git a/source/blender/draw/engines/gpencil/gpencil_engine.h b/source/blender/draw/engines/gpencil/gpencil_engine.h
index e3714d6627a..b65ca121339 100644
--- a/source/blender/draw/engines/gpencil/gpencil_engine.h
+++ b/source/blender/draw/engines/gpencil/gpencil_engine.h
@@ -465,7 +465,7 @@ struct tGPencilObjectCache *gpencil_object_cache_add(struct tGPencilObjectCache
                                                      int *gp_cache_used);
 
 bool gpencil_onion_active(struct bGPdata *gpd);
-float gpencil_get_vertex_paint_factor(struct View3D *v3d);
+float gpencil_get_vertex_paint_factor(struct Object *ob, struct View3D *v3d);
 
 /* shading groups cache functions */
 struct GpencilBatchGroup *gpencil_group_cache_add(struct GpencilBatchGroup *cache_array,



More information about the Bf-blender-cvs mailing list