diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2022-02-01 21:25:36 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2022-02-01 21:25:36 +0300 |
commit | 2b01964e6cea2fabee585395f7b85aa8ad4837b0 (patch) | |
tree | 9c09f955fd237e0b72fc76a0156cf1ba3e318ddb /source/blender/editors/gpencil | |
parent | f39ade9e00fc24be6f45b33b391b3d6bfa6fee9f (diff) | |
parent | 83b6c8f2b1e3899680e807ced8ebd8d7ae77ce2d (diff) |
Merge branch 'blender-v3.1-release'
Diffstat (limited to 'source/blender/editors/gpencil')
-rw-r--r-- | source/blender/editors/gpencil/gpencil_edit.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/source/blender/editors/gpencil/gpencil_edit.c b/source/blender/editors/gpencil/gpencil_edit.c index e71a56894d0..afb786da8c6 100644 --- a/source/blender/editors/gpencil/gpencil_edit.c +++ b/source/blender/editors/gpencil/gpencil_edit.c @@ -4626,6 +4626,31 @@ static int gpencil_stroke_separate_exec(bContext *C, wmOperator *op) BKE_report(op->reports, RPT_ERROR, "Not implemented!"); } else { + /* Check if all points are selected. */ + bool all_points_selected = true; + for (i = 0, pt = gps->points; i < gps->totpoints; i++, pt++) { + if ((pt->flag & GP_SPOINT_SELECT) == 0) { + all_points_selected = false; + break; + } + } + + /* Separate the entrie stroke. */ + if (all_points_selected) { + /* deselect old stroke */ + gps->flag &= ~GP_STROKE_SELECT; + BKE_gpencil_stroke_select_index_reset(gps); + /* unlink from source frame */ + BLI_remlink(&gpf->strokes, gps); + gps->prev = gps->next = NULL; + /* relink to destination frame */ + BLI_addtail(&gpf_dst->strokes, gps); + /* Reassign material. */ + gps->mat_nr = idx; + + continue; + } + /* make copy of source stroke */ bGPDstroke *gps_dst = BKE_gpencil_stroke_duplicate(gps, true, true); |