[Bf-blender-cvs] [df5fae1fcc9] master: Fix T69963: GPencil Hotkeys (1, 2, 3) do not work to switch Select Mode in Edit Mode
Antonio Vazquez
noreply at git.blender.org
Tue Sep 17 13:07:58 CEST 2019
Commit: df5fae1fcc9a45c2a38faa1e61522afa70830346
Author: Antonio Vazquez
Date: Tue Sep 17 13:07:29 2019 +0200
Branches: master
https://developer.blender.org/rBdf5fae1fcc9a45c2a38faa1e61522afa70830346
Fix T69963: GPencil Hotkeys (1,2,3) do not work to switch Select Mode in Edit Mode
===================================================================
M source/blender/editors/gpencil/gpencil_edit.c
===================================================================
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);
More information about the Bf-blender-cvs
mailing list