[Bf-blender-cvs] [b876fe3f3d1] master: GPencil: Show edit points in Sculpt only if mask is enabled

Antonio Vazquez noreply at git.blender.org
Sun Aug 25 20:56:13 CEST 2019


Commit: b876fe3f3d1f6f5017cff06f873acc9750b28179
Author: Antonio Vazquez
Date:   Sun Aug 25 20:55:56 2019 +0200
Branches: master
https://developer.blender.org/rBb876fe3f3d1f6f5017cff06f873acc9750b28179

GPencil: Show edit points in Sculpt only if mask is enabled

If the masks are disabled, the edit points must not visible.

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

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 1ec02cac109..541a9e31586 100644
--- a/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
+++ b/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
@@ -821,7 +821,7 @@ void gpencil_get_edit_geom(struct GpencilBatchCacheElem *be,
 void gpencil_get_edlin_geom(struct GpencilBatchCacheElem *be,
                             bGPDstroke *gps,
                             float alpha,
-                            short UNUSED(dflag))
+                            const bool hide_select)
 {
   const DRWContextState *draw_ctx = DRW_context_state_get();
   Object *ob = draw_ctx->obact;
@@ -866,7 +866,7 @@ void gpencil_get_edlin_geom(struct GpencilBatchCacheElem *be,
       copy_v4_v4(fcolor, selectColor);
     }
     else {
-      if (pt->flag & GP_SPOINT_SELECT) {
+      if ((pt->flag & GP_SPOINT_SELECT) && (!hide_select)) {
         copy_v4_v4(fcolor, selectColor);
       }
       else {
diff --git a/source/blender/draw/engines/gpencil/gpencil_draw_utils.c b/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
index e043ac9a563..93040afe2c7 100644
--- a/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
+++ b/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
@@ -938,6 +938,12 @@ static void gpencil_add_editpoints_vertexdata(GpencilBatchCache *cache,
 {
   const DRWContextState *draw_ctx = DRW_context_state_get();
   View3D *v3d = draw_ctx->v3d;
+  ToolSettings *ts = draw_ctx->scene->toolsettings;
+  const bool use_sculpt_mask = (GPENCIL_SCULPT_MODE(gpd) && (ts->gpencil_selectmode_sculpt &
+                                                             (GP_SCULPT_MASK_SELECTMODE_POINT |
+                                                              GP_SCULPT_MASK_SELECTMODE_STROKE |
+                                                              GP_SCULPT_MASK_SELECTMODE_SEGMENT)));
+
   MaterialGPencilStyle *gp_style = BKE_material_gpencil_settings_get(ob, gps->mat_nr + 1);
 
   /* alpha factor for edit points/line to make them more subtle */
@@ -949,12 +955,14 @@ static void gpencil_add_editpoints_vertexdata(GpencilBatchCache *cache,
       return;
     }
     const bool is_weight_paint = (gpd) && (gpd->flag & GP_DATA_STROKE_WEIGHTMODE);
+    const bool hide_select = GPENCIL_SCULPT_MODE(gpd) && !use_sculpt_mask;
 
     if (cache->is_dirty) {
       if ((obact == ob) && ((v3d->flag2 & V3D_HIDE_OVERLAYS) == 0) &&
           (v3d->gp_flag & V3D_GP_SHOW_EDIT_LINES)) {
+
         /* line of the original stroke */
-        gpencil_get_edlin_geom(&cache->b_edlin, gps, edit_alpha, gpd->flag);
+        gpencil_get_edlin_geom(&cache->b_edlin, gps, edit_alpha, hide_select);
 
         /* add to list of groups */
         cache->grp_cache = gpencil_group_cache_add(cache->grp_cache,
@@ -967,6 +975,12 @@ static void gpencil_add_editpoints_vertexdata(GpencilBatchCache *cache,
                                                    &cache->grp_size,
                                                    &cache->grp_used);
       }
+
+      /* In sculpt mode, the point are only visible if masking is enabled. */
+      if (hide_select) {
+        return;
+      }
+
       /* edit points */
       if ((gps->flag & GP_STROKE_SELECT) || (is_weight_paint)) {
         if ((gpl->flag & GP_LAYER_UNLOCK_COLOR) ||
diff --git a/source/blender/draw/engines/gpencil/gpencil_engine.h b/source/blender/draw/engines/gpencil/gpencil_engine.h
index ed71cdbb9e8..f29e83f64cf 100644
--- a/source/blender/draw/engines/gpencil/gpencil_engine.h
+++ b/source/blender/draw/engines/gpencil/gpencil_engine.h
@@ -437,7 +437,7 @@ void gpencil_get_edit_geom(struct GpencilBatchCacheElem *be,
 void gpencil_get_edlin_geom(struct GpencilBatchCacheElem *be,
                             struct bGPDstroke *gps,
                             float alpha,
-                            short dflag);
+                            const bool hide_select);
 
 struct GPUBatch *gpencil_get_buffer_stroke_geom(struct bGPdata *gpd, short thickness);
 struct GPUBatch *gpencil_get_buffer_fill_geom(struct bGPdata *gpd);



More information about the Bf-blender-cvs mailing list