From 64bb63dcb026ebe0e60525ea59306fc7b6bf2c20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20T=C3=B6nne?= Date: Mon, 4 Mar 2024 10:57:17 +0100 Subject: [PATCH] Fix #118962: Skip setting not taken into account looping over points The GPv3 envelope modifier was computing the correct number of strokes to generate, but then not actually skipping over points. Result is that all envelope strokes got added at the beginning instead of the whole point range. Pull Request: https://projects.blender.org/blender/blender/pulls/119023 --- .../modifiers/intern/MOD_grease_pencil_envelope.cc | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/source/blender/modifiers/intern/MOD_grease_pencil_envelope.cc b/source/blender/modifiers/intern/MOD_grease_pencil_envelope.cc index c11a53a44fd..86497d2e335 100644 --- a/source/blender/modifiers/intern/MOD_grease_pencil_envelope.cc +++ b/source/blender/modifiers/intern/MOD_grease_pencil_envelope.cc @@ -482,16 +482,17 @@ static void create_envelope_strokes_for_curve(const EnvelopeInfo &info, * Each span only gets added once since it repeats for neighboring points. */ - for (const int i : IndexRange(num_strokes)) { - const IndexRange dst_envelope_points = {i * info.points_per_curve, info.points_per_curve}; + for (const int dst_i : IndexRange(num_strokes)) { + const int src_i = dst_i * (1 + info.skip); + const IndexRange dst_envelope_points = {dst_i * info.points_per_curve, info.points_per_curve}; - curve_offsets[i] = dst_points[dst_envelope_points.start()]; - material_indices[i] = info.material_index >= 0 ? info.material_index : + curve_offsets[dst_i] = dst_points[dst_envelope_points.start()]; + material_indices[dst_i] = info.material_index >= 0 ? info.material_index : src_material_indices[src_curve_index]; create_envelope_stroke_for_point(src_curve_points, src_curve_cyclic, - i, + src_i, spread, base_length, point_src_indices.slice(dst_envelope_points));