From 2705825f50ddee3b655663288c9cb738819a62dc Mon Sep 17 00:00:00 2001 From: cignoni Date: Wed, 29 Mar 2006 09:27:07 +0000 Subject: [PATCH] Added managemnt of non critical errors --- apps/trimeshinfo/trimeshinfo.cpp | 11 +++++++++++ wrap/io_trimesh/import.h | 17 +++++++++++++++++ wrap/io_trimesh/import_obj.h | 10 ++++++++++ 3 files changed, 38 insertions(+) diff --git a/apps/trimeshinfo/trimeshinfo.cpp b/apps/trimeshinfo/trimeshinfo.cpp index 4e079ec9..4cd7850d 100644 --- a/apps/trimeshinfo/trimeshinfo.cpp +++ b/apps/trimeshinfo/trimeshinfo.cpp @@ -24,6 +24,9 @@ History $Log: not supported by cvs2svn $ +Revision 1.38 2006/03/29 08:17:56 corsini +fix typo + Revision 1.37 2006/03/27 07:15:59 cignoni Added LoadMask @@ -286,9 +289,17 @@ int OpenMesh(const char *filename, CMesh &m) if (err) { + if(tri::io::Importer::ErrorCritical(err)) + { printf("\n Error during loading %s: '%s'\n",filename, tri::io::Importer::ErrorMsg(err)); exit(-1); + } + else + { + printf("\n Non Critical Troubles during loading %s: '%s'\n",filename, + tri::io::Importer::ErrorMsg(err)); + } } else printf(" done.\n\n"); diff --git a/wrap/io_trimesh/import.h b/wrap/io_trimesh/import.h index 06e10022..82890b21 100644 --- a/wrap/io_trimesh/import.h +++ b/wrap/io_trimesh/import.h @@ -25,6 +25,9 @@ History $Log: not supported by cvs2svn $ +Revision 1.10 2006/03/29 08:16:31 corsini +Minor change in LoadMask + Revision 1.9 2006/03/27 07:17:49 cignoni Added generic LoadMask @@ -135,6 +138,19 @@ static int Open(OpenMeshType &m, const char *filename, int &loadmask, CallBackPo return err; } +static bool ErrorCritical(int error) +{ + switch(LastType()) + { + case KT_PLY : return (error>0); break; + case KT_STL : return (error>0); break; + case KT_OFF : return (error>0); break; + case KT_OBJ : return ImporterOBJ::ErrorCritical(error); break; + } + + return true; +} + static const char *ErrorMsg(int error) { switch(LastType()) @@ -142,6 +158,7 @@ static const char *ErrorMsg(int error) case KT_PLY : return ImporterPLY::ErrorMsg(error); break; case KT_STL : return ImporterSTL::ErrorMsg(error); break; case KT_OFF : return ImporterOFF::ErrorMsg(error); break; + case KT_OBJ : return ImporterOBJ::ErrorMsg(error); break; } return "Unknown type"; } diff --git a/wrap/io_trimesh/import_obj.h b/wrap/io_trimesh/import_obj.h index 35535ae6..cebad8d1 100644 --- a/wrap/io_trimesh/import_obj.h +++ b/wrap/io_trimesh/import_obj.h @@ -25,6 +25,9 @@ History $Log: not supported by cvs2svn $ +Revision 1.3 2006/03/29 08:51:16 corsini +reset to zero warnings + Revision 1.2 2006/03/27 07:18:22 cignoni added missing std:: @@ -165,6 +168,13 @@ enum OBJError { E_BAD_VERT_NORMAL_INDEX = 0x020 // 16 }; +// to check if a given error is critical or not. +static bool ErrorCritical(int err) +{ + if(err<0x00A && err>=0) return false; + return true; +} + static const char* ErrorMsg(int error) { static const char* obj_error_msg[] =