diff options
author | Germano Cavalcante <germano.costa@ig.com.br> | 2020-09-17 17:10:58 +0300 |
---|---|---|
committer | Germano Cavalcante <germano.costa@ig.com.br> | 2020-09-17 17:10:58 +0300 |
commit | 3a92a2df451958d84989484c0c3766c759e03581 (patch) | |
tree | 816cd3b9c1cfb36f3d99434f376fbe05b0db2f54 /source | |
parent | 82bd1287dd046650ff223edd0d54c43814945dc1 (diff) |
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
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenloader/intern/versioning_290.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/source/blender/blenloader/intern/versioning_290.c b/source/blender/blenloader/intern/versioning_290.c index a975a592b5c..022a720b2ef 100644 --- a/source/blender/blenloader/intern/versioning_290.c +++ b/source/blender/blenloader/intern/versioning_290.c @@ -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)) { { |