diff options
-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; |