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 /source/blender | |
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.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/editors/gpencil/gpencil_select.c | 18 |
1 files changed, 11 insertions, 7 deletions
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; } |