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:
authorAntonio Vazquez <blendergit@gmail.com>2019-08-29 11:35:22 +0300
committerAntonio Vazquez <blendergit@gmail.com>2019-08-29 11:44:24 +0300
commit6b33bd1067dc34711e0e076070cfaeaf0e3259a5 (patch)
tree47a3b976ae629114d541271051afe356a650e404
parent6b5e2f61b991633611fc6df12e0a99bc3f49c62b (diff)
GPencil: For Stroke select don't display points
Now, when it's selected the stroke select mode, the points are not displayed and the stroke is fully selected automatically extending the selection. Differential Revision: https://developer.blender.org/D5622
-rw-r--r--source/blender/draw/engines/gpencil/gpencil_draw_utils.c20
-rw-r--r--source/blender/makesrna/intern/rna_scene.c31
2 files changed, 49 insertions, 2 deletions
diff --git a/source/blender/draw/engines/gpencil/gpencil_draw_utils.c b/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
index f4b390fb4a4..bef72b9a054 100644
--- a/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
+++ b/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
@@ -944,6 +944,11 @@ static void gpencil_add_editpoints_vertexdata(GpencilBatchCache *cache,
GP_SCULPT_MASK_SELECTMODE_STROKE |
GP_SCULPT_MASK_SELECTMODE_SEGMENT)));
+ const bool show_sculpt_points = (GPENCIL_SCULPT_MODE(gpd) &&
+ (ts->gpencil_selectmode_sculpt &
+ (GP_SCULPT_MASK_SELECTMODE_POINT |
+ 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 */
@@ -955,8 +960,19 @@ static void gpencil_add_editpoints_vertexdata(GpencilBatchCache *cache,
return;
}
const bool is_weight_paint = (gpd) && (gpd->flag & GP_DATA_STROKE_WEIGHTMODE);
+
+ /* If Sculpt mode and the mask is disabled, the select must be hidden. */
const bool hide_select = GPENCIL_SCULPT_MODE(gpd) && !use_sculpt_mask;
+ /* Show Edit points if:
+ * Edit mode: Not in Stroke selection mode
+ * Sculpt mode: Not in Stroke mask mode and any other mask mode enabled
+ * Weight mode: Always
+ */
+ const bool show_points = (show_sculpt_points) || (is_weight_paint) ||
+ (GPENCIL_EDIT_MODE(gpd) &&
+ ((ts->gpencil_selectmode_edit & GP_SELECTMODE_STROKE) == 0));
+
if (cache->is_dirty) {
if ((obact == ob) && ((v3d->flag2 & V3D_HIDE_OVERLAYS) == 0) &&
(v3d->gp_flag & V3D_GP_SHOW_EDIT_LINES)) {
@@ -976,8 +992,8 @@ static void gpencil_add_editpoints_vertexdata(GpencilBatchCache *cache,
&cache->grp_used);
}
- /* In sculpt mode, the point are only visible if masking is enabled. */
- if (hide_select) {
+ /* If the points are hidden return. */
+ if ((!show_points) || (hide_select)) {
return;
}
diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c
index b4f545e3c5e..f37ee5ff817 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -749,6 +749,35 @@ static void rna_GPencilInterpolateSettings_type_set(PointerRNA *ptr, int value)
}
}
+static void rna_Gpencil_selectmode_update(bContext *C, PointerRNA *ptr)
+{
+ ToolSettings *ts = (ToolSettings *)ptr->data;
+ /* If the mode is not Stroke, don't extend selection. */
+ if ((ts->gpencil_selectmode_edit & GP_SELECTMODE_STROKE) == 0) {
+ return;
+ }
+
+ /* Extend selection to all points in all selected strokes. */
+ ViewLayer *view_layer = CTX_data_view_layer(C);
+ Object *ob = OBACT(view_layer);
+ if ((ob) && (ob->type == OB_GPENCIL)) {
+ bGPdata *gpd = (bGPdata *)ob->data;
+ CTX_DATA_BEGIN (C, bGPDstroke *, gps, editable_gpencil_strokes) {
+ if ((gps->flag & GP_STROKE_SELECT) && (gps->totpoints > 1)) {
+ bGPDspoint *pt;
+ for (int i = 0; i < gps->totpoints; i++) {
+ pt = &gps->points[i];
+ pt->flag |= GP_SPOINT_SELECT;
+ }
+ }
+ }
+ CTX_DATA_END;
+
+ gpd->flag |= GP_DATA_CACHE_IS_DIRTY;
+ DEG_id_tag_update(&gpd->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY);
+ }
+}
+
static void rna_Gpencil_mask_point_update(Main *UNUSED(bmain),
Scene *UNUSED(scene),
PointerRNA *ptr)
@@ -3119,6 +3148,8 @@ static void rna_def_tool_settings(BlenderRNA *brna)
RNA_def_property_enum_items(prop, gpencil_selectmode_items);
RNA_def_property_ui_text(prop, "Select Mode", "");
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, "rna_Gpencil_selectmode_update");
/* Grease Pencil - Select mode Sculpt */
prop = RNA_def_property(srna, "use_gpencil_select_mask_point", PROP_BOOLEAN, PROP_NONE);