diff options
author | Antonio Vazquez <blendergit@gmail.com> | 2019-09-17 14:07:29 +0300 |
---|---|---|
committer | Antonio Vazquez <blendergit@gmail.com> | 2019-09-17 14:07:29 +0300 |
commit | df5fae1fcc9a45c2a38faa1e61522afa70830346 (patch) | |
tree | a9ad479be1c390829e93094bf546340131053d68 /source/blender/editors/gpencil/gpencil_edit.c | |
parent | 271c6794d6295e0022a4088cd0bf6b0592b7abf2 (diff) |
Fix T69963: GPencil Hotkeys (1,2,3) do not work to switch Select Mode in Edit Mode
Diffstat (limited to 'source/blender/editors/gpencil/gpencil_edit.c')
-rw-r--r-- | source/blender/editors/gpencil/gpencil_edit.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/source/blender/editors/gpencil/gpencil_edit.c b/source/blender/editors/gpencil/gpencil_edit.c index 96302bcbe63..5850d0856e0 100644 --- a/source/blender/editors/gpencil/gpencil_edit.c +++ b/source/blender/editors/gpencil/gpencil_edit.c @@ -237,11 +237,38 @@ static int gpencil_selectmode_toggle_exec(bContext *C, wmOperator *op) { Scene *scene = CTX_data_scene(C); ToolSettings *ts = CTX_data_tool_settings(C); + Object *ob = CTX_data_active_object(C); const int mode = RNA_int_get(op->ptr, "mode"); + bool changed = false; + + if (ts->gpencil_selectmode_edit == mode) { + return OPERATOR_FINISHED; + } /* Just set mode */ ts->gpencil_selectmode_edit = mode; + /* If the mode is Stroke, extend selection. */ + if ((ob) && (ts->gpencil_selectmode_edit & GP_SELECTMODE_STROKE)) { + bGPdata *gpd = (bGPdata *)ob->data; + /* Extend selection to all points in all selected strokes. */ + CTX_DATA_BEGIN (C, bGPDstroke *, gps, editable_gpencil_strokes) { + if ((gps->flag & GP_STROKE_SELECT) && (gps->totpoints > 1)) { + changed = true; + bGPDspoint *pt; + for (int i = 0; i < gps->totpoints; i++) { + pt = &gps->points[i]; + pt->flag |= GP_SPOINT_SELECT; + } + } + } + CTX_DATA_END; + if (changed) { + DEG_id_tag_update(&gpd->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY); + } + } + + WM_event_add_notifier(C, NC_GPENCIL | NA_SELECTED, NULL); WM_main_add_notifier(NC_SCENE | ND_TOOLSETTINGS, NULL); DEG_id_tag_update(&scene->id, ID_RECALC_COPY_ON_WRITE); |