Add usage of log macros.

pull/1918/head
kimkulling 2018-04-19 16:48:43 +02:00
parent bdbad4c64f
commit 066349f36b
24 changed files with 168 additions and 177 deletions

View File

@ -120,7 +120,7 @@ void Discreet3DSImporter::ReplaceDefaultMaterial()
else if ( (*a) >= mScene->mMaterials.size()) else if ( (*a) >= mScene->mMaterials.size())
{ {
(*a) = idx; (*a) = idx;
DefaultLogger::get()->warn("Material index overflow in 3DS file. Using default material"); ASSIMP_LOG_WARN("Material index overflow in 3DS file. Using default material");
++cnt; ++cnt;
} }
} }
@ -132,7 +132,7 @@ void Discreet3DSImporter::ReplaceDefaultMaterial()
sMat.mDiffuse = aiColor3D(0.3f,0.3f,0.3f); sMat.mDiffuse = aiColor3D(0.3f,0.3f,0.3f);
mScene->mMaterials.push_back(sMat); mScene->mMaterials.push_back(sMat);
DefaultLogger::get()->info("3DS: Generating default material"); ASSIMP_LOG_INFO("3DS: Generating default material");
} }
} }
@ -147,12 +147,12 @@ void Discreet3DSImporter::CheckIndices(D3DS::Mesh& sMesh)
{ {
if ((*i).mIndices[a] >= sMesh.mPositions.size()) if ((*i).mIndices[a] >= sMesh.mPositions.size())
{ {
DefaultLogger::get()->warn("3DS: Vertex index overflow)"); ASSIMP_LOG_WARN("3DS: Vertex index overflow)");
(*i).mIndices[a] = (uint32_t)sMesh.mPositions.size()-1; (*i).mIndices[a] = (uint32_t)sMesh.mPositions.size()-1;
} }
if ( !sMesh.mTexCoords.empty() && (*i).mIndices[a] >= sMesh.mTexCoords.size()) if ( !sMesh.mTexCoords.empty() && (*i).mIndices[a] >= sMesh.mTexCoords.size())
{ {
DefaultLogger::get()->warn("3DS: Texture coordinate index overflow)"); ASSIMP_LOG_WARN("3DS: Texture coordinate index overflow)");
(*i).mIndices[a] = (uint32_t)sMesh.mTexCoords.size()-1; (*i).mIndices[a] = (uint32_t)sMesh.mTexCoords.size()-1;
} }
} }
@ -497,7 +497,7 @@ void Discreet3DSImporter::AddNodeToGraph(aiScene* pcSOut,aiNode* pcOut,
pvCurrent->x *= -1.f; pvCurrent->x *= -1.f;
t2->x *= -1.f; t2->x *= -1.f;
} }
DefaultLogger::get()->info("3DS: Flipping mesh X-Axis"); ASSIMP_LOG_INFO("3DS: Flipping mesh X-Axis");
} }
// Handle pivot point // Handle pivot point
@ -573,11 +573,11 @@ void Discreet3DSImporter::AddNodeToGraph(aiScene* pcSOut,aiNode* pcOut,
pcIn->aTargetPositionKeys.size() > 1) pcIn->aTargetPositionKeys.size() > 1)
{ {
aiAnimation* anim = pcSOut->mAnimations[0]; aiAnimation* anim = pcSOut->mAnimations[0];
ai_assert(NULL != anim); ai_assert(nullptr != anim);
if (pcIn->aCameraRollKeys.size() > 1) if (pcIn->aCameraRollKeys.size() > 1)
{ {
DefaultLogger::get()->debug("3DS: Converting camera roll track ..."); ASSIMP_LOG_DEBUG("3DS: Converting camera roll track ...");
// Camera roll keys - in fact they're just rotations // Camera roll keys - in fact they're just rotations
// around the camera's z axis. The angles are given // around the camera's z axis. The angles are given
@ -597,7 +597,7 @@ void Discreet3DSImporter::AddNodeToGraph(aiScene* pcSOut,aiNode* pcOut,
#if 0 #if 0
if (pcIn->aTargetPositionKeys.size() > 1) if (pcIn->aTargetPositionKeys.size() > 1)
{ {
DefaultLogger::get()->debug("3DS: Converting target track ..."); ASSIMP_LOG_DEBUG("3DS: Converting target track ...");
// Camera or spot light - need to convert the separate // Camera or spot light - need to convert the separate
// target position channel to our representation // target position channel to our representation
@ -743,7 +743,7 @@ void Discreet3DSImporter::GenerateNodeGraph(aiScene* pcOut)
// | | | | | // | | | | |
// MESH_0 MESH_1 MESH_2 ... MESH_N CAMERA_0 .... // MESH_0 MESH_1 MESH_2 ... MESH_N CAMERA_0 ....
// //
DefaultLogger::get()->warn("No hierarchy information has been found in the file. "); ASSIMP_LOG_WARN("No hierarchy information has been found in the file. ");
pcOut->mRootNode->mNumChildren = pcOut->mNumMeshes + pcOut->mRootNode->mNumChildren = pcOut->mNumMeshes +
static_cast<unsigned int>(mScene->mCameras.size() + mScene->mLights.size()); static_cast<unsigned int>(mScene->mCameras.size() + mScene->mLights.size());

View File

@ -381,7 +381,7 @@ void Discreet3DSExporter::WriteTexture(const aiMaterial& mat, aiTextureType type
// TODO: handle embedded textures properly // TODO: handle embedded textures properly
if (path.data[0] == '*') { if (path.data[0] == '*') {
DefaultLogger::get()->error("Ignoring embedded texture for export: " + std::string(path.C_Str())); ASSIMP_LOG_ERROR("Ignoring embedded texture for export: " + std::string(path.C_Str()));
return; return;
} }

View File

@ -258,8 +258,9 @@ void Discreet3DSImporter::ReadChunk(Discreet3DS::Chunk* pcOut)
if (pcOut->Size - sizeof(Discreet3DS::Chunk) > stream->GetRemainingSize()) if (pcOut->Size - sizeof(Discreet3DS::Chunk) > stream->GetRemainingSize())
throw DeadlyImportError("Chunk is too large"); throw DeadlyImportError("Chunk is too large");
if (pcOut->Size - sizeof(Discreet3DS::Chunk) > stream->GetRemainingSizeToLimit()) if (pcOut->Size - sizeof(Discreet3DS::Chunk) > stream->GetRemainingSizeToLimit()) {
DefaultLogger::get()->error("3DS: Chunk overflow"); ASSIMP_LOG_ERROR("3DS: Chunk overflow");
}
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
@ -320,7 +321,7 @@ void Discreet3DSImporter::ParseEditorChunk()
// print the version number // print the version number
char buff[10]; char buff[10];
ASSIMP_itoa10(buff,stream->GetI2()); ASSIMP_itoa10(buff,stream->GetI2());
DefaultLogger::get()->info(std::string("3DS file format version: ") + buff); ASSIMP_LOG_INFO_F(std::string("3DS file format version: "), buff);
} }
break; break;
}; };
@ -361,7 +362,7 @@ void Discreet3DSImporter::ParseObjectChunk()
if (is_qnan(mClrAmbient.r)) if (is_qnan(mClrAmbient.r))
{ {
// We failed to read the ambient base color. // We failed to read the ambient base color.
DefaultLogger::get()->error("3DS: Failed to read ambient base color"); ASSIMP_LOG_ERROR("3DS: Failed to read ambient base color");
mClrAmbient.r = mClrAmbient.g = mClrAmbient.b = 0.0f; mClrAmbient.r = mClrAmbient.g = mClrAmbient.b = 0.0f;
} }
break; break;
@ -463,7 +464,7 @@ void Discreet3DSImporter::ParseChunk(const char* name, unsigned int num)
if (len < 1e-5) { if (len < 1e-5) {
// There are some files with lookat == position. Don't know why or whether it's ok or not. // There are some files with lookat == position. Don't know why or whether it's ok or not.
DefaultLogger::get()->error("3DS: Unable to read proper camera look-at vector"); ASSIMP_LOG_ERROR("3DS: Unable to read proper camera look-at vector");
camera->mLookAt = aiVector3D(0.0,1.0,0.0); camera->mLookAt = aiVector3D(0.0,1.0,0.0);
} }
@ -629,9 +630,9 @@ void Discreet3DSImporter::SkipTCBInfo()
if (!flags) { if (!flags) {
// Currently we can't do anything with these values. They occur // Currently we can't do anything with these values. They occur
// quite rare, so it wouldn't be worth the effort implementing // quite rare, so it wouldn't be worth the effort implementing
// them. 3DS ist not really suitable for complex animations, // them. 3DS is not really suitable for complex animations,
// so full support is not required. // so full support is not required.
DefaultLogger::get()->warn("3DS: Skipping TCB animation info"); ASSIMP_LOG_WARN("3DS: Skipping TCB animation info");
} }
if (flags & Discreet3DS::KEY_USE_TENS) { if (flags & Discreet3DS::KEY_USE_TENS) {
@ -732,7 +733,6 @@ void Discreet3DSImporter::ParseHierarchyChunk(uint16_t parent)
// If object name is DUMMY, take this one instead // If object name is DUMMY, take this one instead
if (mCurrentNode->mName == "$$$DUMMY") { if (mCurrentNode->mName == "$$$DUMMY") {
//DefaultLogger::get()->warn("3DS: Skipping dummy object name for non-dummy object");
mCurrentNode->mName = std::string(sz); mCurrentNode->mName = std::string(sz);
break; break;
} }
@ -743,7 +743,7 @@ void Discreet3DSImporter::ParseHierarchyChunk(uint16_t parent)
if ( Discreet3DS::CHUNK_TRACKINFO != parent) if ( Discreet3DS::CHUNK_TRACKINFO != parent)
{ {
DefaultLogger::get()->warn("3DS: Skipping pivot subchunk for non usual object"); ASSIMP_LOG_WARN("3DS: Skipping pivot subchunk for non usual object");
break; break;
} }
@ -805,7 +805,7 @@ void Discreet3DSImporter::ParseHierarchyChunk(uint16_t parent)
{ {
// roll keys are accepted for cameras only // roll keys are accepted for cameras only
if (parent != Discreet3DS::CHUNK_TRACKCAMERA) { if (parent != Discreet3DS::CHUNK_TRACKCAMERA) {
DefaultLogger::get()->warn("3DS: Ignoring roll track for non-camera object"); ASSIMP_LOG_WARN("3DS: Ignoring roll track for non-camera object");
break; break;
} }
bool sortKeys = false; bool sortKeys = false;
@ -845,7 +845,7 @@ void Discreet3DSImporter::ParseHierarchyChunk(uint16_t parent)
// CAMERA FOV KEYFRAME // CAMERA FOV KEYFRAME
case Discreet3DS::CHUNK_TRACKFOV: case Discreet3DS::CHUNK_TRACKFOV:
{ {
DefaultLogger::get()->error("3DS: Skipping FOV animation track. " ASSIMP_LOG_ERROR("3DS: Skipping FOV animation track. "
"This is not supported"); "This is not supported");
} }
break; break;
@ -985,7 +985,7 @@ void Discreet3DSImporter::ParseFaceChunk()
} }
} }
if (0xcdcdcdcd == idx) { if (0xcdcdcdcd == idx) {
DefaultLogger::get()->error(std::string("3DS: Unknown material: ") + sz); ASSIMP_LOG_ERROR_F( "3DS: Unknown material: ", sz);
} }
// Now continue and read all material indices // Now continue and read all material indices
@ -995,7 +995,7 @@ void Discreet3DSImporter::ParseFaceChunk()
// check range // check range
if (fidx >= mMesh.mFaceMaterials.size()) { if (fidx >= mMesh.mFaceMaterials.size()) {
DefaultLogger::get()->error("3DS: Invalid face index in face material list"); ASSIMP_LOG_ERROR("3DS: Invalid face index in face material list");
} }
else mMesh.mFaceMaterials[fidx] = idx; else mMesh.mFaceMaterials[fidx] = idx;
}} }}
@ -1110,7 +1110,7 @@ void Discreet3DSImporter::ParseMaterialChunk()
if (!cnt) { if (!cnt) {
// This may not be, we use the default name instead // This may not be, we use the default name instead
DefaultLogger::get()->error("3DS: Empty material name"); ASSIMP_LOG_ERROR("3DS: Empty material name");
} }
else mScene->mMaterials.back().mName = std::string(sz,cnt); else mScene->mMaterials.back().mName = std::string(sz,cnt);
} }
@ -1123,7 +1123,7 @@ void Discreet3DSImporter::ParseMaterialChunk()
ParseColorChunk(pc); ParseColorChunk(pc);
if (is_qnan(pc->r)) { if (is_qnan(pc->r)) {
// color chunk is invalid. Simply ignore it // color chunk is invalid. Simply ignore it
DefaultLogger::get()->error("3DS: Unable to read DIFFUSE chunk"); ASSIMP_LOG_ERROR("3DS: Unable to read DIFFUSE chunk");
pc->r = pc->g = pc->b = 1.0f; pc->r = pc->g = pc->b = 1.0f;
}} }}
break; break;
@ -1135,7 +1135,7 @@ void Discreet3DSImporter::ParseMaterialChunk()
ParseColorChunk(pc); ParseColorChunk(pc);
if (is_qnan(pc->r)) { if (is_qnan(pc->r)) {
// color chunk is invalid. Simply ignore it // color chunk is invalid. Simply ignore it
DefaultLogger::get()->error("3DS: Unable to read SPECULAR chunk"); ASSIMP_LOG_ERROR("3DS: Unable to read SPECULAR chunk");
pc->r = pc->g = pc->b = 1.0f; pc->r = pc->g = pc->b = 1.0f;
}} }}
break; break;
@ -1147,7 +1147,7 @@ void Discreet3DSImporter::ParseMaterialChunk()
ParseColorChunk(pc); ParseColorChunk(pc);
if (is_qnan(pc->r)) { if (is_qnan(pc->r)) {
// color chunk is invalid. Simply ignore it // color chunk is invalid. Simply ignore it
DefaultLogger::get()->error("3DS: Unable to read AMBIENT chunk"); ASSIMP_LOG_ERROR("3DS: Unable to read AMBIENT chunk");
pc->r = pc->g = pc->b = 0.0f; pc->r = pc->g = pc->b = 0.0f;
}} }}
break; break;
@ -1159,7 +1159,7 @@ void Discreet3DSImporter::ParseMaterialChunk()
ParseColorChunk(pc); ParseColorChunk(pc);
if (is_qnan(pc->r)) { if (is_qnan(pc->r)) {
// color chunk is invalid. Simply ignore it // color chunk is invalid. Simply ignore it
DefaultLogger::get()->error("3DS: Unable to read EMISSIVE chunk"); ASSIMP_LOG_ERROR("3DS: Unable to read EMISSIVE chunk");
pc->r = pc->g = pc->b = 0.0f; pc->r = pc->g = pc->b = 0.0f;
}} }}
break; break;
@ -1293,7 +1293,7 @@ void Discreet3DSImporter::ParseTextureChunk(D3DS::Texture* pcOut)
pcOut->mScaleU = stream->GetF4(); pcOut->mScaleU = stream->GetF4();
if (0.0f == pcOut->mScaleU) if (0.0f == pcOut->mScaleU)
{ {
DefaultLogger::get()->warn("Texture coordinate scaling in the x direction is zero. Assuming 1."); ASSIMP_LOG_WARN("Texture coordinate scaling in the x direction is zero. Assuming 1.");
pcOut->mScaleU = 1.0f; pcOut->mScaleU = 1.0f;
} }
break; break;
@ -1302,7 +1302,7 @@ void Discreet3DSImporter::ParseTextureChunk(D3DS::Texture* pcOut)
pcOut->mScaleV = stream->GetF4(); pcOut->mScaleV = stream->GetF4();
if (0.0f == pcOut->mScaleV) if (0.0f == pcOut->mScaleV)
{ {
DefaultLogger::get()->warn("Texture coordinate scaling in the y direction is zero. Assuming 1."); ASSIMP_LOG_WARN("Texture coordinate scaling in the y direction is zero. Assuming 1.");
pcOut->mScaleV = 1.0f; pcOut->mScaleV = 1.0f;
} }
break; break;

