[Bf-blender-cvs] [719513dd9fe] master: Tests: make mesh comparisons more strict

Jacques Lucke noreply at git.blender.org
Mon Dec 12 12:13:48 CET 2022


Commit: 719513dd9fe40a8efb12d847ed6ac3bfc6167261
Author: Jacques Lucke
Date:   Mon Dec 12 12:13:33 2022 +0100
Branches: master
https://developer.blender.org/rB719513dd9fe40a8efb12d847ed6ac3bfc6167261

Tests: make mesh comparisons more strict

Previously, it wouldn't detect the case when one mesh had an attribute
that the other one did not. Not sure if this always was the case or whether
this less strict test was implemented accidentally at some point.

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

M	source/blender/blenkernel/intern/mesh.cc

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

diff --git a/source/blender/blenkernel/intern/mesh.cc b/source/blender/blenkernel/intern/mesh.cc
index f59cd4f3a7c..1fafec810ba 100644
--- a/source/blender/blenkernel/intern/mesh.cc
+++ b/source/blender/blenkernel/intern/mesh.cc
@@ -500,14 +500,19 @@ static int customdata_compare(
 
   for (int i1 = 0; i1 < c1->totlayer; i1++) {
     l1 = c1->layers + i1;
+    if (l1->anonymous_id != nullptr) {
+      continue;
+    }
+    bool found_corresponding_layer = false;
     for (int i2 = 0; i2 < c2->totlayer; i2++) {
       l2 = c2->layers + i2;
-      if (l1->type != l2->type || !STREQ(l1->name, l2->name) || l1->anonymous_id != nullptr ||
-          l2->anonymous_id != nullptr) {
+      if (l1->type != l2->type || !STREQ(l1->name, l2->name) || l2->anonymous_id != nullptr) {
         continue;
       }
       /* At this point `l1` and `l2` have the same name and type, so they should be compared. */
 
+      found_corresponding_layer = true;
+
       switch (l1->type) {
 
         case CD_MVERT: {
@@ -719,6 +724,11 @@ static int customdata_compare(
         }
       }
     }
+    if (!found_corresponding_layer) {
+      if ((1 << l1->type) & CD_MASK_PROP_ALL) {
+        return MESHCMP_CDLAYERS_MISMATCH;
+      }
+    }
   }
 
   return 0;



More information about the Bf-blender-cvs mailing list