From ab6c348c2d1b632da9fe02ac16f67c34c2a6e51a Mon Sep 17 00:00:00 2001 From: aramis_acg Date: Tue, 17 Jan 2012 02:18:59 +0000 Subject: [PATCH] # 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 --- code/IFCGeometry.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/code/IFCGeometry.cpp b/code/IFCGeometry.cpp index 47a8bffd9..a6f7b1b69 100644 --- a/code/IFCGeometry.cpp +++ b/code/IFCGeometry.cpp @@ -748,8 +748,11 @@ bool TryAddOpenings_Poly2Tri(const std::vector& openings,const std: return false; } - curmesh.verts.clear(); - curmesh.vertcnt.clear(); + std::vector old_verts; + std::vector 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& 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; }