|
@@ -205,7 +205,7 @@ aiReturn Importer::RegisterPPStep(BaseProcess* pImp)
|
|
|
ASSIMP_BEGIN_EXCEPTION_REGION();
|
|
|
|
|
|
pimpl->mPostProcessingSteps.push_back(pImp);
|
|
|
- DefaultLogger::get()->info("Registering custom post-processing step");
|
|
|
+ ASSIMP_LOG_INFO("Registering custom post-processing step");
|
|
|
|
|
|
ASSIMP_END_EXCEPTION_REGION(aiReturn);
|
|
|
return AI_SUCCESS;
|
|
@@ -232,7 +232,7 @@ aiReturn Importer::RegisterLoader(BaseImporter* pImp)
|
|
|
|
|
|
#ifdef ASSIMP_BUILD_DEBUG
|
|
|
if (IsExtensionSupported(*it)) {
|
|
|
- DefaultLogger::get()->warn("The file extension " + *it + " is already in use");
|
|
|
+ ASSIMP_LOG_WARN_F("The file extension ", *it, " is already in use");
|
|
|
}
|
|
|
#endif
|
|
|
baked += *it;
|
|
@@ -240,7 +240,7 @@ aiReturn Importer::RegisterLoader(BaseImporter* pImp)
|
|
|
|
|
|
// add the loader
|
|
|
pimpl->mImporter.push_back(pImp);
|
|
|
- DefaultLogger::get()->info("Registering custom importer for these file extensions: " + baked);
|
|
|
+ ASSIMP_LOG_INFO_F("Registering custom importer for these file extensions: ", baked);
|
|
|
ASSIMP_END_EXCEPTION_REGION(aiReturn);
|
|
|
return AI_SUCCESS;
|
|
|
}
|
|
@@ -260,10 +260,10 @@ aiReturn Importer::UnregisterLoader(BaseImporter* pImp)
|
|
|
|
|
|
if (it != pimpl->mImporter.end()) {
|
|
|
pimpl->mImporter.erase(it);
|
|
|
- DefaultLogger::get()->info("Unregistering custom importer: ");
|
|
|
+ ASSIMP_LOG_INFO("Unregistering custom importer: ");
|
|
|
return AI_SUCCESS;
|
|
|
}
|
|
|
- DefaultLogger::get()->warn("Unable to remove custom importer: I can't find you ...");
|
|
|
+ ASSIMP_LOG_WARN("Unable to remove custom importer: I can't find you ...");
|
|
|
ASSIMP_END_EXCEPTION_REGION(aiReturn);
|
|
|
return AI_FAILURE;
|
|
|
}
|
|
@@ -283,10 +283,10 @@ aiReturn Importer::UnregisterPPStep(BaseProcess* pImp)
|
|
|
|
|
|
if (it != pimpl->mPostProcessingSteps.end()) {
|
|
|
pimpl->mPostProcessingSteps.erase(it);
|
|
|
- DefaultLogger::get()->info("Unregistering custom post-processing step");
|
|
|
+ ASSIMP_LOG_INFO("Unregistering custom post-processing step");
|
|
|
return AI_SUCCESS;
|
|
|
}
|
|
|
- DefaultLogger::get()->warn("Unable to remove custom post-processing step: I can't find you ..");
|
|
|
+ ASSIMP_LOG_WARN("Unable to remove custom post-processing step: I can't find you ..");
|
|
|
ASSIMP_END_EXCEPTION_REGION(aiReturn);
|
|
|
return AI_FAILURE;
|
|
|
}
|
|
@@ -368,11 +368,11 @@ bool Importer::IsDefaultProgressHandler() const
|
|
|
bool _ValidateFlags(unsigned int pFlags)
|
|
|
{
|
|
|
if (pFlags & aiProcess_GenSmoothNormals && pFlags & aiProcess_GenNormals) {
|
|
|
- DefaultLogger::get()->error("#aiProcess_GenSmoothNormals and #aiProcess_GenNormals are incompatible");
|
|
|
+ ASSIMP_LOG_ERROR("#aiProcess_GenSmoothNormals and #aiProcess_GenNormals are incompatible");
|
|
|
return false;
|
|
|
}
|
|
|
if (pFlags & aiProcess_OptimizeGraph && pFlags & aiProcess_PreTransformVertices) {
|
|
|
- DefaultLogger::get()->error("#aiProcess_OptimizeGraph and #aiProcess_PreTransformVertices are incompatible");
|
|
|
+ ASSIMP_LOG_ERROR("#aiProcess_OptimizeGraph and #aiProcess_PreTransformVertices are incompatible");
|
|
|
return false;
|
|
|
}
|
|
|
return true;
|
|
@@ -504,26 +504,15 @@ const aiScene* Importer::ReadFileFromMemory( const void* pBuffer,
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
void WriteLogOpening(const std::string& file)
|
|
|
{
|
|
|
- Logger* l = DefaultLogger::get();
|
|
|
- if (!l) {
|
|
|
- return;
|
|
|
- }
|
|
|
- l->info("Load " + file);
|
|
|
+ ASSIMP_LOG_INFO_F("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()
|
|
|
-
|
|
|
- << " "
|
|
|
+ const unsigned int flags( aiGetCompileFlags() );
|
|
|
+ std::stringstream stream;
|
|
|
+ stream << "Assimp " << aiGetVersionMajor() << "." << aiGetVersionMinor() << "." << aiGetVersionRevision() << " "
|
|
|
#if defined(ASSIMP_BUILD_ARCHITECTURE)
|
|
|
<< ASSIMP_BUILD_ARCHITECTURE
|
|
|
#elif defined(_M_IX86) || defined(__x86_32__) || defined(__i386__)
|
|
@@ -539,12 +528,11 @@ void WriteLogOpening(const std::string& file)
|
|
|
#elif defined(__arm__)
|
|
|
<< "arm"
|
|
|
#else
|
|
|
- << "<unknown architecture>"
|
|
|
+ << "<unknown architecture>"
|
|
|
#endif
|
|
|
-
|
|
|
<< " "
|
|
|
#if defined(ASSIMP_BUILD_COMPILER)
|
|
|
- << ASSIMP_BUILD_COMPILER
|
|
|
+ << ( ASSIMP_BUILD_COMPILER )
|
|
|
#elif defined(_MSC_VER)
|
|
|
<< "msvc"
|
|
|
#elif defined(__GNUC__)
|
|
@@ -559,8 +547,9 @@ void WriteLogOpening(const std::string& file)
|
|
|
|
|
|
<< (flags & ASSIMP_CFLAGS_NOBOOST ? " noboost" : "")
|
|
|
<< (flags & ASSIMP_CFLAGS_SHARED ? " shared" : "")
|
|
|
- << (flags & ASSIMP_CFLAGS_SINGLETHREADED ? " singlethreaded" : "")
|
|
|
- );
|
|
|
+ << (flags & ASSIMP_CFLAGS_SINGLETHREADED ? " singlethreaded" : "");
|
|
|
+
|
|
|
+ ASSIMP_LOG_DEBUG(stream.str());
|
|
|
}
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
@@ -586,7 +575,7 @@ const aiScene* Importer::ReadFile( const char* _pFile, unsigned int pFlags)
|
|
|
// a scene. In this case we need to delete the old one
|
|
|
if (pimpl->mScene) {
|
|
|
|
|
|
- DefaultLogger::get()->debug("(Deleting previous scene)");
|
|
|
+ ASSIMP_LOG_DEBUG("(Deleting previous scene)");
|
|
|
FreeScene();
|
|
|
}
|
|
|
|
|
@@ -594,7 +583,7 @@ const aiScene* Importer::ReadFile( const char* _pFile, unsigned int pFlags)
|
|
|
if( !pimpl->mIOHandler->Exists( pFile)) {
|
|
|
|
|
|
pimpl->mErrorString = "Unable to open file \"" + pFile + "\".";
|
|
|
- DefaultLogger::get()->error(pimpl->mErrorString);
|
|
|
+ ASSIMP_LOG_ERROR(pimpl->mErrorString);
|
|
|
return NULL;
|
|
|
}
|
|
|
|
|
@@ -617,7 +606,7 @@ const aiScene* Importer::ReadFile( const char* _pFile, unsigned int pFlags)
|
|
|
// not so bad yet ... try format auto detection.
|
|
|
const std::string::size_type s = pFile.find_last_of('.');
|
|
|
if (s != std::string::npos) {
|
|
|
- DefaultLogger::get()->info("File extension not known, trying signature-based detection");
|
|
|
+ ASSIMP_LOG_INFO("File extension not known, trying signature-based detection");
|
|
|
for( unsigned int a = 0; a < pimpl->mImporter.size(); a++) {
|
|
|
if( pimpl->mImporter[a]->CanRead( pFile, pimpl->mIOHandler, true)) {
|
|
|
imp = pimpl->mImporter[a];
|
|
@@ -628,7 +617,7 @@ const aiScene* Importer::ReadFile( const char* _pFile, unsigned int pFlags)
|
|
|
// Put a proper error message if no suitable importer was found
|
|
|
if( !imp) {
|
|
|
pimpl->mErrorString = "No suitable reader found for the file format of file \"" + pFile + "\".";
|
|
|
- DefaultLogger::get()->error(pimpl->mErrorString);
|
|
|
+ ASSIMP_LOG_ERROR(pimpl->mErrorString);
|
|
|
return NULL;
|
|
|
}
|
|
|
}
|
|
@@ -648,7 +637,7 @@ const aiScene* Importer::ReadFile( const char* _pFile, unsigned int pFlags)
|
|
|
if ( NULL != desc ) {
|
|
|
ext = desc->mName;
|
|
|
}
|
|
|
- DefaultLogger::get()->info("Found a matching importer for this file format: " + ext + "." );
|
|
|
+ ASSIMP_LOG_INFO("Found a matching importer for this file format: " + ext + "." );
|
|
|
pimpl->mProgressHandler->UpdateFileRead( 0, fileSize );
|
|
|
|
|
|
if (profiler) {
|
|
@@ -716,7 +705,7 @@ const aiScene* Importer::ReadFile( const char* _pFile, unsigned int pFlags)
|
|
|
pimpl->mErrorString = std::string("std::exception: ") + e.what();
|
|
|
#endif
|
|
|
|
|
|
- DefaultLogger::get()->error(pimpl->mErrorString);
|
|
|
+ ASSIMP_LOG_ERROR(pimpl->mErrorString);
|
|
|
delete pimpl->mScene; pimpl->mScene = NULL;
|
|
|
}
|
|
|
#endif // ! ASSIMP_CATCH_GLOBAL_EXCEPTIONS
|
|
@@ -744,7 +733,7 @@ const aiScene* Importer::ApplyPostProcessing(unsigned int pFlags)
|
|
|
|
|
|
// In debug builds: run basic flag validation
|
|
|
ai_assert(_ValidateFlags(pFlags));
|
|
|
- DefaultLogger::get()->info("Entering post processing pipeline");
|
|
|
+ ASSIMP_LOG_INFO("Entering post processing pipeline");
|
|
|
|
|
|
#ifndef ASSIMP_BUILD_NO_VALIDATEDS_PROCESS
|
|
|
// The ValidateDS process plays an exceptional role. It isn't contained in the global
|
|
@@ -762,13 +751,13 @@ const aiScene* Importer::ApplyPostProcessing(unsigned int pFlags)
|
|
|
if (pimpl->bExtraVerbose)
|
|
|
{
|
|
|
#ifdef ASSIMP_BUILD_NO_VALIDATEDS_PROCESS
|
|
|
- DefaultLogger::get()->error("Verbose Import is not available due to build settings");
|
|
|
+ ASSIMP_LOG_ERROR("Verbose Import is not available due to build settings");
|
|
|
#endif // no validation
|
|
|
pFlags |= aiProcess_ValidateDataStructure;
|
|
|
}
|
|
|
#else
|
|
|
if (pimpl->bExtraVerbose) {
|
|
|
- DefaultLogger::get()->warn("Not a debug build, ignoring extra verbose setting");
|
|
|
+ ASSIMP_LOG_WARN("Not a debug build, ignoring extra verbose setting");
|
|
|
}
|
|
|
#endif // ! DEBUG
|
|
|
|
|
@@ -800,18 +789,19 @@ const aiScene* Importer::ApplyPostProcessing(unsigned int pFlags)
|
|
|
|
|
|
// If the extra verbose mode is active, execute the ValidateDataStructureStep again - after each step
|
|
|
if (pimpl->bExtraVerbose) {
|
|
|
- DefaultLogger::get()->debug("Verbose Import: revalidating data structures");
|
|
|
+ ASSIMP_LOG_DEBUG("Verbose Import: re-validating data structures");
|
|
|
|
|
|
ValidateDSProcess ds;
|
|
|
ds.ExecuteOnScene (this);
|
|
|
if( !pimpl->mScene) {
|
|
|
- DefaultLogger::get()->error("Verbose Import: failed to revalidate data structures");
|
|
|
+ ASSIMP_LOG_ERROR("Verbose Import: failed to re-validate data structures");
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
#endif // ! DEBUG
|
|
|
}
|
|
|
- pimpl->mProgressHandler->UpdatePostProcess( static_cast<int>(pimpl->mPostProcessingSteps.size()), static_cast<int>(pimpl->mPostProcessingSteps.size()) );
|
|
|
+ pimpl->mProgressHandler->UpdatePostProcess( static_cast<int>(pimpl->mPostProcessingSteps.size()),
|
|
|
+ static_cast<int>(pimpl->mPostProcessingSteps.size()) );
|
|
|
|
|
|
// update private scene flags
|
|
|
if( pimpl->mScene )
|
|
@@ -819,7 +809,7 @@ const aiScene* Importer::ApplyPostProcessing(unsigned int pFlags)
|
|
|
|
|
|
// clear any data allocated by post-process steps
|
|
|
pimpl->mPPShared->Clean();
|
|
|
- DefaultLogger::get()->info("Leaving post processing pipeline");
|
|
|
+ ASSIMP_LOG_INFO("Leaving post processing pipeline");
|
|
|
|
|
|
ASSIMP_END_EXCEPTION_REGION(const aiScene*);
|
|
|
return pimpl->mScene;
|
|
@@ -840,7 +830,7 @@ const aiScene* Importer::ApplyCustomizedPostProcessing( BaseProcess *rootProcess
|
|
|
}
|
|
|
|
|
|
// In debug builds: run basic flag validation
|
|
|
- DefaultLogger::get()->info( "Entering customized post processing pipeline" );
|
|
|
+ ASSIMP_LOG_INFO( "Entering customized post processing pipeline" );
|
|
|
|
|
|
#ifndef ASSIMP_BUILD_NO_VALIDATEDS_PROCESS
|
|
|
// The ValidateDS process plays an exceptional role. It isn't contained in the global
|
|
@@ -858,12 +848,12 @@ const aiScene* Importer::ApplyCustomizedPostProcessing( BaseProcess *rootProcess
|
|
|
if ( pimpl->bExtraVerbose )
|
|
|
{
|
|
|
#ifdef ASSIMP_BUILD_NO_VALIDATEDS_PROCESS
|
|
|
- DefaultLogger::get()->error( "Verbose Import is not available due to build settings" );
|
|
|
+ ASSIMP_LOG_ERROR( "Verbose Import is not available due to build settings" );
|
|
|
#endif // no validation
|
|
|
}
|
|
|
#else
|
|
|
if ( pimpl->bExtraVerbose ) {
|
|
|
- DefaultLogger::get()->warn( "Not a debug build, ignoring extra verbose setting" );
|
|
|
+ ASSIMP_LOG_WARN( "Not a debug build, ignoring extra verbose setting" );
|
|
|
}
|
|
|
#endif // ! DEBUG
|
|
|
|
|
@@ -881,18 +871,18 @@ const aiScene* Importer::ApplyCustomizedPostProcessing( BaseProcess *rootProcess
|
|
|
|
|
|
// If the extra verbose mode is active, execute the ValidateDataStructureStep again - after each step
|
|
|
if ( pimpl->bExtraVerbose || requestValidation ) {
|
|
|
- DefaultLogger::get()->debug( "Verbose Import: revalidating data structures" );
|
|
|
+ ASSIMP_LOG_DEBUG( "Verbose Import: revalidating data structures" );
|
|
|
|
|
|
ValidateDSProcess ds;
|
|
|
ds.ExecuteOnScene( this );
|
|
|
if ( !pimpl->mScene ) {
|
|
|
- DefaultLogger::get()->error( "Verbose Import: failed to revalidate data structures" );
|
|
|
+ ASSIMP_LOG_ERROR( "Verbose Import: failed to revalidate data structures" );
|
|
|
}
|
|
|
}
|
|
|
|
|
|
// clear any data allocated by post-process steps
|
|
|
pimpl->mPPShared->Clean();
|
|
|
- DefaultLogger::get()->info( "Leaving customized post processing pipeline" );
|
|
|
+ ASSIMP_LOG_INFO( "Leaving customized post processing pipeline" );
|
|
|
|
|
|
ASSIMP_END_EXCEPTION_REGION( const aiScene* );
|
|
|
|
|
@@ -903,7 +893,7 @@ const aiScene* Importer::ApplyCustomizedPostProcessing( BaseProcess *rootProcess
|
|
|
// Helper function to check whether an extension is supported by ASSIMP
|
|
|
bool Importer::IsExtensionSupported(const char* szExtension) const
|
|
|
{
|
|
|
- return NULL != GetImporter(szExtension);
|
|
|
+ return nullptr != GetImporter(szExtension);
|
|
|
}
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
@@ -980,15 +970,18 @@ void Importer::GetExtensionList(aiString& szOut) const
|
|
|
(*i)->GetExtensionList(str);
|
|
|
}
|
|
|
|
|
|
- for (std::set<std::string>::const_iterator it = str.begin();; ) {
|
|
|
- szOut.Append("*.");
|
|
|
- szOut.Append((*it).c_str());
|
|
|
-
|
|
|
- if (++it == str.end()) {
|
|
|
- break;
|
|
|
- }
|
|
|
- szOut.Append(";");
|
|
|
- }
|
|
|
+ // List can be empty
|
|
|
+ if( !str.empty() ) {
|
|
|
+ for (std::set<std::string>::const_iterator it = str.begin();; ) {
|
|
|
+ szOut.Append("*.");
|
|
|
+ szOut.Append((*it).c_str());
|
|
|
+
|
|
|
+ if (++it == str.end()) {
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ szOut.Append(";");
|
|
|
+ }
|
|
|
+ }
|
|
|
ASSIMP_END_EXCEPTION_REGION(void);
|
|
|
}
|
|
|
|
|
@@ -1007,33 +1000,33 @@ bool Importer::SetPropertyInteger(const char* szName, int iValue)
|
|
|
// Set a configuration property
|
|
|
bool Importer::SetPropertyFloat(const char* szName, ai_real iValue)
|
|
|
{
|
|
|
- bool exising;
|
|
|
+ bool existing;
|
|
|
ASSIMP_BEGIN_EXCEPTION_REGION();
|
|
|
- exising = SetGenericProperty<ai_real>(pimpl->mFloatProperties, szName,iValue);
|
|
|
+ existing = SetGenericProperty<ai_real>(pimpl->mFloatProperties, szName,iValue);
|
|
|
ASSIMP_END_EXCEPTION_REGION(bool);
|
|
|
- return exising;
|
|
|
+ return existing;
|
|
|
}
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
// Set a configuration property
|
|
|
bool Importer::SetPropertyString(const char* szName, const std::string& value)
|
|
|
{
|
|
|
- bool exising;
|
|
|
+ bool existing;
|
|
|
ASSIMP_BEGIN_EXCEPTION_REGION();
|
|
|
- exising = SetGenericProperty<std::string>(pimpl->mStringProperties, szName,value);
|
|
|
+ existing = SetGenericProperty<std::string>(pimpl->mStringProperties, szName,value);
|
|
|
ASSIMP_END_EXCEPTION_REGION(bool);
|
|
|
- return exising;
|
|
|
+ return existing;
|
|
|
}
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
// Set a configuration property
|
|
|
bool Importer::SetPropertyMatrix(const char* szName, const aiMatrix4x4& value)
|
|
|
{
|
|
|
- bool exising;
|
|
|
+ bool existing;
|
|
|
ASSIMP_BEGIN_EXCEPTION_REGION();
|
|
|
- exising = SetGenericProperty<aiMatrix4x4>(pimpl->mMatrixProperties, szName,value);
|
|
|
+ existing = SetGenericProperty<aiMatrix4x4>(pimpl->mMatrixProperties, szName,value);
|
|
|
ASSIMP_END_EXCEPTION_REGION(bool);
|
|
|
- return exising;
|
|
|
+ return existing;
|
|
|
}
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|