Fix: GPv3: Conversion of edit curves not working correctly

There was a case where we wouldn't convert edit curves correctly,
specifically when the user created an edit curve
(using "Curve Editing") and then changes the stroke outside of
curve editing. This invalidates the edit curve, but does not
deallocate it.

The conversion assumed that any allocated edit curve is valid.

Now we check for the `GP_CURVE_NEEDS_STROKE_UPDATE` flag
to skip invalid edit curves (and use the stroke instead).
This commit is contained in:
Falk David
2024-07-15 17:13:32 +02:00
parent 3fcd80db68
commit 8c9df38eb9

View File

@@ -679,7 +679,10 @@ static Drawing legacy_gpencil_frame_to_grease_pencil_drawing(const bGPDframe &gp
int num_points = 0;
bool has_bezier_stroke = false;
LISTBASE_FOREACH (bGPDstroke *, gps, &gpf.strokes) {
if (gps->editcurve != nullptr) {
/* Check for a valid edit curve. This is only the case when the `editcurve` exists and wasn't
* tagged for a stroke update. This tag indicates that the stroke points have changed,
* invalidating the edit curve. */
if (gps->editcurve != nullptr && (gps->editcurve->flag & GP_CURVE_NEEDS_STROKE_UPDATE) == 0) {
if (gps->editcurve->tot_curve_points == 0) {
continue;
}