Alembic import: fixed mesh corruption when changing topology

When the mesh changed topology but kept the vertex count the same, it would
result in a corrupt mesh. By checking the face & loop counts too, this has
become less likely.

I've checked IPolyMeshSchema::isConstant(), but it returns true even when
we see that the mesh changed topology.
This commit is contained in:
Sybren A. Stüvel 2017-10-29 13:55:42 +01:00 committed by Bastien Montagne
parent 02bac54fa9
commit bae796f0d5
1 changed files with 4 additions and 1 deletions

View File

@ -1082,7 +1082,10 @@ DerivedMesh *AbcMeshReader::read_derivedmesh(DerivedMesh *dm,
ImportSettings settings;
settings.read_flag |= read_flag;
if (dm->getNumVerts(dm) != positions->size()) {
bool topology_changed = positions->size() != dm->getNumVerts(dm) ||
face_counts->size() != dm->getNumPolys(dm) ||
face_indices->size() != dm->getNumLoops(dm);
if (topology_changed) {
new_dm = CDDM_from_template(dm,
positions->size(),
0,