diff options
author | Antonio Vazquez <blendergit@gmail.com> | 2019-08-24 18:58:14 +0300 |
---|---|---|
committer | Antonio Vazquez <blendergit@gmail.com> | 2019-08-24 18:59:32 +0300 |
commit | 6bb2912704ba23f13879affa075ea9d18211ba81 (patch) | |
tree | e7d1d5c56dfce56c8772a5921b42b5ad22befc04 | |
parent | a53ed1e0496de04619a404a2a1f47d3eb13b4365 (diff) |
GPencil: Fix unreported unable to deselect when masking is OFF
When the mask is disabled, all select operators must be disabled, but the deselect all operator must work or it's impossible to deselect.
-rw-r--r-- | source/blender/editors/gpencil/gpencil_select.c | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/source/blender/editors/gpencil/gpencil_select.c b/source/blender/editors/gpencil/gpencil_select.c index 7225bf43fbd..f4484624d5a 100644 --- a/source/blender/editors/gpencil/gpencil_select.c +++ b/source/blender/editors/gpencil/gpencil_select.c @@ -111,6 +111,19 @@ static bool gpencil_select_poll(bContext *C) /* -------------------------------------------------------------------- */ /** \name Select All Operator * \{ */ +static bool gpencil_select_all_poll(bContext *C) +{ + bGPdata *gpd = ED_gpencil_data_get_active(C); + + /* we just need some visible strokes, and to be in editmode or other modes only to catch event */ + if (GPENCIL_ANY_MODE(gpd)) { + if (gpd->layers.first) { + return true; + } + } + + return false; +} static int gpencil_select_all_exec(bContext *C, wmOperator *op) { @@ -127,6 +140,14 @@ static int gpencil_select_all_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; } + /* For sculpt mode, if mask is disable, only allows deselect */ + if (GPENCIL_SCULPT_MODE(gpd)) { + ToolSettings *ts = CTX_data_tool_settings(C); + if ((!(GPENCIL_ANY_SCULPT_MASK(ts->gpencil_selectmode_sculpt))) && (action != SEL_DESELECT)) { + return OPERATOR_CANCELLED; + } + } + ED_gpencil_select_toggle_all(C, action); /* updates */ @@ -149,7 +170,7 @@ void GPENCIL_OT_select_all(wmOperatorType *ot) /* callbacks */ ot->exec = gpencil_select_all_exec; - ot->poll = gpencil_select_poll; + ot->poll = gpencil_select_all_poll; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; |