Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGermano Cavalcante <germano.costa@ig.com.br>2020-09-17 17:10:58 +0300
committerJeroen Bakker <jeroen@blender.org>2020-09-21 10:40:01 +0300
commit8ab98d0ed7d21aef1f6a259b4dc9b907f2193c1b (patch)
tree5dca4a11ebe4f0906a6e6a01dea684a28d0939a0
parent0f72e7c3ebb188001b29a54650272ab2fd3d9074 (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
-rw-r--r--source/blender/blenloader/intern/versioning_290.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/source/blender/blenloader/intern/versioning_290.c b/source/blender/blenloader/intern/versioning_290.c
index 84eee6c1d90..e7da180cb12 100644
--- a/source/blender/blenloader/intern/versioning_290.c
+++ b/source/blender/blenloader/intern/versioning_290.c
@@ -29,6 +29,8 @@
#include "DNA_genfile.h"
#include "DNA_gpencil_modifier_types.h"
#include "DNA_gpencil_types.h"
+#include "DNA_mesh_types.h"
+#include "DNA_meshdata_types.h"
#include "DNA_modifier_types.h"
#include "DNA_object_force_types.h"
#include "DNA_object_types.h"
@@ -41,6 +43,7 @@
#include "BKE_gpencil.h"
#include "BKE_lib_id.h"
#include "BKE_main.h"
+#include "BKE_mesh.h"
#include "BKE_node.h"
#include "BLO_readfile.h"
@@ -257,6 +260,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)) {
{