Fix #132241: Grease Pencil: Preserve cyclic state when extruding

When extruding from points on a cyclic stroke (in which case it creates
a new detached stroke), the original stroke should remain cyclic. This
is achieved by gathering curve attributes first then manually set non
cyclic to newly created strokes.

Pull Request: https://projects.blender.org/blender/blender/pulls/132261
This commit is contained in:
YimingWu
2025-01-08 12:35:37 +01:00
committed by YimingWu
parent 837648a79d
commit ba50d5a658

View File

@@ -2894,20 +2894,16 @@ static bke::CurvesGeometry extrude_grease_pencil_curves(const bke::CurvesGeometr
selection.span.copy_from(dst_selected.as_span());
selection.finish();
/* Cyclic attribute : newly created curves cannot be cyclic.
* NOTE: if the cyclic attribute is single and false, it can be kept this way.
*/
if (src_cyclic.get_if_single().value_or(true)) {
dst.cyclic_for_write().drop_front(old_curves_num).fill(false);
}
bke::gather_attributes(src_attributes,
bke::AttrDomain::Curve,
bke::AttrDomain::Curve,
bke::attribute_filter_from_skip_ref({"cyclic"}),
{},
dst_to_src_curves,
dst_attributes);
/* Cyclic attribute : newly created curves cannot be cyclic. */
dst.cyclic_for_write().drop_front(old_curves_num).fill(false);
bke::gather_attributes(src_attributes,
bke::AttrDomain::Point,
bke::AttrDomain::Point,