Add versioning for 2.90 files that may have invalid mesh

rBf2d26409e83b fixed a serious problem with invalid mesh after an
operation with the extrude manifold.

Since BKE_mesh_validate_arrays is a slow operation, the chosen
interval between versions is relatively small and also only the
mentioned invalid mesh problem is tested.

Differential Revision: https://developer.blender.org/D8898
This commit is contained in:
Germano Cavalcante 2020-09-17 11:10:58 -03:00
parent 82bd1287dd
commit 3a92a2df45
Notes: blender-bot 2023-06-07 10:31:13 +02:00
Referenced by issue #80396, Potential candidates for corrective releases
1 changed files with 29 additions and 0 deletions

View File

@ -34,6 +34,7 @@
#include "DNA_gpencil_types.h"
#include "DNA_hair_types.h"
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
#include "DNA_modifier_types.h"
#include "DNA_object_types.h"
#include "DNA_pointcloud_types.h"
@ -46,6 +47,7 @@
#include "BKE_gpencil.h"
#include "BKE_lib_id.h"
#include "BKE_main.h"
#include "BKE_mesh.h"
#include "BKE_node.h"
#include "MEM_guardedalloc.h"
@ -328,6 +330,33 @@ void blo_do_versions_290(FileData *fd, Library *UNUSED(lib), Main *bmain)
{
UNUSED_VARS(fd);
if (MAIN_VERSION_ATLEAST(bmain, 290, 2) && MAIN_VERSION_OLDER(bmain, 291, 1)) {
/* In this range, the extrude manifold could generate meshes with degenerated face. */
LISTBASE_FOREACH (Mesh *, me, &bmain->meshes) {
for (MPoly *mp = me->mpoly, *mp_end = mp + me->totpoly; mp < mp_end; mp++) {
if (mp->totloop == 2) {
bool changed;
BKE_mesh_validate_arrays(me,
me->mvert,
me->totvert,
me->medge,
me->totedge,
me->mface,
me->totface,
me->mloop,
me->totloop,
me->mpoly,
me->totpoly,
me->dvert,
false,
true,
&changed);
break;
}
}
}
}
/** Repair files from duplicate brushes added to blend files, see: T76738. */
if (!MAIN_VERSION_ATLEAST(bmain, 290, 2)) {
{