Fix #120559: GPv3: Rendering issue if single point curve is set to cyclic

Caused by ca0b02aa96.
The `points.size() > 1` was added because we can't access
`lengths[points.size() - 1]` if the curve has a single point.
The fix just makes sure we default to a `u` value of `0.0f`
for single point cyclic curves.

Pull Request: https://projects.blender.org/blender/blender/pulls/120565
This commit is contained in:
Falk David 2024-04-12 13:19:53 +02:00 committed by Falk David
parent ff625b79f6
commit 196954dc66

@ -631,9 +631,10 @@ static void grease_pencil_geom_batch_ensure(Object &object,
cols_slice[idx]);
}
if (is_cyclic && points.size() > 1) {
if (is_cyclic) {
const int idx = points.size() + 1;
const float u_stroke = u_scale * lengths[points.size() - 1] + u_translation;
const float u = points.size() > 1 ? lengths[points.size() - 1] : 0.0f;
const float u_stroke = u_scale * u + u_translation;
populate_point(verts_range,
curve_i,
start_caps[curve_i],