diff options
author | Antonio Vazquez <blendergit@gmail.com> | 2019-08-29 11:35:22 +0300 |
---|---|---|
committer | Antonio Vazquez <blendergit@gmail.com> | 2019-08-29 11:44:24 +0300 |
commit | 6b33bd1067dc34711e0e076070cfaeaf0e3259a5 (patch) | |
tree | 47a3b976ae629114d541271051afe356a650e404 /source/blender/makesrna | |
parent | 6b5e2f61b991633611fc6df12e0a99bc3f49c62b (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
Diffstat (limited to 'source/blender/makesrna')
-rw-r--r-- | source/blender/makesrna/intern/rna_scene.c | 31 |
1 files changed, 31 insertions, 0 deletions
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); |