View File

@ -85,7 +85,7 @@ static const aiImporterDesc desc = {
#define AI_AC_SKIP_TO_NEXT_TOKEN() \ #define AI_AC_SKIP_TO_NEXT_TOKEN() \
if (!SkipSpaces(&buffer)) \ if (!SkipSpaces(&buffer)) \
{ \ { \
DefaultLogger::get()->error("AC3D: Unexpected EOF/EOL"); \ ASSIMP_LOG_ERROR("AC3D: Unexpected EOF/EOL"); \
continue; \ continue; \
} }
@ -101,7 +101,7 @@ static const aiImporterDesc desc = {
{ \ { \
if (IsLineEnd( *buffer )) \ if (IsLineEnd( *buffer )) \
{ \ { \
DefaultLogger::get()->error("AC3D: Unexpected EOF/EOL in string"); \ ASSIMP_LOG_ERROR("AC3D: Unexpected EOF/EOL in string"); \
out = "ERROR"; \ out = "ERROR"; \
break; \ break; \
} \ } \
@ -120,7 +120,7 @@ static const aiImporterDesc desc = {
{ \ { \
if (strncmp(buffer,name,name_length) || !IsSpace(buffer[name_length])) \ if (strncmp(buffer,name,name_length) || !IsSpace(buffer[name_length])) \
{ \ { \
DefaultLogger::get()->error("AC3D: Unexpexted token. " name " was expected."); \ ASSIMP_LOG_ERROR("AC3D: Unexpexted token. " name " was expected."); \
continue; \ continue; \
} \ } \
buffer += name_length+1; \ buffer += name_length+1; \
@ -217,7 +217,7 @@ void AC3DImporter::LoadObjectSection(std::vector<Object>& objects)
light->mName.length = ::ai_snprintf(light->mName.data, MAXLEN, "ACLight_%i",static_cast<unsigned int>(mLights->size())-1); light->mName.length = ::ai_snprintf(light->mName.data, MAXLEN, "ACLight_%i",static_cast<unsigned int>(mLights->size())-1);
obj.name = std::string( light->mName.data ); obj.name = std::string( light->mName.data );
DefaultLogger::get()->debug("AC3D: Light source encountered"); ASSIMP_LOG_DEBUG("AC3D: Light source encountered");
obj.type = Object::Light; obj.type = Object::Light;
} }
else if (!ASSIMP_strincmp(buffer,"group",5)) else if (!ASSIMP_strincmp(buffer,"group",5))
@ -307,12 +307,12 @@ void AC3DImporter::LoadObjectSection(std::vector<Object>& objects)
{ {
if (!GetNextLine()) if (!GetNextLine())
{ {
DefaultLogger::get()->error("AC3D: Unexpected EOF: not all vertices have been parsed yet"); ASSIMP_LOG_ERROR("AC3D: Unexpected EOF: not all vertices have been parsed yet");
break; break;
} }
else if (!IsNumeric(*buffer)) else if (!IsNumeric(*buffer))
{ {
DefaultLogger::get()->error("AC3D: Unexpected token: not all vertices have been parsed yet"); ASSIMP_LOG_ERROR("AC3D: Unexpected token: not all vertices have been parsed yet");
--buffer; // make sure the line is processed a second time --buffer; // make sure the line is processed a second time
break; break;
} }
@ -338,8 +338,8 @@ void AC3DImporter::LoadObjectSection(std::vector<Object>& objects)
// example writes no surf chunks // example writes no surf chunks
if (!Q3DWorkAround) if (!Q3DWorkAround)
{ {
DefaultLogger::get()->warn("AC3D: SURF token was expected"); ASSIMP_LOG_WARN("AC3D: SURF token was expected");
DefaultLogger::get()->debug("Continuing with Quick3D Workaround enabled"); ASSIMP_LOG_DEBUG("Continuing with Quick3D Workaround enabled");
} }
--buffer; // make sure the line is processed a second time --buffer; // make sure the line is processed a second time
// break; --- see fix notes above // break; --- see fix notes above
@ -384,7 +384,7 @@ void AC3DImporter::LoadObjectSection(std::vector<Object>& objects)
{ {
if(!GetNextLine()) if(!GetNextLine())
{ {
DefaultLogger::get()->error("AC3D: Unexpected EOF: surface references are incomplete"); ASSIMP_LOG_ERROR("AC3D: Unexpected EOF: surface references are incomplete");
break; break;
} }
surf.entries.push_back(Surface::SurfaceEntry()); surf.entries.push_back(Surface::SurfaceEntry());
@ -405,7 +405,7 @@ void AC3DImporter::LoadObjectSection(std::vector<Object>& objects)
} }
} }
} }
DefaultLogger::get()->error("AC3D: Unexpected EOF: \'kids\' line was expected"); ASSIMP_LOG_ERROR("AC3D: Unexpected EOF: \'kids\' line was expected");
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
@ -478,7 +478,7 @@ aiNode* AC3DImporter::ConvertObjectSection(Object& object,
therefore: if no surfaces are defined return point data only therefore: if no surfaces are defined return point data only
*/ */
DefaultLogger::get()->info("AC3D: No surfaces defined in object definition, " ASSIMP_LOG_INFO("AC3D: No surfaces defined in object definition, "
"a point list is returned"); "a point list is returned");
meshes.push_back(new aiMesh()); meshes.push_back(new aiMesh());
@ -519,12 +519,12 @@ aiNode* AC3DImporter::ConvertObjectSection(Object& object,
unsigned int idx = (*it).mat; unsigned int idx = (*it).mat;
if (idx >= needMat.size()) if (idx >= needMat.size())
{ {
DefaultLogger::get()->error("AC3D: material index is out of range"); ASSIMP_LOG_ERROR("AC3D: material index is out of range");
idx = 0; idx = 0;
} }
if ((*it).entries.empty()) if ((*it).entries.empty())
{ {
DefaultLogger::get()->warn("AC3D: surface her zero vertex references"); ASSIMP_LOG_WARN("AC3D: surface her zero vertex references");
} }
// validate all vertex indices to make sure we won't crash here // validate all vertex indices to make sure we won't crash here
@ -533,7 +533,7 @@ aiNode* AC3DImporter::ConvertObjectSection(Object& object,
{ {
if ((*it2).first >= object.vertices.size()) if ((*it2).first >= object.vertices.size())
{ {
DefaultLogger::get()->warn("AC3D: Invalid vertex reference"); ASSIMP_LOG_WARN("AC3D: Invalid vertex reference");
(*it2).first = 0; (*it2).first = 0;
} }
} }
@ -561,7 +561,7 @@ aiNode* AC3DImporter::ConvertObjectSection(Object& object,
if ((*it).flags & 0xf) if ((*it).flags & 0xf)
{ {
DefaultLogger::get()->warn("AC3D: The type flag of a surface is unknown"); ASSIMP_LOG_WARN("AC3D: The type flag of a surface is unknown");
(*it).flags &= ~(0xf); (*it).flags &= ~(0xf);
} }
@ -712,7 +712,7 @@ aiNode* AC3DImporter::ConvertObjectSection(Object& object,
if (object.subDiv) { if (object.subDiv) {
if (configEvalSubdivision) { if (configEvalSubdivision) {
std::unique_ptr<Subdivider> div(Subdivider::Create(Subdivider::CATMULL_CLARKE)); std::unique_ptr<Subdivider> div(Subdivider::Create(Subdivider::CATMULL_CLARKE));
DefaultLogger::get()->info("AC3D: Evaluating subdivision surface: "+object.name); ASSIMP_LOG_INFO("AC3D: Evaluating subdivision surface: "+object.name);
std::vector<aiMesh*> cpy(meshes.size()-oldm,NULL); std::vector<aiMesh*> cpy(meshes.size()-oldm,NULL);
div->Subdivide(&meshes[oldm],cpy.size(),&cpy.front(),object.subDiv,true); div->Subdivide(&meshes[oldm],cpy.size(),&cpy.front(),object.subDiv,true);
@ -721,7 +721,7 @@ aiNode* AC3DImporter::ConvertObjectSection(Object& object,
// previous meshes are deleted vy Subdivide(). // previous meshes are deleted vy Subdivide().
} }
else { else {
DefaultLogger::get()->info("AC3D: Letting the subdivision surface untouched due to my configuration: " ASSIMP_LOG_INFO("AC3D: Letting the subdivision surface untouched due to my configuration: "
+object.name); +object.name);
} }
} }
@ -813,7 +813,7 @@ void AC3DImporter::InternReadFile( const std::string& pFile,
unsigned int version = HexDigitToDecimal( buffer[4] ); unsigned int version = HexDigitToDecimal( buffer[4] );
char msg[3]; char msg[3];
ASSIMP_itoa10(msg,3,version); ASSIMP_itoa10(msg,3,version);
DefaultLogger::get()->info(std::string("AC3D file format version: ") + msg); ASSIMP_LOG_INFO_F("AC3D file format version: ", msg);
std::vector<Material> materials; std::vector<Material> materials;
materials.reserve(5); materials.reserve(5);
@ -857,7 +857,7 @@ void AC3DImporter::InternReadFile( const std::string& pFile,
} }
if (materials.empty()) if (materials.empty())
{ {
DefaultLogger::get()->warn("AC3D: No material has been found"); ASSIMP_LOG_WARN("AC3D: No material has been found");
materials.push_back(Material()); materials.push_back(Material());
} }

View File

@ -200,7 +200,7 @@ void ASEImporter::InternReadFile( const std::string& pFile,
ConvertMeshes(*i,avOutMeshes); ConvertMeshes(*i,avOutMeshes);
} }
if (tookNormals) { if (tookNormals) {
DefaultLogger::get()->debug("ASE: Taking normals from the file. Use " ASSIMP_LOG_DEBUG("ASE: Taking normals from the file. Use "
"the AI_CONFIG_IMPORT_ASE_RECONSTRUCT_NORMALS setting if you " "the AI_CONFIG_IMPORT_ASE_RECONSTRUCT_NORMALS setting if you "
"experience problems"); "experience problems");
} }
@ -297,15 +297,15 @@ void ASEImporter::BuildAnimations(const std::vector<BaseNode*>& nodes)
// TODO: Implement Bezier & TCB support // TODO: Implement Bezier & TCB support
if ((*i)->mAnim.mPositionType != ASE::Animation::TRACK) { if ((*i)->mAnim.mPositionType != ASE::Animation::TRACK) {
DefaultLogger::get()->warn("ASE: Position controller uses Bezier/TCB keys. " ASSIMP_LOG_WARN("ASE: Position controller uses Bezier/TCB keys. "
"This is not supported."); "This is not supported.");
} }
if ((*i)->mAnim.mRotationType != ASE::Animation::TRACK) { if ((*i)->mAnim.mRotationType != ASE::Animation::TRACK) {
DefaultLogger::get()->warn("ASE: Rotation controller uses Bezier/TCB keys. " ASSIMP_LOG_WARN("ASE: Rotation controller uses Bezier/TCB keys. "
"This is not supported."); "This is not supported.");
} }
if ((*i)->mAnim.mScalingType != ASE::Animation::TRACK) { if ((*i)->mAnim.mScalingType != ASE::Animation::TRACK) {
DefaultLogger::get()->warn("ASE: Position controller uses Bezier/TCB keys. " ASSIMP_LOG_WARN("ASE: Position controller uses Bezier/TCB keys. "
"This is not supported."); "This is not supported.");
} }
@ -624,7 +624,7 @@ void ASEImporter::AddNodes (const std::vector<BaseNode*>& nodes,
node->mNumChildren++; node->mNumChildren++;
// What we did is so great, it is at least worth a debug message // What we did is so great, it is at least worth a debug message
DefaultLogger::get()->debug("ASE: Generating separate target node ("+snode->mName+")"); ASSIMP_LOG_DEBUG("ASE: Generating separate target node ("+snode->mName+")");
} }
} }
@ -947,7 +947,7 @@ void ASEImporter::ConvertMeshes(ASE::Mesh& mesh, std::vector<aiMesh*>& avOutMesh
// validate the material index of the mesh // validate the material index of the mesh
if (mesh.iMaterialIndex >= mParser->m_vMaterials.size()) { if (mesh.iMaterialIndex >= mParser->m_vMaterials.size()) {
mesh.iMaterialIndex = (unsigned int)mParser->m_vMaterials.size()-1; mesh.iMaterialIndex = (unsigned int)mParser->m_vMaterials.size()-1;
DefaultLogger::get()->warn("Material index is out of range"); ASSIMP_LOG_WARN("Material index is out of range");
} }
// If the material the mesh is assigned to is consisting of submeshes, split it // If the material the mesh is assigned to is consisting of submeshes, split it
@ -957,11 +957,11 @@ void ASEImporter::ConvertMeshes(ASE::Mesh& mesh, std::vector<aiMesh*>& avOutMesh
std::vector<unsigned int>* aiSplit = new std::vector<unsigned int>[vSubMaterials.size()]; std::vector<unsigned int>* aiSplit = new std::vector<unsigned int>[vSubMaterials.size()];
// build a list of all faces per submaterial // build a list of all faces per sub-material
for (unsigned int i = 0; i < mesh.mFaces.size();++i) { for (unsigned int i = 0; i < mesh.mFaces.size();++i) {
// check range // check range
if (mesh.mFaces[i].iMaterial >= vSubMaterials.size()) { if (mesh.mFaces[i].iMaterial >= vSubMaterials.size()) {
DefaultLogger::get()->warn("Submaterial index is out of range"); ASSIMP_LOG_WARN("Submaterial index is out of range");
// use the last material instead // use the last material instead
aiSplit[vSubMaterials.size()-1].push_back(i); aiSplit[vSubMaterials.size()-1].push_back(i);

View File

@ -151,7 +151,7 @@ void Parser::LogWarning(const char* szWarn)
#endif #endif
// output the warning to the logger ... // output the warning to the logger ...
DefaultLogger::get()->warn(szTemp); ASSIMP_LOG_WARN(szTemp);
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
@ -167,7 +167,7 @@ void Parser::LogInfo(const char* szWarn)
#endif #endif
// output the information to the logger ... // output the information to the logger ...
DefaultLogger::get()->info(szTemp); ASSIMP_LOG_INFO(szTemp);
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
@ -758,7 +758,7 @@ void Parser::ParseLV3MapBlock(Texture& map)
SkipToNextToken(); SkipToNextToken();
if (temp != "Bitmap" && temp != "Normal Bump") if (temp != "Bitmap" && temp != "Normal Bump")
{ {
DefaultLogger::get()->warn("ASE: Skipping unknown map type: " + temp); ASSIMP_LOG_WARN_F("ASE: Skipping unknown map type: ", temp);
parsePath = false; parsePath = false;
} }
continue; continue;
@ -773,7 +773,7 @@ void Parser::ParseLV3MapBlock(Texture& map)
{ {
// Files with 'None' as map name are produced by // Files with 'None' as map name are produced by
// an Maja to ASE exporter which name I forgot .. // an Maja to ASE exporter which name I forgot ..
DefaultLogger::get()->warn("ASE: Skipping invalid map entry"); ASSIMP_LOG_WARN("ASE: Skipping invalid map entry");
map.mMapName = ""; map.mMapName = "";
} }
@ -1072,7 +1072,7 @@ void Parser::ParseLV2AnimationBlock(ASE::BaseNode& mesh)
( mesh.mType != BaseNode::Light || ((ASE::Light&)mesh).mLightType != ASE::Light::TARGET)) ( mesh.mType != BaseNode::Light || ((ASE::Light&)mesh).mLightType != ASE::Light::TARGET))
{ {
DefaultLogger::get()->error("ASE: Found target animation channel " ASSIMP_LOG_ERROR("ASE: Found target animation channel "
"but the node is neither a camera nor a spot light"); "but the node is neither a camera nor a spot light");
anim = NULL; anim = NULL;
} }
@ -1098,7 +1098,7 @@ void Parser::ParseLV2AnimationBlock(ASE::BaseNode& mesh)
if (!anim || anim == &mesh.mTargetAnim) if (!anim || anim == &mesh.mTargetAnim)
{ {
// Target animation channels may have no rotation channels // Target animation channels may have no rotation channels
DefaultLogger::get()->error("ASE: Ignoring scaling channel in target animation"); ASSIMP_LOG_ERROR("ASE: Ignoring scaling channel in target animation");
SkipSection(); SkipSection();
} }
else ParseLV3ScaleAnimationBlock(*anim); else ParseLV3ScaleAnimationBlock(*anim);
@ -1112,7 +1112,7 @@ void Parser::ParseLV2AnimationBlock(ASE::BaseNode& mesh)
if (!anim || anim == &mesh.mTargetAnim) if (!anim || anim == &mesh.mTargetAnim)
{ {
// Target animation channels may have no rotation channels // Target animation channels may have no rotation channels
DefaultLogger::get()->error("ASE: Ignoring rotation channel in target animation"); ASSIMP_LOG_ERROR("ASE: Ignoring rotation channel in target animation");
SkipSection(); SkipSection();
} }
else ParseLV3RotAnimationBlock(*anim); else ParseLV3RotAnimationBlock(*anim);
@ -1295,12 +1295,14 @@ void Parser::ParseLV2NodeTransformBlock(ASE::BaseNode& mesh)
{ {
mode = 2; mode = 2;
} }
else DefaultLogger::get()->error("ASE: Ignoring target transform, " else {
"this is no spot light or target camera"); ASSIMP_LOG_ERROR("ASE: Ignoring target transform, "
"this is no spot light or target camera");
}
} }
else else
{ {
DefaultLogger::get()->error("ASE: Unknown node transformation: " + temp); ASSIMP_LOG_ERROR("ASE: Unknown node transformation: " + temp);
// mode = 0 // mode = 0
} }
continue; continue;
@ -1916,7 +1918,7 @@ void Parser::ParseLV3MeshNormalListBlock(ASE::Mesh& sMesh)
else if (index == face.mIndices[2]) else if (index == face.mIndices[2])
index = 2; index = 2;
else { else {
DefaultLogger::get()->error("ASE: Invalid vertex index in MESH_VERTEXNORMAL section"); ASSIMP_LOG_ERROR("ASE: Invalid vertex index in MESH_VERTEXNORMAL section");
continue; continue;
} }
// We'll renormalize later // We'll renormalize later
@ -1928,7 +1930,7 @@ void Parser::ParseLV3MeshNormalListBlock(ASE::Mesh& sMesh)
ParseLV4MeshFloatTriple(&vNormal.x,faceIdx); ParseLV4MeshFloatTriple(&vNormal.x,faceIdx);
if (faceIdx >= sMesh.mFaces.size()) { if (faceIdx >= sMesh.mFaces.size()) {
DefaultLogger::get()->error("ASE: Invalid vertex index in MESH_FACENORMAL section"); ASSIMP_LOG_ERROR("ASE: Invalid vertex index in MESH_FACENORMAL section");
continue; continue;
} }

View File

@ -614,7 +614,7 @@ void B3DImporter::ReadBB3D( aiScene *scene ){
if (!DefaultLogger::isNullLogger()) { if (!DefaultLogger::isNullLogger()) {
char dmp[128]; char dmp[128];
ai_snprintf(dmp, 128, "B3D file format version: %i",version); ai_snprintf(dmp, 128, "B3D file format version: %i",version);
DefaultLogger::get()->info(dmp); ASSIMP_LOG_INFO(dmp);
} }
while( ChunkSize() ){ while( ChunkSize() ){

View File

@ -64,23 +64,24 @@ using namespace Assimp;
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Constructor to be privately used by Importer // Constructor to be privately used by Importer
BaseImporter::BaseImporter() BaseImporter::BaseImporter()
: m_progress() : m_progress() {
{
// nothing to do here // nothing to do here
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Destructor, private as well // Destructor, private as well
BaseImporter::~BaseImporter() BaseImporter::~BaseImporter() {
{
// nothing to do here // nothing to do here
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Imports the given file and returns the imported data. // Imports the given file and returns the imported data.
aiScene* BaseImporter::ReadFile(const Importer* pImp, const std::string& pFile, IOSystem* pIOHandler) aiScene* BaseImporter::ReadFile(const Importer* pImp, const std::string& pFile, IOSystem* pIOHandler) {
{
m_progress = pImp->GetProgressHandler(); m_progress = pImp->GetProgressHandler();
if (nullptr == m_progress) {
return nullptr;
}
ai_assert(m_progress); ai_assert(m_progress);
// Gather configuration properties for this run // Gather configuration properties for this run
@ -100,8 +101,8 @@ aiScene* BaseImporter::ReadFile(const Importer* pImp, const std::string& pFile,
} catch( const std::exception& err ) { } catch( const std::exception& err ) {
// extract error description // extract error description
m_ErrorText = err.what(); m_ErrorText = err.what();
DefaultLogger::get()->error(m_ErrorText); ASSIMP_LOG_ERROR(m_ErrorText);
return NULL; return nullptr;
} }
// return what we gathered from the import. // return what we gathered from the import.
@ -195,7 +196,7 @@ void BaseImporter::GetExtensionList(std::set<std::string>& extensions) {
// We got a match, either we don't care where it is, or it happens to // We got a match, either we don't care where it is, or it happens to
// be in the beginning of the file / line // be in the beginning of the file / line
if (!tokensSol || r == buffer || r[-1] == '\r' || r[-1] == '\n') { if (!tokensSol || r == buffer || r[-1] == '\r' || r[-1] == '\n') {
DefaultLogger::get()->debug(std::string("Found positive match for header keyword: ") + tokens[i]); ASSIMP_LOG_DEBUG_F( "Found positive match for header keyword: ", tokens[i] );
return true; return true;
} }
} }
@ -322,7 +323,7 @@ void BaseImporter::ConvertToUTF8(std::vector<char>& data)
// UTF 8 with BOM // UTF 8 with BOM
if((uint8_t)data[0] == 0xEF && (uint8_t)data[1] == 0xBB && (uint8_t)data[2] == 0xBF) { if((uint8_t)data[0] == 0xEF && (uint8_t)data[1] == 0xBB && (uint8_t)data[2] == 0xBF) {
DefaultLogger::get()->debug("Found UTF-8 BOM ..."); ASSIMP_LOG_DEBUG("Found UTF-8 BOM ...");
std::copy(data.begin()+3,data.end(),data.begin()); std::copy(data.begin()+3,data.end(),data.begin());
data.resize(data.size()-3); data.resize(data.size()-3);
@ -341,7 +342,7 @@ void BaseImporter::ConvertToUTF8(std::vector<char>& data)
// UTF 32 LE with BOM // UTF 32 LE with BOM
if(*((uint32_t*)&data.front()) == 0x0000FFFE) { if(*((uint32_t*)&data.front()) == 0x0000FFFE) {
DefaultLogger::get()->debug("Found UTF-32 BOM ..."); ASSIMP_LOG_DEBUG("Found UTF-32 BOM ...");
std::vector<char> output; std::vector<char> output;
int *ptr = (int*)&data[ 0 ]; int *ptr = (int*)&data[ 0 ];
@ -361,7 +362,7 @@ void BaseImporter::ConvertToUTF8(std::vector<char>& data)
// UTF 16 LE with BOM // UTF 16 LE with BOM
if(*((uint16_t*)&data.front()) == 0xFEFF) { if(*((uint16_t*)&data.front()) == 0xFEFF) {
DefaultLogger::get()->debug("Found UTF-16 BOM ..."); ASSIMP_LOG_DEBUG("Found UTF-16 BOM ...");
std::vector<unsigned char> output; std::vector<unsigned char> output;
utf8::utf16to8(data.begin(), data.end(), back_inserter(output)); utf8::utf16to8(data.begin(), data.end(), back_inserter(output));
@ -386,16 +387,14 @@ void BaseImporter::ConvertUTF8toISO8859_1(std::string& data)
data[j] = ((unsigned char) data[++i] + 0x40); data[j] = ((unsigned char) data[++i] + 0x40);
} else { } else {
std::stringstream stream; std::stringstream stream;
stream << "UTF8 code " << std::hex << data[i] << data[i + 1] << " can not be converted into ISA-8859-1."; stream << "UTF8 code " << std::hex << data[i] << data[i + 1] << " can not be converted into ISA-8859-1.";
ASSIMP_LOG_ERROR( stream.str() );
DefaultLogger::get()->error(stream.str());
data[j++] = data[i++]; data[j++] = data[i++];
data[j] = data[i]; data[j] = data[i];
} }
} else { } else {
DefaultLogger::get()->error("UTF8 code but only one character remaining"); ASSIMP_LOG_ERROR("UTF8 code but only one character remaining");
data[j] = data[i]; data[j] = data[i];
} }
@ -411,7 +410,7 @@ void BaseImporter::TextFileToBuffer(IOStream* stream,
std::vector<char>& data, std::vector<char>& data,
TextFileMode mode) TextFileMode mode)
{ {
ai_assert(NULL != stream); ai_assert(nullptr != stream);
const size_t fileSize = stream->FileSize(); const size_t fileSize = stream->FileSize();
if (mode == FORBID_EMPTY) { if (mode == FORBID_EMPTY) {
@ -472,14 +471,14 @@ struct Assimp::BatchData {
, pImporter( nullptr ) , pImporter( nullptr )
, next_id(0xffff) , next_id(0xffff)
, validate( validate ) { , validate( validate ) {
ai_assert( NULL != pIO ); ai_assert( nullptr != pIO );
pImporter = new Importer(); pImporter = new Importer();
pImporter->SetIOHandler( pIO ); pImporter->SetIOHandler( pIO );
} }
~BatchData() { ~BatchData() {
pImporter->SetIOHandler( NULL ); /* get pointer back into our possession */ pImporter->SetIOHandler( nullptr ); /* get pointer back into our possession */
delete pImporter; delete pImporter;
} }
@ -505,9 +504,8 @@ struct Assimp::BatchData {
typedef std::list<LoadRequest>::iterator LoadReqIt; typedef std::list<LoadRequest>::iterator LoadReqIt;
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
BatchLoader::BatchLoader(IOSystem* pIO, bool validate ) BatchLoader::BatchLoader(IOSystem* pIO, bool validate ) {
{ ai_assert(nullptr != pIO);
ai_assert(NULL != pIO);
m_data = new BatchData( pIO, validate ); m_data = new BatchData( pIO, validate );
} }
@ -573,7 +571,7 @@ aiScene* BatchLoader::GetImport( unsigned int which )
return sc; return sc;
} }
} }
return NULL; return nullptr;
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
@ -596,13 +594,13 @@ void BatchLoader::LoadAll()
if (!DefaultLogger::isNullLogger()) if (!DefaultLogger::isNullLogger())
{ {
DefaultLogger::get()->info("%%% BEGIN EXTERNAL FILE %%%"); ASSIMP_LOG_INFO("%%% BEGIN EXTERNAL FILE %%%");
DefaultLogger::get()->info("File: " + (*it).file); ASSIMP_LOG_INFO("File: ", (*it).file);
} }
m_data->pImporter->ReadFile((*it).file,pp); m_data->pImporter->ReadFile((*it).file,pp);
(*it).scene = m_data->pImporter->GetOrphanedScene(); (*it).scene = m_data->pImporter->GetOrphanedScene();
(*it).loaded = true; (*it).loaded = true;
DefaultLogger::get()->info("%%% END EXTERNAL FILE %%%"); ASSIMP_LOG_INFO("%%% END EXTERNAL FILE %%%");
} }
} }

View File

@ -85,7 +85,7 @@ void BaseProcess::ExecuteOnScene( Importer* pImp)
// extract error description // extract error description
pImp->Pimpl()->mErrorString = err.what(); pImp->Pimpl()->mErrorString = err.what();
DefaultLogger::get()->error(pImp->Pimpl()->mErrorString); ASSIMP_LOG_ERROR(pImp->Pimpl()->mErrorString);
// and kill the partially imported data // and kill the partially imported data
delete pImp->Pimpl()->mScene; delete pImp->Pimpl()->mScene;

View File

@ -210,8 +210,7 @@ void DNAParser::Parse ()
s.size = offset; s.size = offset;
} }
DefaultLogger::get()->debug((format(),"BlenderDNA: Got ",dna.structures.size(), ASSIMP_LOG_DEBUG( "BlenderDNA: Got ", dna.structures.size()," structures with totally ",fields," fields");
" structures with totally ",fields," fields"));
#ifdef ASSIMP_BUILD_BLENDER_DEBUG #ifdef ASSIMP_BUILD_BLENDER_DEBUG
dna.DumpToFile(); dna.DumpToFile();
@ -233,7 +232,7 @@ void DNA :: DumpToFile()
std::ofstream f("dna.txt"); std::ofstream f("dna.txt");
if (f.fail()) { if (f.fail()) {
DefaultLogger::get()->error("Could not dump dna to dna.txt"); ASSIMP_LOG_ERROR("Could not dump dna to dna.txt");
return; return;
} }
f << "Field format: type name offset size" << "\n"; f << "Field format: type name offset size" << "\n";
@ -248,7 +247,7 @@ void DNA :: DumpToFile()
} }
f << std::flush; f << std::flush;
DefaultLogger::get()->info("BlenderDNA: Dumped dna to dna.txt"); ASSIMP_LOG_INFO("BlenderDNA: Dumped dna to dna.txt");
} }
#endif #endif
@ -367,7 +366,7 @@ void SectionParser :: Next()
} }
#ifdef ASSIMP_BUILD_BLENDER_DEBUG #ifdef ASSIMP_BUILD_BLENDER_DEBUG
DefaultLogger::get()->debug(current.id); ASSIMP_LOG_DEBUG(current.id);
#endif #endif
} }

View File

@ -381,7 +381,7 @@ template <> struct Structure :: _defaultInitializer<ErrorPolicy_Warn> {
template <typename T> template <typename T>
void operator ()(T& out, const char* reason = "<add reason>") { void operator ()(T& out, const char* reason = "<add reason>") {
DefaultLogger::get()->warn(reason); ASSIMP_LOG_WARN(reason);
// ... and let the show go on // ... and let the show go on
_defaultInitializer<0 /*ErrorPolicy_Igno*/>()(out); _defaultInitializer<0 /*ErrorPolicy_Igno*/>()(out);

View File

@ -468,9 +468,7 @@ template <> bool Structure :: ResolvePointer<std::shared_ptr,ElemBase>(std::shar
// this might happen if DNA::RegisterConverters hasn't been called so far // this might happen if DNA::RegisterConverters hasn't been called so far
// or if the target type is not contained in `our` DNA. // or if the target type is not contained in `our` DNA.
out.reset(); out.reset();
DefaultLogger::get()->warn((Formatter::format(), ASSIMP_LOG_WARN( "Failed to find a converter for the `",s.name,"` structure" );
"Failed to find a converter for the `",s.name,"` structure"
));
return false; return false;
} }

View File

@ -327,12 +327,12 @@ void BlenderImporter::ExtractScene(Scene& out, const FileDatabase& file)
ss.Convert(out,file); ss.Convert(out,file);
#ifndef ASSIMP_BUILD_BLENDER_NO_STATS #ifndef ASSIMP_BUILD_BLENDER_NO_STATS
DefaultLogger::get()->info((format(), ASSIMP_LOG_INFO_F(
"(Stats) Fields read: " ,file.stats().fields_read, "(Stats) Fields read: " ,file.stats().fields_read,
", pointers resolved: " ,file.stats().pointers_resolved, ", pointers resolved: " ,file.stats().pointers_resolved,
", cache hits: " ,file.stats().cache_hits, ", cache hits: " ,file.stats().cache_hits,
", cached objects: " ,file.stats().cached_objects ", cached objects: " ,file.stats().cached_objects
)); );
#endif #endif
} }

View File

@ -86,7 +86,7 @@ public:
const Scene& /*in*/, const Scene& /*in*/,
const Object& /*orig_object*/ const Object& /*orig_object*/
) { ) {
DefaultLogger::get()->warn((Formatter::format("This modifier is not supported, skipping: "),orig_modifier.dna_type)); ASSIMP_LOG_INFO_F("This modifier is not supported, skipping: "),orig_modifier.dna_type);
return; return;
} }
}; };

