# Ifc: if generating wall openings fails, revert to the original wall rather than leaving polygon crap.

git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@1121 67173fc5-114c-0410-ac8e-9d2fd5bffc1f
pull/5/head
aramis_acg 2012-01-17 02:18:59 +00:00
parent 90fb1525b1
commit ab6c348c2d
1 changed files with 14 additions and 2 deletions

View File

@ -748,8 +748,11 @@ bool TryAddOpenings_Poly2Tri(const std::vector<TempOpening>& openings,const std:
return false;
}
curmesh.verts.clear();
curmesh.vertcnt.clear();
std::vector<aiVector3D> old_verts;
std::vector<unsigned int> old_vertcnt;
old_verts.swap(curmesh.verts);
old_vertcnt.swap(curmesh.vertcnt);
// add connection geometry to close the adjacent 'holes' for the openings
@ -864,6 +867,15 @@ bool TryAddOpenings_Poly2Tri(const std::vector<TempOpening>& openings,const std:
#undef from_int64
#undef from_int64_f
if (!result) {
// revert -- it's a shame, but better than nothing
curmesh.verts.insert(curmesh.verts.end(),old_verts.begin(), old_verts.end());
curmesh.vertcnt.insert(curmesh.vertcnt.end(),old_vertcnt.begin(), old_vertcnt.end());
IFCImporter::LogError("Ifc: revert, could not generate openings for this wall");
}
return result;
}