[Bf-blender-cvs] [ffb0ecb4985] blender-v3.1-release: Fix T91463: Separate points makes gap on cyclic stroke
Falk David
noreply at git.blender.org
Tue Feb 1 18:09:38 CET 2022
Commit: ffb0ecb4985b133af7d97d61130a93f716c31f9e
Author: Falk David
Date: Tue Feb 1 17:56:12 2022 +0100
Branches: blender-v3.1-release
https://developer.blender.org/rBffb0ecb4985b133af7d97d61130a93f716c31f9e
Fix T91463: Separate points makes gap on cyclic stroke
If an entire cyclic stroke was selected, calling "Separate by Points"
would leave a gap in the new object (making the new stroke non-cyclic).
The patch makes sure that if we separate by points and all points are
selected, we fall back to separate by stroke.
Reviewed By: antoniov
Maniphest Tasks: T91463
Differential Revision: https://developer.blender.org/D12527
===================================================================
M source/blender/editors/gpencil/gpencil_edit.c
===================================================================
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);
More information about the Bf-blender-cvs
mailing list