View File

@ -150,7 +150,7 @@ void COBImporter::InternReadFile( const std::string& pFile,
ThrowException("Could not found magic id: `Caligari`"); ThrowException("Could not found magic id: `Caligari`");
} }
DefaultLogger::get()->info("File format tag: "+std::string(head+9,6)); ASSIMP_LOG_INFO_F("File format tag: ",std::string(head+9,6));
if (head[16]!='L') { if (head[16]!='L') {
ThrowException("File is big-endian, which is not supported"); ThrowException("File is big-endian, which is not supported");
} }
@ -303,7 +303,7 @@ aiNode* COBImporter::BuildNodes(const Node& root,const Scene& scin,aiScene* fill
} }
std::unique_ptr<const Material> defmat; std::unique_ptr<const Material> defmat;
if(!min) { if(!min) {
DefaultLogger::get()->debug(format()<<"Could not resolve material index " ASSIMP_LOG_DEBUG(format()<<"Could not resolve material index "
<<reflist.first<<" - creating default material for this slot"); <<reflist.first<<" - creating default material for this slot");
defmat.reset(min=new Material()); defmat.reset(min=new Material());
@ -475,7 +475,7 @@ void COBImporter::UnsupportedChunk_Ascii(LineSplitter& splitter, const ChunkInfo
// we can recover if the chunk size was specified. // we can recover if the chunk size was specified.
if(nfo.size != static_cast<unsigned int>(-1)) { if(nfo.size != static_cast<unsigned int>(-1)) {
DefaultLogger::get()->error(error); ASSIMP_LOG_ERROR(error);
// (HACK) - our current position in the stream is the beginning of the // (HACK) - our current position in the stream is the beginning of the
// head line of the next chunk. That's fine, but the caller is going // head line of the next chunk. That's fine, but the caller is going
@ -935,7 +935,7 @@ void COBImporter::UnsupportedChunk_Binary( StreamReaderLE& reader, const ChunkIn
// we can recover if the chunk size was specified. // we can recover if the chunk size was specified.
if(nfo.size != static_cast<unsigned int>(-1)) { if(nfo.size != static_cast<unsigned int>(-1)) {
DefaultLogger::get()->error(error); ASSIMP_LOG_ERROR(error);
reader.IncPtr(nfo.size); reader.IncPtr(nfo.size);
} }
else ThrowException(error); else ThrowException(error);

View File

@ -294,7 +294,7 @@ void ColladaLoader::ResolveNodeInstances( const ColladaParser& pParser, const Co
nd = FindNode(pParser.mRootNode, nodeInst.mNode); nd = FindNode(pParser.mRootNode, nodeInst.mNode);
} }
if (!nd) if (!nd)
DefaultLogger::get()->error("Collada: Unable to resolve reference to instanced node " + nodeInst.mNode); ASSIMP_LOG_ERROR_F("Collada: Unable to resolve reference to instanced node ", nodeInst.mNode);
else { else {
// attach this node to the list of children // attach this node to the list of children
@ -311,7 +311,7 @@ void ColladaLoader::ApplyVertexToEffectSemanticMapping(Collada::Sampler& sampler
std::map<std::string, Collada::InputSemanticMapEntry>::const_iterator it = table.mMap.find(sampler.mUVChannel); std::map<std::string, Collada::InputSemanticMapEntry>::const_iterator it = table.mMap.find(sampler.mUVChannel);
if (it != table.mMap.end()) { if (it != table.mMap.end()) {
if (it->second.mType != Collada::IT_Texcoord) if (it->second.mType != Collada::IT_Texcoord)
DefaultLogger::get()->error("Collada: Unexpected effect input mapping"); ASSIMP_LOG_ERROR("Collada: Unexpected effect input mapping");
sampler.mUVId = it->second.mSet; sampler.mUVId = it->second.mSet;
} }
@ -327,7 +327,7 @@ void ColladaLoader::BuildLightsForNode( const ColladaParser& pParser, const Coll
ColladaParser::LightLibrary::const_iterator srcLightIt = pParser.mLightLibrary.find( lid.mLight); ColladaParser::LightLibrary::const_iterator srcLightIt = pParser.mLightLibrary.find( lid.mLight);
if( srcLightIt == pParser.mLightLibrary.end()) if( srcLightIt == pParser.mLightLibrary.end())
{ {
DefaultLogger::get()->warn("Collada: Unable to find light for ID \"" + lid.mLight + "\". Skipping."); ASSIMP_LOG_WARN_F("Collada: Unable to find light for ID \"" , lid.mLight , "\". Skipping.");
continue; continue;
} }
const Collada::Light* srcLight = &srcLightIt->second; const Collada::Light* srcLight = &srcLightIt->second;
@ -395,14 +395,14 @@ void ColladaLoader::BuildCamerasForNode( const ColladaParser& pParser, const Col
ColladaParser::CameraLibrary::const_iterator srcCameraIt = pParser.mCameraLibrary.find( cid.mCamera); ColladaParser::CameraLibrary::const_iterator srcCameraIt = pParser.mCameraLibrary.find( cid.mCamera);
if( srcCameraIt == pParser.mCameraLibrary.end()) if( srcCameraIt == pParser.mCameraLibrary.end())
{ {
DefaultLogger::get()->warn("Collada: Unable to find camera for ID \"" + cid.mCamera + "\". Skipping."); ASSIMP_LOG_WARN_F("Collada: Unable to find camera for ID \"" , cid.mCamera , "\". Skipping.");
continue; continue;
} }
const Collada::Camera* srcCamera = &srcCameraIt->second; const Collada::Camera* srcCamera = &srcCameraIt->second;
// orthographic cameras not yet supported in Assimp // orthographic cameras not yet supported in Assimp
if (srcCamera->mOrtho) { if (srcCamera->mOrtho) {
DefaultLogger::get()->warn("Collada: Orthographic cameras are not supported."); ASSIMP_LOG_WARN("Collada: Orthographic cameras are not supported.");
} }
// now fill our ai data structure // now fill our ai data structure
@ -472,7 +472,7 @@ void ColladaLoader::BuildMeshesForNode( const ColladaParser& pParser, const Coll
if( !srcMesh) if( !srcMesh)
{ {
DefaultLogger::get()->warn( format() << "Collada: Unable to find geometry for ID \"" << mid.mMeshOrController << "\". Skipping." ); ASSIMP_LOG_WARN( "Collada: Unable to find geometry for ID \"", mid.mMeshOrController, "\". Skipping." );
continue; continue;
} }
} else } else
@ -501,7 +501,8 @@ void ColladaLoader::BuildMeshesForNode( const ColladaParser& pParser, const Coll
} }
else else
{ {
DefaultLogger::get()->warn( format() << "Collada: No material specified for subgroup <" << submesh.mMaterial << "> in geometry <" << mid.mMeshOrController << ">." ); ASSIMP_LOG_WARN_F( "Collada: No material specified for subgroup <", submesh.mMaterial, "> in geometry <",
mid.mMeshOrController, ">." );
if( !mid.mMaterials.empty() ) if( !mid.mMaterials.empty() )
meshMaterial = mid.mMaterials.begin()->second.mMatName; meshMaterial = mid.mMaterials.begin()->second.mMatName;
} }
@ -874,7 +875,7 @@ aiMesh* ColladaLoader::CreateMesh( const ColladaParser& pParser, const Collada::
if( bnode) if( bnode)
bone->mName.Set( FindNameForNode( bnode)); bone->mName.Set( FindNameForNode( bnode));
else else
DefaultLogger::get()->warn( format() << "ColladaLoader::CreateMesh(): could not find corresponding node for joint \"" << bone->mName.data << "\"." ); ASSIMP_LOG_WARN( "ColladaLoader::CreateMesh(): could not find corresponding node for joint \"", bone->mName.data, "\"." );
// and insert bone // and insert bone
dstMesh->mBones[boneCount++] = bone; dstMesh->mBones[boneCount++] = bone;
@ -1175,7 +1176,7 @@ void ColladaLoader::CreateAnimation( aiScene* pScene, const ColladaParser& pPars
else if( subElement == "Z") else if( subElement == "Z")
entry.mSubElement = 2; entry.mSubElement = 2;
else else
DefaultLogger::get()->warn( format() << "Unknown anim subelement <" << subElement << ">. Ignoring" ); ASSIMP_LOG_WARN( "Unknown anim subelement <", subElement, ">. Ignoring" );
} else } else
{ {
// no subelement following, transformId is remaining string // no subelement following, transformId is remaining string
@ -1406,7 +1407,7 @@ void ColladaLoader::CreateAnimation( aiScene* pScene, const ColladaParser& pPars
anims.push_back( dstAnim); anims.push_back( dstAnim);
} else } else
{ {
DefaultLogger::get()->warn( "Collada loader: found empty animation channel, ignored. Please check your exporter."); ASSIMP_LOG_WARN( "Collada loader: found empty animation channel, ignored. Please check your exporter.");
} }
if( !entries.empty() && entries.front().mTimeAccessor->mCount > 0 ) if( !entries.empty() && entries.front().mTimeAccessor->mCount > 0 )
@ -1561,7 +1562,7 @@ void ColladaLoader::AddTexture ( aiMaterial& mat, const ColladaParser& pParser,
} }
} }
if (-1 == map) { if (-1 == map) {
DefaultLogger::get()->warn("Collada: unable to determine UV channel for texture"); ASSIMP_LOG_WARN("Collada: unable to determine UV channel for texture");
map = 0; map = 0;
} }
} }
@ -1598,7 +1599,7 @@ void ColladaLoader::FillMaterials( const ColladaParser& pParser, aiScene* /*pSce
break; break;
default: default:
DefaultLogger::get()->warn("Collada: Unrecognized shading mode, using gouraud shading"); ASSIMP_LOG_WARN("Collada: Unrecognized shading mode, using gouraud shading");
shadeMode = aiShadingMode_Gouraud; shadeMode = aiShadingMode_Gouraud;
break; break;
} }
@ -1752,11 +1753,7 @@ aiString ColladaLoader::FindFilenameForEffectTexture( const ColladaParser& pPars
ColladaParser::ImageLibrary::const_iterator imIt = pParser.mImageLibrary.find( name); ColladaParser::ImageLibrary::const_iterator imIt = pParser.mImageLibrary.find( name);
if( imIt == pParser.mImageLibrary.end()) if( imIt == pParser.mImageLibrary.end())
{ {
//missing texture should not stop the conversion ASSIMP_LOG_WARN_F("Collada: Unable to resolve effect texture entry \"", pName, "\", ended up at ID \"", name, "\".");
//throw DeadlyImportError( format() <<
// "Collada: Unable to resolve effect texture entry \"" << pName << "\", ended up at ID \"" << name << "\"." );
DefaultLogger::get()->warn("Collada: Unable to resolve effect texture entry \"" + pName + "\", ended up at ID \"" + name + "\".");
//set default texture file name //set default texture file name
result.Set(name + ".jpg"); result.Set(name + ".jpg");
@ -1775,7 +1772,7 @@ aiString ColladaLoader::FindFilenameForEffectTexture( const ColladaParser& pPars
// setup format hint // setup format hint
if (imIt->second.mEmbeddedFormat.length() > 3) { if (imIt->second.mEmbeddedFormat.length() > 3) {
DefaultLogger::get()->warn("Collada: texture format hint is too long, truncating to 3 characters"); ASSIMP_LOG_WARN("Collada: texture format hint is too long, truncating to 3 characters");
} }
strncpy(tex->achFormatHint,imIt->second.mEmbeddedFormat.c_str(),3); strncpy(tex->achFormatHint,imIt->second.mEmbeddedFormat.c_str(),3);

View File

@ -152,22 +152,22 @@ void ColladaParser::ReadContents()
if (!::strncmp(version,"1.5",3)) { if (!::strncmp(version,"1.5",3)) {
mFormat = FV_1_5_n; mFormat = FV_1_5_n;
DefaultLogger::get()->debug("Collada schema version is 1.5.n"); ASSIMP_LOG_DEBUG("Collada schema version is 1.5.n");
} }
else if (!::strncmp(version,"1.4",3)) { else if (!::strncmp(version,"1.4",3)) {
mFormat = FV_1_4_n; mFormat = FV_1_4_n;
DefaultLogger::get()->debug("Collada schema version is 1.4.n"); ASSIMP_LOG_DEBUG("Collada schema version is 1.4.n");
} }
else if (!::strncmp(version,"1.3",3)) { else if (!::strncmp(version,"1.3",3)) {
mFormat = FV_1_3_n; mFormat = FV_1_3_n;
DefaultLogger::get()->debug("Collada schema version is 1.3.n"); ASSIMP_LOG_DEBUG("Collada schema version is 1.3.n");
} }
} }
ReadStructure(); ReadStructure();
} else } else
{ {
DefaultLogger::get()->debug( format() << "Ignoring global element <" << mReader->getNodeName() << ">." ); ASSIMP_LOG_DEBUG_F( "Ignoring global element <", mReader->getNodeName(), ">." );
SkipElement(); SkipElement();
} }
} else } else
@ -984,13 +984,13 @@ void ColladaParser::ReadImage( Collada::Image& pImage)
// they're not skipped. // they're not skipped.
int attrib = TestAttribute("array_index"); int attrib = TestAttribute("array_index");
if (attrib != -1 && mReader->getAttributeValueAsInt(attrib) > 0) { if (attrib != -1 && mReader->getAttributeValueAsInt(attrib) > 0) {
DefaultLogger::get()->warn("Collada: Ignoring texture array index"); ASSIMP_LOG_WARN("Collada: Ignoring texture array index");
continue; continue;
} }
attrib = TestAttribute("mip_index"); attrib = TestAttribute("mip_index");
if (attrib != -1 && mReader->getAttributeValueAsInt(attrib) > 0) { if (attrib != -1 && mReader->getAttributeValueAsInt(attrib) > 0) {
DefaultLogger::get()->warn("Collada: Ignoring MIP map layer"); ASSIMP_LOG_WARN("Collada: Ignoring MIP map layer");
continue; continue;
} }
@ -1011,7 +1011,7 @@ void ColladaParser::ReadImage( Collada::Image& pImage)
// embedded image. get format // embedded image. get format
const int attrib = TestAttribute("format"); const int attrib = TestAttribute("format");
if (-1 == attrib) if (-1 == attrib)
DefaultLogger::get()->warn("Collada: Unknown image file format"); ASSIMP_LOG_WARN("Collada: Unknown image file format");
else pImage.mEmbeddedFormat = mReader->getAttributeValue(attrib); else pImage.mEmbeddedFormat = mReader->getAttributeValue(attrib);
const char* data = GetTextContent(); const char* data = GetTextContent();
@ -1590,7 +1590,7 @@ void ColladaParser::ReadSamplerProperties( Sampler& out )
out.mOp = aiTextureOp_Multiply; out.mOp = aiTextureOp_Multiply;
else { else {
DefaultLogger::get()->warn("Collada: Unsupported MAYA texture blend mode"); ASSIMP_LOG_WARN("Collada: Unsupported MAYA texture blend mode");
} }
TestClosing( "blend_mode"); TestClosing( "blend_mode");
} }
@ -2541,7 +2541,7 @@ void ColladaParser::ExtractDataObjectFromChannel( const InputChannel& pInput, si
if( pInput.mIndex == 0) if( pInput.mIndex == 0)
pMesh->mPositions.push_back( aiVector3D( obj[0], obj[1], obj[2])); pMesh->mPositions.push_back( aiVector3D( obj[0], obj[1], obj[2]));
else else
DefaultLogger::get()->error("Collada: just one vertex position stream supported"); ASSIMP_LOG_ERROR("Collada: just one vertex position stream supported");
break; break;
case IT_Normal: case IT_Normal:
// pad to current vertex count if necessary // pad to current vertex count if necessary
@ -2552,7 +2552,7 @@ void ColladaParser::ExtractDataObjectFromChannel( const InputChannel& pInput, si
if( pInput.mIndex == 0) if( pInput.mIndex == 0)
pMesh->mNormals.push_back( aiVector3D( obj[0], obj[1], obj[2])); pMesh->mNormals.push_back( aiVector3D( obj[0], obj[1], obj[2]));
else else
DefaultLogger::get()->error("Collada: just one vertex normal stream supported"); ASSIMP_LOG_ERROR("Collada: just one vertex normal stream supported");
break; break;
case IT_Tangent: case IT_Tangent:
// pad to current vertex count if necessary // pad to current vertex count if necessary
@ -2563,7 +2563,7 @@ void ColladaParser::ExtractDataObjectFromChannel( const InputChannel& pInput, si
if( pInput.mIndex == 0) if( pInput.mIndex == 0)
pMesh->mTangents.push_back( aiVector3D( obj[0], obj[1], obj[2])); pMesh->mTangents.push_back( aiVector3D( obj[0], obj[1], obj[2]));
else else
DefaultLogger::get()->error("Collada: just one vertex tangent stream supported"); ASSIMP_LOG_ERROR("Collada: just one vertex tangent stream supported");
break; break;
case IT_Bitangent: case IT_Bitangent:
// pad to current vertex count if necessary // pad to current vertex count if necessary
@ -2574,7 +2574,7 @@ void ColladaParser::ExtractDataObjectFromChannel( const InputChannel& pInput, si
if( pInput.mIndex == 0) if( pInput.mIndex == 0)
pMesh->mBitangents.push_back( aiVector3D( obj[0], obj[1], obj[2])); pMesh->mBitangents.push_back( aiVector3D( obj[0], obj[1], obj[2]));
else else
DefaultLogger::get()->error("Collada: just one vertex bitangent stream supported"); ASSIMP_LOG_ERROR("Collada: just one vertex bitangent stream supported");
break; break;
case IT_Texcoord: case IT_Texcoord:
// up to 4 texture coord sets are fine, ignore the others // up to 4 texture coord sets are fine, ignore the others
@ -2590,7 +2590,7 @@ void ColladaParser::ExtractDataObjectFromChannel( const InputChannel& pInput, si
pMesh->mNumUVComponents[pInput.mIndex]=3; pMesh->mNumUVComponents[pInput.mIndex]=3;
} else } else
{ {
DefaultLogger::get()->error("Collada: too many texture coordinate sets. Skipping."); ASSIMP_LOG_ERROR("Collada: too many texture coordinate sets. Skipping.");
} }
break; break;
case IT_Color: case IT_Color:
@ -2610,7 +2610,7 @@ void ColladaParser::ExtractDataObjectFromChannel( const InputChannel& pInput, si
pMesh->mColors[pInput.mIndex].push_back(result); pMesh->mColors[pInput.mIndex].push_back(result);
} else } else
{ {
DefaultLogger::get()->error("Collada: too many vertex color sets. Skipping."); ASSIMP_LOG_ERROR("Collada: too many vertex color sets. Skipping.");
} }
break; break;
@ -2739,7 +2739,7 @@ void ColladaParser::ReadSceneNode( Node* pNode)
{ {
const char* s = mReader->getAttributeValue(attrId); const char* s = mReader->getAttributeValue(attrId);
if (s[0] != '#') if (s[0] != '#')
DefaultLogger::get()->error("Collada: Unresolved reference format of camera"); ASSIMP_LOG_ERROR("Collada: Unresolved reference format of camera");
else else
pNode->mPrimaryCamera = s+1; pNode->mPrimaryCamera = s+1;
} }
@ -2752,7 +2752,7 @@ void ColladaParser::ReadSceneNode( Node* pNode)
{ {
const char* s = mReader->getAttributeValue(attrID); const char* s = mReader->getAttributeValue(attrID);
if (s[0] != '#') if (s[0] != '#')
DefaultLogger::get()->error("Collada: Unresolved reference format of node"); ASSIMP_LOG_ERROR("Collada: Unresolved reference format of node");
else else
{ {
pNode->mNodeInstances.push_back(NodeInstance()); pNode->mNodeInstances.push_back(NodeInstance());

View File

@ -396,7 +396,7 @@ private:
return false; return false;
} }
} }
DefaultLogger::get()->error("unexpected EOF, expected closing <" + closeTag + "> tag"); ASSIMP_LOG_ERROR("unexpected EOF, expected closing <" + closeTag + "> tag");
return false; return false;
} }

View File

@ -465,7 +465,7 @@ D3MFOpcPackage::D3MFOpcPackage(IOSystem* pIOHandler, const std::string& rFile)
} }
} }
DefaultLogger::get()->debug(rootFile); ASSIMP_LOG_DEBUG(rootFile);
mRootStream = mZipArchive->Open(rootFile.c_str()); mRootStream = mZipArchive->Open(rootFile.c_str());
ai_assert( mRootStream != nullptr ); ai_assert( mRootStream != nullptr );

View File

@ -212,7 +212,7 @@ void DXFImporter::InternReadFile( const std::string& pFile,
++reader; ++reader;
} }
if (!eof) { if (!eof) {
DefaultLogger::get()->warn("DXF: EOF reached, but did not encounter DXF EOF marker"); ASSIMP_LOG_WARN("DXF: EOF reached, but did not encounter DXF EOF marker");
} }
ConvertMeshes(pScene,output); ConvertMeshes(pScene,output);
@ -229,7 +229,7 @@ void DXFImporter::InternReadFile( const std::string& pFile,
void DXFImporter::ConvertMeshes(aiScene* pScene, DXF::FileData& output) void DXFImporter::ConvertMeshes(aiScene* pScene, DXF::FileData& output)
{ {
// the process of resolving all the INSERT statements can grow the // the process of resolving all the INSERT statements can grow the
// polycount excessively, so log the original number. // poly-count excessively, so log the original number.
// XXX Option to import blocks as separate nodes? // XXX Option to import blocks as separate nodes?
if (!DefaultLogger::isNullLogger()) { if (!DefaultLogger::isNullLogger()) {
@ -241,16 +241,14 @@ void DXFImporter::ConvertMeshes(aiScene* pScene, DXF::FileData& output)
} }
} }
DefaultLogger::get()->debug((Formatter::format("DXF: Unexpanded polycount is "), ASSIMP_LOG_DEBUG("DXF: Unexpanded polycount is ", icount, ", vertex count is ", vcount);
icount,", vertex count is ",vcount
));
} }
if (! output.blocks.size() ) { if (! output.blocks.size() ) {
throw DeadlyImportError("DXF: no data blocks loaded"); throw DeadlyImportError("DXF: no data blocks loaded");
} }
DXF::Block* entities = 0; DXF::Block* entities( nullptr );
// index blocks by name // index blocks by name
DXF::BlockMap blocks_by_name; DXF::BlockMap blocks_by_name;
@ -375,9 +373,7 @@ void DXFImporter::ExpandBlockReferences(DXF::Block& bl,const DXF::BlockMap& bloc
// first check if the referenced blocks exists ... // first check if the referenced blocks exists ...
const DXF::BlockMap::const_iterator it = blocks_by_name.find(insert.name); const DXF::BlockMap::const_iterator it = blocks_by_name.find(insert.name);
if (it == blocks_by_name.end()) { if (it == blocks_by_name.end()) {
DefaultLogger::get()->error((Formatter::format("DXF: Failed to resolve block reference: "), ASSIMP_LOG_ERROR("DXF: Failed to resolve block reference: ", insert.name,"; skipping" );
insert.name,"; skipping"
));
continue; continue;
} }

View File

@ -368,11 +368,11 @@ bool Importer::IsDefaultProgressHandler() const
bool _ValidateFlags(unsigned int pFlags) bool _ValidateFlags(unsigned int pFlags)
{ {
if (pFlags & aiProcess_GenSmoothNormals && pFlags & aiProcess_GenNormals) { 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; return false;
} }
if (pFlags & aiProcess_OptimizeGraph && pFlags & aiProcess_PreTransformVertices) { 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 false;
} }
return true; return true;
@ -594,7 +594,7 @@ const aiScene* Importer::ReadFile( const char* _pFile, unsigned int pFlags)
if( !pimpl->mIOHandler->Exists( pFile)) { if( !pimpl->mIOHandler->Exists( pFile)) {
pimpl->mErrorString = "Unable to open file \"" + pFile + "\"."; pimpl->mErrorString = "Unable to open file \"" + pFile + "\".";
DefaultLogger::get()->error(pimpl->mErrorString); ASSIMP_LOG_ERROR(pimpl->mErrorString);
return NULL; return NULL;
} }
@ -628,7 +628,7 @@ const aiScene* Importer::ReadFile( const char* _pFile, unsigned int pFlags)
// Put a proper error message if no suitable importer was found // Put a proper error message if no suitable importer was found
if( !imp) { if( !imp) {
pimpl->mErrorString = "No suitable reader found for the file format of file \"" + pFile + "\"."; 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; return NULL;
} }
} }
@ -716,7 +716,7 @@ const aiScene* Importer::ReadFile( const char* _pFile, unsigned int pFlags)
pimpl->mErrorString = std::string("std::exception: ") + e.what(); pimpl->mErrorString = std::string("std::exception: ") + e.what();
#endif #endif
DefaultLogger::get()->error(pimpl->mErrorString); ASSIMP_LOG_ERROR(pimpl->mErrorString);
delete pimpl->mScene; pimpl->mScene = NULL; delete pimpl->mScene; pimpl->mScene = NULL;
} }
#endif // ! ASSIMP_CATCH_GLOBAL_EXCEPTIONS #endif // ! ASSIMP_CATCH_GLOBAL_EXCEPTIONS
@ -762,7 +762,7 @@ const aiScene* Importer::ApplyPostProcessing(unsigned int pFlags)
if (pimpl->bExtraVerbose) if (pimpl->bExtraVerbose)
{ {
#ifdef ASSIMP_BUILD_NO_VALIDATEDS_PROCESS #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 #endif // no validation
pFlags |= aiProcess_ValidateDataStructure; pFlags |= aiProcess_ValidateDataStructure;
} }
@ -800,18 +800,19 @@ const aiScene* Importer::ApplyPostProcessing(unsigned int pFlags)
// If the extra verbose mode is active, execute the ValidateDataStructureStep again - after each step // If the extra verbose mode is active, execute the ValidateDataStructureStep again - after each step
if (pimpl->bExtraVerbose) { if (pimpl->bExtraVerbose) {
DefaultLogger::get()->debug("Verbose Import: revalidating data structures"); DefaultLogger::get()->debug("Verbose Import: re-validating data structures");
ValidateDSProcess ds; ValidateDSProcess ds;
ds.ExecuteOnScene (this); ds.ExecuteOnScene (this);
if( !pimpl->mScene) { 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; break;
} }
} }
#endif // ! DEBUG #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 // update private scene flags
if( pimpl->mScene ) if( pimpl->mScene )
@ -858,7 +859,7 @@ const aiScene* Importer::ApplyCustomizedPostProcessing( BaseProcess *rootProcess
if ( pimpl->bExtraVerbose ) if ( pimpl->bExtraVerbose )
{ {
#ifdef ASSIMP_BUILD_NO_VALIDATEDS_PROCESS #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 #endif // no validation
} }
#else #else
@ -886,7 +887,7 @@ const aiScene* Importer::ApplyCustomizedPostProcessing( BaseProcess *rootProcess
ValidateDSProcess ds; ValidateDSProcess ds;
ds.ExecuteOnScene( this ); ds.ExecuteOnScene( this );
if ( !pimpl->mScene ) { if ( !pimpl->mScene ) {
DefaultLogger::get()->error( "Verbose Import: failed to revalidate data structures" ); ASSIMP_LOG_ERROR( "Verbose Import: failed to revalidate data structures" );
} }
} }

View File

@ -622,8 +622,8 @@ void SceneCombiner::MergeScenes(aiScene** _dest, aiScene* master, std::vector<At
} }
} }
if (!(*it).resolved) { if (!(*it).resolved) {
DefaultLogger::get()->error(std::string("SceneCombiner: Failed to resolve attachment ") ASSIMP_LOG_ERROR_F( "SceneCombiner: Failed to resolve attachment ", (*it).node->mName.data,
+ (*it).node->mName.data + " " + (*it).attachToNode->mName.data); " ", (*it).attachToNode->mName.data );
} }
} }
} }

View File

@ -153,9 +153,9 @@ void UnrealImporter::InternReadFile( const std::string& pFile,
a_path = extension+"_a.3d"; a_path = extension+"_a.3d";
uc_path = extension+".uc"; uc_path = extension+".uc";
DefaultLogger::get()->debug("UNREAL: data file is " + d_path); ASSIMP_LOG_DEBUG_F( "UNREAL: data file is ", d_path);
DefaultLogger::get()->debug("UNREAL: aniv file is " + a_path); ASSIMP_LOG_DEBUG_F("UNREAL: aniv file is ", a_path);
DefaultLogger::get()->debug("UNREAL: uc file is " + uc_path); ASSIMP_LOG_DEBUG_F("UNREAL: uc file is ", uc_path);
// and open the files ... we can't live without them // and open the files ... we can't live without them
std::unique_ptr<IOStream> p(pIOHandler->Open(d_path)); std::unique_ptr<IOStream> p(pIOHandler->Open(d_path));
@ -179,7 +179,7 @@ void UnrealImporter::InternReadFile( const std::string& pFile,
tri.mVertex[i] = d_reader.GetI2(); tri.mVertex[i] = d_reader.GetI2();
if (tri.mVertex[i] >= numTris) { if (tri.mVertex[i] >= numTris) {
DefaultLogger::get()->warn("UNREAL: vertex index out of range"); ASSIMP_LOG_WARN("UNREAL: vertex index out of range");
tri.mVertex[i] = 0; tri.mVertex[i] = 0;
} }
} }
@ -324,7 +324,7 @@ void UnrealImporter::InternReadFile( const std::string& pFile,
} }
} }
else { else {
DefaultLogger::get()->error("Unable to open .uc file"); ASSIMP_LOG_ERROR("Unable to open .uc file");
} }
std::vector<Unreal::TempMat> materials; std::vector<Unreal::TempMat> materials;

View File

@ -251,7 +251,7 @@ public:
} }
} }
if (!master) { if (!master) {
DefaultLogger::get()->error("BlobIOSystem: no data written or master file was not closed properly."); ASSIMP_LOG_ERROR("BlobIOSystem: no data written or master file was not closed properly.");
return NULL; return NULL;
} }