2
0
Эх сурвалжийг харах

Print version line to log upon loading a new file. This should aid at debugging incoming bugreports with logs attached.

git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@804 67173fc5-114c-0410-ac8e-9d2fd5bffc1f
aramis_acg 15 жил өмнө
parent
commit
a9fd7651fa

+ 55 - 0
code/Importer.cpp

@@ -44,6 +44,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
 #include "AssimpPCH.h"
+#include "../include/aiVersion.h"
 
 // ------------------------------------------------------------------------------------------------
 /* Uncomment this line to prevent Assimp from catching unknown exceptions.
@@ -68,8 +69,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #include "ScenePreprocessor.h"
 #include "MemoryIOWrapper.h"
 #include "Profiler.h"
+#include "TinyFormatter.h"
 
 using namespace Assimp::Profiling;
+using namespace Assimp::Formatter;
 
 // ------------------------------------------------------------------------------------------------
 // Importers
@@ -827,6 +830,56 @@ const aiScene* Importer::ReadFileFromMemory( const void* pBuffer,
 	return pimpl->mScene;
 }
 
+// ------------------------------------------------------------------------------------------------
+void WriteLogOpening(const std::string& file)
+{
+	Logger* l = DefaultLogger::get();
+	if (!l) {
+		return;
+	}
+	l->info("Load " + file);
+
+	// print a full version dump. This is nice because we don't
+	// need to ask the authors of incoming bug reports for
+	// the library version they're using - a log dump is
+	// sufficient.
+	const unsigned int flags = aiGetCompileFlags();
+	l->debug(format()
+		<< "Assimp "
+		<< aiGetVersionMajor() 
+		<< "." 
+		<< aiGetVersionMinor() 
+		<< "." 
+		<< aiGetVersionRevision()
+
+#if defined(ASSIMP_BUILD_X86_32BIT_ARCHITECTURE)
+		<< " x86"
+#elif defined(ASSIMP_BUILD_X86_64BIT_ARCHITECTURE)
+		<< " amd64"
+#elif defined(ASSIMP_BUILD_IA_64BIT_ARCHITECTURE)
+		<< " itanium"
+#else
+#	error unknown architecture
+#endif
+
+#if defined(_MSC_VER)
+		<< " msvc"
+#elif defined(__GNUC__)
+		<< " gcc"
+#else
+#	error unknown compiler
+#endif
+
+#ifndef NDEBUG
+		<< " debug"
+#endif
+
+		<< (flags & ASSIMP_CFLAGS_NOBOOST ? " noboost" : "")
+		<< (flags & ASSIMP_CFLAGS_SHARED  ? " shared" : "")
+		<< (flags & ASSIMP_CFLAGS_SINGLETHREADED  ? " singlethreaded" : "")
+		);
+}
+
 // ------------------------------------------------------------------------------------------------
 // Reads the given file and returns its contents if successful.
 const aiScene* Importer::ReadFile( const char* _pFile, unsigned int pFlags)
@@ -840,6 +893,8 @@ const aiScene* Importer::ReadFile( const char* _pFile, unsigned int pFlags)
 	// ImportErrorException's are throw by ourselves and caught elsewhere.
 	//-----------------------------------------------------------------------
 
+	WriteLogOpening(pFile);
+
 #ifdef ASSIMP_CATCH_GLOBAL_EXCEPTIONS
 	try
 #endif // ! ASSIMP_CATCH_GLOBAL_EXCEPTIONS

+ 5 - 5
tools/assimp_view/assimp_view.cpp

@@ -195,13 +195,13 @@ int LoadAsset(void)
 	g_mWorldRotate = aiMatrix4x4();
 	g_mWorld = aiMatrix4x4();
 
-	char szTemp[MAX_PATH+64];
-	sprintf(szTemp,"Starting to load %s",g_szFileName);
-	CLogWindow::Instance().WriteLine(
-		"----------------------------------------------------------------------------");
-	CLogWindow::Instance().WriteLine(szTemp);
+//	char szTemp[MAX_PATH+64];
+//	sprintf(szTemp,"Starting to load %s",g_szFileName);
 	CLogWindow::Instance().WriteLine(
 		"----------------------------------------------------------------------------");
+//	CLogWindow::Instance().WriteLine(szTemp);
+//	CLogWindow::Instance().WriteLine(
+//		"----------------------------------------------------------------------------");
 	CLogWindow::Instance().SetAutoUpdate(false);
 
 	// create a helper thread to load the asset