Fix #104824: GPencil natural drawing building with 1 subdivision very slow

1. Changes the subdivision function to not fill in time but add 0 to fix bug #104824
2. Fixes a bug in sanitization function noticed while fixing this bug.

Pull Request #105306
This commit is contained in:
Marc Chéhab 2023-03-01 10:09:23 +01:00 committed by Antonio Vazquez
parent 337e68aeb5
commit 52064bf5da
2 changed files with 2 additions and 2 deletions

@ -2270,7 +2270,7 @@ void BKE_gpencil_stroke_subdivide(bGPdata *gpd, bGPDstroke *gps, int level, int
pt_final->uv_fac = interpf(pt->uv_fac, next->uv_fac, 0.5f);
interp_v4_v4v4(pt_final->uv_fill, pt->uv_fill, next->uv_fill, 0.5f);
CLAMP(pt_final->strength, GPENCIL_STRENGTH_MIN, 1.0f);
pt_final->time = interpf(pt->time, next->time, 0.5f);
pt_final->time = 0;
pt_final->runtime.pt_orig = nullptr;
pt_final->flag = 0;
interp_v4_v4v4(pt_final->vert_color, pt->vert_color, next->vert_color, 0.5f);

@ -384,7 +384,7 @@ static void build_sequential(Object *ob,
/* Cycling backwards through zero-points to fix them. */
for (int k = 0; k < zeropoints; k++) {
float linear_fill = interpf(
deltatime, 0, ((float)k + 1) / (zeropoints + 1)); /* Factor = Proportion. */
0, deltatime, ((float)k + 1) / (zeropoints + 1)); /* Factor = Proportion. */
idx_times[curpoint - k - 1] = sumtime + linear_fill;
}
}