mesh.validate() / BKE_mesh_validate() --- functions now check for duplicate vertices used within the same polygon.

(which would crash otherwise)
This commit is contained in:
2012-04-25 07:23:20 +00:00
parent 398cf78c25
commit 6cc48ec555

View File

@@ -240,9 +240,23 @@ int BKE_mesh_validate_arrays(Mesh *mesh,
PRINT(" loop %u has invalid vert reference (%u)\n", sp->loopstart + j, ml->v);
sp->invalid = TRUE;
}
mverts[ml->v].flag |= ME_VERT_TMP_TAG;
*v = ml->v;
}
/* is the same vertex used more then once */
if (!sp->invalid) {
v = sp->verts;
for (j = 0; j < mp->totloop; j++, v++) {
if ((mverts[*v].flag & ME_VERT_TMP_TAG) == 0) {
PRINT(" poly %u has duplicate vert reference at corner (%u)\n", i, j);
sp->invalid = TRUE;
}
mverts[*v].flag &= ~ME_VERT_TMP_TAG;
}
}
if (sp->invalid)
continue;