diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2019-04-29 12:56:54 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2019-04-30 12:34:22 +0300 |
commit | aa6a0409ebaf5bb9aa5546713be5586c2cfb7884 (patch) | |
tree | dca9faac26ba90777afaf8e65b68c18750795743 | |
parent | 9586c23d751ddacc638eab82024decbeac0b18c7 (diff) |
Select: proper handling of 'deselect on nothing' for GPencil edit mode.
Was unconditionnaly behaving that way, now use proper common setting to
control whether we should deselect everything when clicking on an empty
area.
Part of T57918.
-rw-r--r-- | release/scripts/presets/keyconfig/keymap_data/blender_default.py | 3 | ||||
-rw-r--r-- | source/blender/editors/gpencil/gpencil_select.c | 18 |
2 files changed, 13 insertions, 8 deletions
diff --git a/release/scripts/presets/keyconfig/keymap_data/blender_default.py b/release/scripts/presets/keyconfig/keymap_data/blender_default.py index c398c763d0e..5fd86d4188b 100644 --- a/release/scripts/presets/keyconfig/keymap_data/blender_default.py +++ b/release/scripts/presets/keyconfig/keymap_data/blender_default.py @@ -3027,7 +3027,8 @@ def km_grease_pencil_stroke_edit_mode(params): ("gpencil.interpolate", {"type": 'E', "value": 'PRESS', "ctrl": True, "alt": True}, None), ("gpencil.interpolate_sequence", {"type": 'E', "value": 'PRESS', "shift": True, "ctrl": True}, None), # Normal select - ("gpencil.select", {"type": params.select_mouse, "value": params.select_mouse_value}, None), + ("gpencil.select", {"type": params.select_mouse, "value": params.select_mouse_value}, + {"properties": [("deselect_all", not params.legacy)]}), # Selection *_grease_pencil_selection(params), # Duplicate and move selected points diff --git a/source/blender/editors/gpencil/gpencil_select.c b/source/blender/editors/gpencil/gpencil_select.c index b8540357cf8..ba806022d3e 100644 --- a/source/blender/editors/gpencil/gpencil_select.c +++ b/source/blender/editors/gpencil/gpencil_select.c @@ -1298,6 +1298,7 @@ static int gpencil_select_exec(bContext *C, wmOperator *op) bool deselect = RNA_boolean_get(op->ptr, "deselect"); bool toggle = RNA_boolean_get(op->ptr, "toggle"); bool whole = RNA_boolean_get(op->ptr, "entire_strokes"); + const bool deselect_all = RNA_boolean_get(op->ptr, "deselect_all"); int mval[2] = {0}; @@ -1360,15 +1361,18 @@ static int gpencil_select_exec(bContext *C, wmOperator *op) /* Abort if nothing hit... */ if (ELEM(NULL, hit_stroke, hit_point)) { + if (deselect_all) { + /* since left mouse select change, deselect all if click outside any hit */ + deselect_all_selected(C); - /* since left mouse select change, deselect all if click outside any hit */ - deselect_all_selected(C); + /* copy on write tag is needed, or else no refresh happens */ + DEG_id_tag_update(&gpd->id, ID_RECALC_GEOMETRY); + DEG_id_tag_update(&gpd->id, ID_RECALC_COPY_ON_WRITE); + WM_event_add_notifier(C, NC_GPENCIL | NA_SELECTED, NULL); + WM_event_add_notifier(C, NC_GEOM | ND_SELECT, NULL); - /* copy on write tag is needed, or else no refresh happens */ - DEG_id_tag_update(&gpd->id, ID_RECALC_GEOMETRY); - DEG_id_tag_update(&gpd->id, ID_RECALC_COPY_ON_WRITE); - WM_event_add_notifier(C, NC_GPENCIL | NA_SELECTED, NULL); - WM_event_add_notifier(C, NC_GEOM | ND_SELECT, NULL); + return OPERATOR_FINISHED; + } return OPERATOR_CANCELLED; } |