diff options
author | Philipp Oeser <info@graphics-engineer.com> | 2021-05-14 19:10:12 +0300 |
---|---|---|
committer | Philipp Oeser <info@graphics-engineer.com> | 2021-05-14 19:10:12 +0300 |
commit | 7efe92f63b4bb68bb46edc2fad66282d5acceed6 (patch) | |
tree | 59f6ac7de2c782f92093b93c866334919f8150c1 /source/blender/editors/gpencil/gpencil_edit.c | |
parent | f6cb9433d45a5504ffba17d0971e9b23b3632a54 (diff) | |
parent | c3e13d5a2b8e9ada467850b4629dc4f228a2b2b8 (diff) |
Merge branch 'blender-v2.93-release'
Conflicts:
source/blender/editors/object/object_add.c
Diffstat (limited to 'source/blender/editors/gpencil/gpencil_edit.c')
-rw-r--r-- | source/blender/editors/gpencil/gpencil_edit.c | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/source/blender/editors/gpencil/gpencil_edit.c b/source/blender/editors/gpencil/gpencil_edit.c index dde8d31492a..e65afa1abff 100644 --- a/source/blender/editors/gpencil/gpencil_edit.c +++ b/source/blender/editors/gpencil/gpencil_edit.c @@ -4544,6 +4544,9 @@ static int gpencil_stroke_separate_exec(bContext *C, wmOperator *op) eGP_SeparateModes mode = RNA_enum_get(op->ptr, "mode"); + const bool is_multiedit = (bool)GPENCIL_MULTIEDIT_SESSIONS_ON(gpd_src); + const bool is_curve_edit = (bool)GPENCIL_CURVE_EDIT_SESSIONS_ON(gpd_src); + /* sanity checks */ if (ELEM(NULL, gpd_src)) { return OPERATOR_CANCELLED; @@ -4554,8 +4557,22 @@ static int gpencil_stroke_separate_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; } - const bool is_multiedit = (bool)GPENCIL_MULTIEDIT_SESSIONS_ON(gpd_src); - const bool is_curve_edit = (bool)GPENCIL_CURVE_EDIT_SESSIONS_ON(gpd_src); + /* Cancel if nothing selected. */ + if (ELEM(mode, GP_SEPARATE_POINT, GP_SEPARATE_STROKE)) { + bool has_selected = false; + CTX_DATA_BEGIN (C, bGPDlayer *, gpl, editable_gpencil_layers) { + if (ED_gpencil_layer_has_selected_stroke(gpl, is_multiedit)) { + has_selected = true; + break; + } + } + CTX_DATA_END; + + if (!has_selected) { + BKE_report(op->reports, RPT_ERROR, "Nothing selected"); + return OPERATOR_CANCELLED; + } + } /* Create a new object. */ /* Take into account user preferences for duplicating actions. */ |