[Bf-blender-cvs] [8ab98d0ed7d] blender-v2.90-release: Add versioning for 2.90 files that may have invalid mesh

Germano Cavalcante noreply at git.blender.org
Mon Sep 21 09:50:37 CEST 2020


Commit: 8ab98d0ed7d21aef1f6a259b4dc9b907f2193c1b
Author: Germano Cavalcante
Date:   Thu Sep 17 11:10:58 2020 -0300
Branches: blender-v2.90-release
https://developer.blender.org/rB8ab98d0ed7d21aef1f6a259b4dc9b907f2193c1b

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

===================================================================

M	source/blender/blenloader/intern/versioning_290.c

===================================================================

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)) {
     {



More information about the Bf-blender-cvs mailing list