Fix: Slow versioning on files with many meshes due to unnecessary loop

Unlike most versioning helper functions, version_mesh_crease_generic
takes care of all meshes in the blend file. However, the versioning
code was looping over all meshes and calling it for each one anyways.

This doesn't do anything after the first iteration, but it results
in quadratic time complexity w.r.t. number of meshes and manages to
waste e.g. 600ms when loading the Spring benchmark file.
This commit is contained in:
Lukas Stockner
2024-07-12 03:30:14 +02:00
parent 82ca220ad4
commit 399498fdc0

View File

@@ -2799,9 +2799,7 @@ void blo_do_versions_400(FileData *fd, Library * /*lib*/, Main *bmain)
}
if (!MAIN_VERSION_FILE_ATLEAST(bmain, 400, 7)) {
LISTBASE_FOREACH (Mesh *, mesh, &bmain->meshes) {
version_mesh_crease_generic(*bmain);
}
version_mesh_crease_generic(*bmain);
}
if (!MAIN_VERSION_FILE_ATLEAST(bmain, 400, 8)) {