Improve use of logging

pull/3905/head
Malcolm Tyrrell 2021-05-13 12:05:31 +01:00
parent ad6f300b1d
commit 4ec01cfdcd
30 changed files with 80 additions and 81 deletions

View File

@ -379,7 +379,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] == '*') {
ASSIMP_LOG_ERROR("Ignoring embedded texture for export: " + std::string(path.C_Str())); ASSIMP_LOG_ERROR("Ignoring embedded texture for export: ", path.C_Str());
return; return;
} }

View File

@ -1125,7 +1125,7 @@ void Parser::ParseLV2NodeTransformBlock(ASE::BaseNode &mesh) {
"this is no spot light or target camera"); "this is no spot light or target camera");
} }
} else { } else {
ASSIMP_LOG_ERROR("ASE: Unknown node transformation: " + temp); ASSIMP_LOG_ERROR("ASE: Unknown node transformation: ", temp);
// mode = 0 // mode = 0
} }
continue; continue;

View File

@ -238,7 +238,7 @@ bool C4DImporter::ReadShader(aiMaterial* out, BaseShader* shader) {
out->AddProperty(&path, AI_MATKEY_TEXTURE_DIFFUSE(0)); out->AddProperty(&path, AI_MATKEY_TEXTURE_DIFFUSE(0));
return true; return true;
} else { } else {
LogWarn("ignoring shader type: " + std::string(GetObjectTypeName(shader->GetType()))); LogWarn("ignoring shader type: ", GetObjectTypeName(shader->GetType()));
} }
shader = shader->GetNext(); shader = shader->GetNext();
} }
@ -281,7 +281,7 @@ void C4DImporter::ReadMaterials(BaseMaterial* mat) {
ReadShader(out, shader); ReadShader(out, shader);
} }
} else { } else {
LogWarn("ignoring plugin material: " + std::string(GetObjectTypeName(mat->GetType()))); LogWarn("ignoring plugin material: ", GetObjectTypeName(mat->GetType()));
} }
mat = mat->GetNext(); mat = mat->GetNext();
} }
@ -335,7 +335,7 @@ void C4DImporter::RecurseHierarchy(BaseObject* object, aiNode* parent) {
meshes.push_back(mesh); meshes.push_back(mesh);
} }
} else { } else {
LogWarn("ignoring object: " + std::string(GetObjectTypeName(type))); LogWarn("ignoring object: ", GetObjectTypeName(type));
} }
RecurseHierarchy(object->GetDown(), nd); RecurseHierarchy(object->GetDown(), nd);

View File

@ -811,7 +811,7 @@ bool FBXConverter::GenerateTransformationNodeChain(const Model &model, const std
// we need to generate a full node chain to accommodate for assimp's // we need to generate a full node chain to accommodate for assimp's
// lack to express pivots and offsets. // lack to express pivots and offsets.
if ((chainBits & chainMaskComplex) && doc.Settings().preservePivots) { if ((chainBits & chainMaskComplex) && doc.Settings().preservePivots) {
FBXImporter::LogInfo("generating full transformation chain for node: " + name); FBXImporter::LogInfo("generating full transformation chain for node: ", name);
// query the anim_chain_bits dictionary to find out which chain elements // query the anim_chain_bits dictionary to find out which chain elements
// have associated node animation channels. These can not be dropped // have associated node animation channels. These can not be dropped
@ -918,7 +918,7 @@ void FBXConverter::ConvertModel(const Model &model, aiNode *parent, aiNode *root
const std::vector<unsigned int> &indices = ConvertLine(*line, root_node); const std::vector<unsigned int> &indices = ConvertLine(*line, root_node);
std::copy(indices.begin(), indices.end(), std::back_inserter(meshes)); std::copy(indices.begin(), indices.end(), std::back_inserter(meshes));
} else { } else {
FBXImporter::LogWarn("ignoring unrecognized geometry: " + geo->Name()); FBXImporter::LogWarn("ignoring unrecognized geometry: ", geo->Name());
} }
} }
@ -944,7 +944,7 @@ FBXConverter::ConvertMesh(const MeshGeometry &mesh, const Model &model, aiNode *
const std::vector<aiVector3D> &vertices = mesh.GetVertices(); const std::vector<aiVector3D> &vertices = mesh.GetVertices();
const std::vector<unsigned int> &faces = mesh.GetFaceIndexCounts(); const std::vector<unsigned int> &faces = mesh.GetFaceIndexCounts();
if (vertices.empty() || faces.empty()) { if (vertices.empty() || faces.empty()) {
FBXImporter::LogWarn("ignoring empty geometry: " + mesh.Name()); FBXImporter::LogWarn("ignoring empty geometry: ", mesh.Name());
return temp; return temp;
} }
@ -971,7 +971,7 @@ std::vector<unsigned int> FBXConverter::ConvertLine(const LineGeometry &line, ai
const std::vector<aiVector3D> &vertices = line.GetVertices(); const std::vector<aiVector3D> &vertices = line.GetVertices();
const std::vector<int> &indices = line.GetIndices(); const std::vector<int> &indices = line.GetIndices();
if (vertices.empty() || indices.empty()) { if (vertices.empty() || indices.empty()) {
FBXImporter::LogWarn("ignoring empty line: " + line.Name()); FBXImporter::LogWarn("ignoring empty line: ", line.Name());
return temp; return temp;
} }
@ -1815,14 +1815,14 @@ void FBXConverter::TrySetTextureProperties(aiMaterial *out_mat, const TextureMap
} }
} }
if (index == -1) { if (index == -1) {
FBXImporter::LogWarn("did not find UV channel named " + uvSet + " in a mesh using this material"); FBXImporter::LogWarn("did not find UV channel named ", uvSet, " in a mesh using this material");
continue; continue;
} }
if (uvIndex == -1) { if (uvIndex == -1) {
uvIndex = index; uvIndex = index;
} else { } else {
FBXImporter::LogWarn("the UV channel named " + uvSet + FBXImporter::LogWarn("the UV channel named ", uvSet,
" appears at different positions in meshes, results will be wrong"); " appears at different positions in meshes, results will be wrong");
} }
} }
@ -1839,7 +1839,7 @@ void FBXConverter::TrySetTextureProperties(aiMaterial *out_mat, const TextureMap
} }
} }
if (index == -1) { if (index == -1) {
FBXImporter::LogWarn("did not find UV channel named " + uvSet + " in a mesh using this material"); FBXImporter::LogWarn("did not find UV channel named ", uvSet, " in a mesh using this material");
} }
if (uvIndex == -1) { if (uvIndex == -1) {
@ -1848,7 +1848,7 @@ void FBXConverter::TrySetTextureProperties(aiMaterial *out_mat, const TextureMap
} }
if (uvIndex == -1) { if (uvIndex == -1) {
FBXImporter::LogWarn("failed to resolve UV channel " + uvSet + ", using first UV channel"); FBXImporter::LogWarn("failed to resolve UV channel ", uvSet, ", using first UV channel");
uvIndex = 0; uvIndex = 0;
} }
} }
@ -1934,14 +1934,14 @@ void FBXConverter::TrySetTextureProperties(aiMaterial *out_mat, const LayeredTex
} }
} }
if (index == -1) { if (index == -1) {
FBXImporter::LogWarn("did not find UV channel named " + uvSet + " in a mesh using this material"); FBXImporter::LogWarn("did not find UV channel named ", uvSet, " in a mesh using this material");
continue; continue;
} }
if (uvIndex == -1) { if (uvIndex == -1) {
uvIndex = index; uvIndex = index;
} else { } else {
FBXImporter::LogWarn("the UV channel named " + uvSet + FBXImporter::LogWarn("the UV channel named ", uvSet,
" appears at different positions in meshes, results will be wrong"); " appears at different positions in meshes, results will be wrong");
} }
} }
@ -1958,7 +1958,7 @@ void FBXConverter::TrySetTextureProperties(aiMaterial *out_mat, const LayeredTex
} }
} }
if (index == -1) { if (index == -1) {
FBXImporter::LogWarn("did not find UV channel named " + uvSet + " in a mesh using this material"); FBXImporter::LogWarn("did not find UV channel named ", uvSet, " in a mesh using this material");
} }
if (uvIndex == -1) { if (uvIndex == -1) {
@ -1967,7 +1967,7 @@ void FBXConverter::TrySetTextureProperties(aiMaterial *out_mat, const LayeredTex
} }
if (uvIndex == -1) { if (uvIndex == -1) {
FBXImporter::LogWarn("failed to resolve UV channel " + uvSet + ", using first UV channel"); FBXImporter::LogWarn("failed to resolve UV channel ", uvSet, ", using first UV channel");
uvIndex = 0; uvIndex = 0;
} }
} }
@ -2319,14 +2319,14 @@ void FBXConverter::SetShadingPropertiesRaw(aiMaterial *out_mat, const PropertyTa
} }
} }
if (index == -1) { if (index == -1) {
FBXImporter::LogWarn("did not find UV channel named " + uvSet + " in a mesh using this material"); FBXImporter::LogWarn("did not find UV channel named ", uvSet, " in a mesh using this material");
continue; continue;
} }
if (uvIndex == -1) { if (uvIndex == -1) {
uvIndex = index; uvIndex = index;
} else { } else {
FBXImporter::LogWarn("the UV channel named " + uvSet + " appears at different positions in meshes, results will be wrong"); FBXImporter::LogWarn("the UV channel named ", uvSet, " appears at different positions in meshes, results will be wrong");
} }
} }
} else { } else {
@ -2342,7 +2342,7 @@ void FBXConverter::SetShadingPropertiesRaw(aiMaterial *out_mat, const PropertyTa
} }
} }
if (index == -1) { if (index == -1) {
FBXImporter::LogWarn("did not find UV channel named " + uvSet + " in a mesh using this material"); FBXImporter::LogWarn("did not find UV channel named ", uvSet, " in a mesh using this material");
} }
if (uvIndex == -1) { if (uvIndex == -1) {
@ -2351,7 +2351,7 @@ void FBXConverter::SetShadingPropertiesRaw(aiMaterial *out_mat, const PropertyTa
} }
if (uvIndex == -1) { if (uvIndex == -1) {
FBXImporter::LogWarn("failed to resolve UV channel " + uvSet + ", using first UV channel"); FBXImporter::LogWarn("failed to resolve UV channel ", uvSet, ", using first UV channel");
uvIndex = 0; uvIndex = 0;
} }
} }
@ -2574,7 +2574,7 @@ void FBXConverter::ConvertAnimationStack(const AnimationStack &st) {
// empty animations would fail validation, so drop them // empty animations would fail validation, so drop them
delete anim; delete anim;
animations.pop_back(); animations.pop_back();
FBXImporter::LogInfo("ignoring empty AnimationStack (using IK?): " + name); FBXImporter::LogInfo("ignoring empty AnimationStack (using IK?): ", name);
return; return;
} }
@ -2707,13 +2707,13 @@ void FBXConverter::GenerateNodeAnimations(std::vector<aiNodeAnim *> &node_anims,
ai_assert(node); ai_assert(node);
if (node->TargetProperty().empty()) { if (node->TargetProperty().empty()) {
FBXImporter::LogWarn("target property for animation curve not set: " + node->Name()); FBXImporter::LogWarn("target property for animation curve not set: ", node->Name());
continue; continue;
} }
curve_node = node; curve_node = node;
if (node->Curves().empty()) { if (node->Curves().empty()) {
FBXImporter::LogWarn("no animation curves assigned to AnimationCurveNode: " + node->Name()); FBXImporter::LogWarn("no animation curves assigned to AnimationCurveNode: ", node->Name());
continue; continue;
} }
@ -2748,7 +2748,7 @@ void FBXConverter::GenerateNodeAnimations(std::vector<aiNodeAnim *> &node_anims,
if (doc.Settings().optimizeEmptyAnimationCurves && if (doc.Settings().optimizeEmptyAnimationCurves &&
IsRedundantAnimationData(target, comp, (chain[i]->second))) { IsRedundantAnimationData(target, comp, (chain[i]->second))) {
FBXImporter::LogVerboseDebug("dropping redundant animation channel for node " + target.Name()); FBXImporter::LogVerboseDebug("dropping redundant animation channel for node ", target.Name());
continue; continue;
} }

View File

@ -91,7 +91,7 @@ void DOMWarning(const std::string& message, const Element* element /*= nullptr*/
return; return;
} }
if(DefaultLogger::get()) { if(DefaultLogger::get()) {
ASSIMP_LOG_WARN("FBX-DOM: " + message); ASSIMP_LOG_WARN("FBX-DOM: ", message);
} }
} }

View File

@ -715,7 +715,7 @@ void ProcessBoolean(const Schema_2x3::IfcBooleanResult &boolean, TempMesh &resul
// DIFFERENCE // DIFFERENCE
if (const Schema_2x3::IfcBooleanResult *const clip = boolean.ToPtr<Schema_2x3::IfcBooleanResult>()) { if (const Schema_2x3::IfcBooleanResult *const clip = boolean.ToPtr<Schema_2x3::IfcBooleanResult>()) {
if (clip->Operator != "DIFFERENCE") { if (clip->Operator != "DIFFERENCE") {
IFCImporter::LogWarn("encountered unsupported boolean operator: " + (std::string)clip->Operator); IFCImporter::LogWarn("encountered unsupported boolean operator: ", (std::string)clip->Operator);
return; return;
} }
@ -756,7 +756,7 @@ void ProcessBoolean(const Schema_2x3::IfcBooleanResult &boolean, TempMesh &resul
ProcessBooleanExtrudedAreaSolidDifference(as, result, first_operand, conv); ProcessBooleanExtrudedAreaSolidDifference(as, result, first_operand, conv);
} }
} else { } else {
IFCImporter::LogWarn("skipping unknown IfcBooleanResult entity, type is " + boolean.GetClassName()); IFCImporter::LogWarn("skipping unknown IfcBooleanResult entity, type is ", boolean.GetClassName());
} }
} }

View File

@ -216,7 +216,7 @@ void ProcessConnectedFaceSet(const Schema_2x3::IfcConnectedFaceSet& fset, TempMe
} }
} }
else { else {
IFCImporter::LogWarn("skipping unknown IfcFaceBound entity, type is " + bound.Bound->GetClassName()); IFCImporter::LogWarn("skipping unknown IfcFaceBound entity, type is ", bound.Bound->GetClassName());
continue; continue;
} }
@ -729,7 +729,7 @@ void ProcessSweptAreaSolid(const Schema_2x3::IfcSweptAreaSolid& swept, TempMesh&
ProcessRevolvedAreaSolid(*rev,meshout,conv); ProcessRevolvedAreaSolid(*rev,meshout,conv);
} }
else { else {
IFCImporter::LogWarn("skipping unknown IfcSweptAreaSolid entity, type is " + swept.GetClassName()); IFCImporter::LogWarn("skipping unknown IfcSweptAreaSolid entity, type is ", swept.GetClassName());
} }
} }
@ -781,7 +781,7 @@ bool ProcessGeometricItem(const Schema_2x3::IfcRepresentationItem& geo, unsigned
return false; return false;
} }
else { else {
IFCImporter::LogWarn("skipping unknown IfcGeometricRepresentationItem entity, type is " + geo.GetClassName()); IFCImporter::LogWarn("skipping unknown IfcGeometricRepresentationItem entity, type is ", geo.GetClassName());
return false; return false;
} }

View File

@ -243,12 +243,12 @@ void IFCImporter::InternReadFile(const std::string &pFile, aiScene *pScene, IOSy
} }
if (!DefaultLogger::isNullLogger()) { if (!DefaultLogger::isNullLogger()) {
LogDebug("File schema is \'" + head.fileSchema + '\''); LogDebug("File schema is \'", head.fileSchema, '\'');
if (head.timestamp.length()) { if (head.timestamp.length()) {
LogDebug("Timestamp \'" + head.timestamp + '\''); LogDebug("Timestamp \'", head.timestamp, '\'');
} }
if (head.app.length()) { if (head.app.length()) {
LogDebug("Application/Exporter identline is \'" + head.app + '\''); LogDebug("Application/Exporter identline is \'", head.app, '\'');
} }
} }
@ -403,7 +403,7 @@ void ResolveObjectPlacement(aiMatrix4x4 &m, const Schema_2x3::IfcObjectPlacement
m = tmpM * m; m = tmpM * m;
} }
} else { } else {
IFCImporter::LogWarn("skipping unknown IfcObjectPlacement entity, type is " + place.GetClassName()); IFCImporter::LogWarn("skipping unknown IfcObjectPlacement entity, type is ", place.GetClassName());
} }
} }

View File

@ -64,7 +64,7 @@ static int ConvertShadingMode(const std::string& name) {
else if (name == "PHONG") { else if (name == "PHONG") {
return aiShadingMode_Phong; return aiShadingMode_Phong;
} }
IFCImporter::LogWarn("shading mode "+name+" not recognized by Assimp, using Phong instead"); IFCImporter::LogWarn("shading mode ", name, " not recognized by Assimp, using Phong instead");
return aiShadingMode_Phong; return aiShadingMode_Phong;
} }
@ -145,7 +145,7 @@ unsigned int ProcessMaterials(uint64_t id, unsigned int prevMatId, ConversionDat
// not found, create new material // not found, create new material
const std::string side = static_cast<std::string>(surf->Side); const std::string side = static_cast<std::string>(surf->Side);
if( side != "BOTH" ) { if( side != "BOTH" ) {
IFCImporter::LogWarn("ignoring surface side marker on IFC::IfcSurfaceStyle: " + side); IFCImporter::LogWarn("ignoring surface side marker on IFC::IfcSurfaceStyle: ", side);
} }
std::unique_ptr<aiMaterial> mat(new aiMaterial()); std::unique_ptr<aiMaterial> mat(new aiMaterial());

View File

@ -68,7 +68,7 @@ bool ProcessCurve(const Schema_2x3::IfcCurve& curve, TempMesh& meshout, Convers
{ {
std::unique_ptr<const Curve> cv(Curve::Convert(curve,conv)); std::unique_ptr<const Curve> cv(Curve::Convert(curve,conv));
if (!cv) { if (!cv) {
IFCImporter::LogWarn("skipping unknown IfcCurve entity, type is " + curve.GetClassName()); IFCImporter::LogWarn("skipping unknown IfcCurve entity, type is ", curve.GetClassName());
return false; return false;
} }
@ -78,7 +78,7 @@ bool ProcessCurve(const Schema_2x3::IfcCurve& curve, TempMesh& meshout, Convers
bc->SampleDiscrete(meshout); bc->SampleDiscrete(meshout);
} }
catch(const CurveError& cv) { catch(const CurveError& cv) {
IFCImporter::LogError(cv.mStr + " (error occurred while processing curve)"); IFCImporter::LogError(cv.mStr, " (error occurred while processing curve)");
return false; return false;
} }
meshout.mVertcnt.push_back(static_cast<unsigned int>(meshout.mVerts.size())); meshout.mVertcnt.push_back(static_cast<unsigned int>(meshout.mVerts.size()));
@ -152,7 +152,7 @@ void ProcessParametrizedProfile(const Schema_2x3::IfcParameterizedProfileDef& de
meshout.mVertcnt.push_back(12); meshout.mVertcnt.push_back(12);
} }
else { else {
IFCImporter::LogWarn("skipping unknown IfcParameterizedProfileDef entity, type is " + def.GetClassName()); IFCImporter::LogWarn("skipping unknown IfcParameterizedProfileDef entity, type is ", def.GetClassName());
return; return;
} }
@ -174,7 +174,7 @@ bool ProcessProfile(const Schema_2x3::IfcProfileDef& prof, TempMesh& meshout, Co
ProcessParametrizedProfile(*cparam,meshout,conv); ProcessParametrizedProfile(*cparam,meshout,conv);
} }
else { else {
IFCImporter::LogWarn("skipping unknown IfcProfileDef entity, type is " + prof.GetClassName()); IFCImporter::LogWarn("skipping unknown IfcProfileDef entity, type is ", prof.GetClassName());
return false; return false;
} }
meshout.RemoveAdjacentDuplicates(); meshout.RemoveAdjacentDuplicates();

View File

@ -506,7 +506,7 @@ IfcFloat ConvertSIPrefix(const std::string& prefix)
return 1e-18f; return 1e-18f;
} }
else { else {
IFCImporter::LogError("Unrecognized SI prefix: " + prefix); IFCImporter::LogError("Unrecognized SI prefix: ", prefix);
return 1; return 1;
} }
} }

View File

@ -639,7 +639,7 @@ void IRRImporter::GenerateGraph(Node *root, aiNode *rootOut, aiScene *scene,
// graph we're currently building // graph we're currently building
aiScene *localScene = batch.GetImport(root->id); aiScene *localScene = batch.GetImport(root->id);
if (!localScene) { if (!localScene) {
ASSIMP_LOG_ERROR("IRR: Unable to load external file: " + root->meshPath); ASSIMP_LOG_ERROR("IRR: Unable to load external file: ", root->meshPath);
break; break;
} }
attach.push_back(AttachmentInfo(localScene, rootOut)); attach.push_back(AttachmentInfo(localScene, rootOut));
@ -963,7 +963,7 @@ void IRRImporter::InternReadFile(const std::string &pFile, aiScene *pScene, IOSy
ASSIMP_LOG_ERROR("IRR: Billboards are not supported by Assimp"); ASSIMP_LOG_ERROR("IRR: Billboards are not supported by Assimp");
nd = new Node(Node::DUMMY); nd = new Node(Node::DUMMY);
} else { } else {
ASSIMP_LOG_WARN("IRR: Found unknown node: " + std::string(attrib.name())); ASSIMP_LOG_WARN("IRR: Found unknown node: ", attrib.name());
/* We skip the contents of nodes we don't know. /* We skip the contents of nodes we don't know.
* We parse the transformation and all animators * We parse the transformation and all animators
@ -1181,7 +1181,7 @@ void IRRImporter::InternReadFile(const std::string &pFile, aiScene *pScene, IOSy
lights.pop_back(); lights.pop_back();
curNode->type = Node::DUMMY; curNode->type = Node::DUMMY;
ASSIMP_LOG_ERROR("Ignoring light of unknown type: " + prop.value); ASSIMP_LOG_ERROR("Ignoring light of unknown type: ", prop.value);
} }
} else if ((prop.name == "Mesh" && Node::MESH == curNode->type) || } else if ((prop.name == "Mesh" && Node::MESH == curNode->type) ||
Node::ANIMMESH == curNode->type) { Node::ANIMMESH == curNode->type) {
@ -1225,7 +1225,7 @@ void IRRImporter::InternReadFile(const std::string &pFile, aiScene *pScene, IOSy
} else if (prop.value == "followSpline") { } else if (prop.value == "followSpline") {
curAnim->type = Animator::FOLLOW_SPLINE; curAnim->type = Animator::FOLLOW_SPLINE;
} else { } else {
ASSIMP_LOG_WARN("IRR: Ignoring unknown animator: " + prop.value); ASSIMP_LOG_WARN("IRR: Ignoring unknown animator: ", prop.value);
curAnim->type = Animator::UNKNOWN; curAnim->type = Animator::UNKNOWN;
} }

View File

@ -260,7 +260,7 @@ aiMaterial* IrrlichtBase::ParseMaterial(unsigned int& matFlags) {
prop.value == "parallaxmap_trans_add") { prop.value == "parallaxmap_trans_add") {
matFlags = AI_IRRMESH_MAT_normalmap_ta; matFlags = AI_IRRMESH_MAT_normalmap_ta;
} else { } else {
ASSIMP_LOG_WARN("IRRMat: Unrecognized material type: " + prop.value); ASSIMP_LOG_WARN("IRRMat: Unrecognized material type: ", prop.value);
} }
} }

View File

@ -961,7 +961,7 @@ void LWOImporter::LoadLWO2VertexMap(unsigned int length, bool perPoly) {
switch (type) { switch (type) {
case AI_LWO_TXUV: case AI_LWO_TXUV:
if (dims != 2) { if (dims != 2) {
ASSIMP_LOG_WARN("LWO2: Skipping UV channel \'" + name + "\' with !2 components"); ASSIMP_LOG_WARN("LWO2: Skipping UV channel \'", name, "\' with !2 components");
return; return;
} }
base = FindEntry(mCurLayer->mUVChannels, name, perPoly); base = FindEntry(mCurLayer->mUVChannels, name, perPoly);
@ -969,7 +969,7 @@ void LWOImporter::LoadLWO2VertexMap(unsigned int length, bool perPoly) {
case AI_LWO_WGHT: case AI_LWO_WGHT:
case AI_LWO_MNVW: case AI_LWO_MNVW:
if (dims != 1) { if (dims != 1) {
ASSIMP_LOG_WARN("LWO2: Skipping Weight Channel \'" + name + "\' with !1 components"); ASSIMP_LOG_WARN("LWO2: Skipping Weight Channel \'", name, "\' with !1 components");
return; return;
} }
base = FindEntry((type == AI_LWO_WGHT ? mCurLayer->mWeightChannels : mCurLayer->mSWeightChannels), name, perPoly); base = FindEntry((type == AI_LWO_WGHT ? mCurLayer->mWeightChannels : mCurLayer->mSWeightChannels), name, perPoly);
@ -977,7 +977,7 @@ void LWOImporter::LoadLWO2VertexMap(unsigned int length, bool perPoly) {
case AI_LWO_RGB: case AI_LWO_RGB:
case AI_LWO_RGBA: case AI_LWO_RGBA:
if (dims != 3 && dims != 4) { if (dims != 3 && dims != 4) {
ASSIMP_LOG_WARN("LWO2: Skipping Color Map \'" + name + "\' with a dimension > 4 or < 3"); ASSIMP_LOG_WARN("LWO2: Skipping Color Map \'", name, "\' with a dimension > 4 or < 3");
return; return;
} }
base = FindEntry(mCurLayer->mVColorChannels, name, perPoly); base = FindEntry(mCurLayer->mVColorChannels, name, perPoly);

View File

@ -711,7 +711,7 @@ void LWOImporter::LoadLWO2Surface(unsigned int size) {
} }
} }
if (derived.size()) { if (derived.size()) {
ASSIMP_LOG_WARN("LWO2: Unable to find source surface: " + derived); ASSIMP_LOG_WARN("LWO2: Unable to find source surface: ", derived);
} }
} }

View File

@ -346,7 +346,7 @@ void LWSImporter::BuildGraph(aiNode *nd, LWS::NodeDesc &src, std::vector<Attachm
if (src.path.length()) { if (src.path.length()) {
obj = batch.GetImport(src.id); obj = batch.GetImport(src.id);
if (!obj) { if (!obj) {
ASSIMP_LOG_ERROR("LWS: Failed to read external file " + src.path); ASSIMP_LOG_ERROR("LWS: Failed to read external file ", src.path);
} else { } else {
if (obj->mRootNode->mNumChildren == 1) { if (obj->mRootNode->mNumChildren == 1) {
@ -538,7 +538,7 @@ void LWSImporter::InternReadFile(const std::string &pFile, aiScene *pScene, IOSy
// get file format version and print to log // get file format version and print to log
++it; ++it;
unsigned int version = strtoul10((*it).tokens[0].c_str()); unsigned int version = strtoul10((*it).tokens[0].c_str());
ASSIMP_LOG_INFO("LWS file format version is " + (*it).tokens[0]); ASSIMP_LOG_INFO("LWS file format version is ", (*it).tokens[0]);
first = 0.; first = 0.;
last = 60.; last = 60.;
fps = 25.; // seems to be a good default frame rate fps = 25.; // seems to be a good default frame rate

View File

@ -209,7 +209,7 @@ void M3DImporter::InternReadFile(const std::string &file, aiScene *pScene, IOSys
pScene->mRootNode->mNumChildren = 0; pScene->mRootNode->mNumChildren = 0;
mScene = pScene; mScene = pScene;
ASSIMP_LOG_DEBUG("M3D: root node " + m3d.Name()); ASSIMP_LOG_DEBUG("M3D: root node ", m3d.Name());
// now we just have to fill up the Assimp structures in pScene // now we just have to fill up the Assimp structures in pScene
importMaterials(m3d); importMaterials(m3d);

View File

@ -101,7 +101,7 @@ Q3Shader::BlendFunc StringToBlendFunc(const std::string &m) {
if (m == "GL_ONE_MINUS_DST_COLOR") { if (m == "GL_ONE_MINUS_DST_COLOR") {
return Q3Shader::BLEND_GL_ONE_MINUS_DST_COLOR; return Q3Shader::BLEND_GL_ONE_MINUS_DST_COLOR;
} }
ASSIMP_LOG_ERROR("Q3Shader: Unknown blend function: " + m); ASSIMP_LOG_ERROR("Q3Shader: Unknown blend function: ", m);
return Q3Shader::BLEND_NONE; return Q3Shader::BLEND_NONE;
} }
@ -226,7 +226,7 @@ bool Q3Shader::LoadSkin(SkinData &fill, const std::string &pFile, IOSystem *io)
if (!file.get()) if (!file.get())
return false; // if we can't access the file, don't worry and return return false; // if we can't access the file, don't worry and return
ASSIMP_LOG_INFO("Loading Quake3 skin file " + pFile); ASSIMP_LOG_INFO("Loading Quake3 skin file ", pFile);
// read file in memory // read file in memory
const size_t s = file->FileSize(); const size_t s = file->FileSize();
@ -880,9 +880,9 @@ void MD3Importer::InternReadFile(const std::string &pFile, aiScene *pScene, IOSy
if (dit != shaders.blocks.end()) { if (dit != shaders.blocks.end()) {
// We made it! // We made it!
shader = &*dit; shader = &*dit;
ASSIMP_LOG_INFO("Found shader record for " + without_ext); ASSIMP_LOG_INFO("Found shader record for ", without_ext);
} else { } else {
ASSIMP_LOG_WARN("Unable to find shader record for " + without_ext); ASSIMP_LOG_WARN("Unable to find shader record for ", without_ext);
} }
} }

View File

@ -345,7 +345,7 @@ void MD5Importer::LoadMD5MeshFile() {
// Check whether we can read from the file // Check whether we can read from the file
if (file.get() == nullptr || !file->FileSize()) { if (file.get() == nullptr || !file->FileSize()) {
ASSIMP_LOG_WARN("Failed to access MD5MESH file: " + filename); ASSIMP_LOG_WARN("Failed to access MD5MESH file: ", filename);
return; return;
} }
mHadMD5Mesh = true; mHadMD5Mesh = true;
@ -567,7 +567,7 @@ void MD5Importer::LoadMD5AnimFile() {
// Check whether we can read from the file // Check whether we can read from the file
if (!file.get() || !file->FileSize()) { if (!file.get() || !file->FileSize()) {
ASSIMP_LOG_WARN("Failed to read MD5ANIM file: " + pFile); ASSIMP_LOG_WARN("Failed to read MD5ANIM file: ", pFile);
return; return;
} }

View File

@ -1343,7 +1343,7 @@ bool HL1MDLLoader::get_num_blend_controllers(const int num_blend_animations, int
return true; return true;
default: default:
num_blend_controllers = 0; num_blend_controllers = 0;
ASSIMP_LOG_WARN(MDL_HALFLIFE_LOG_HEADER "Unsupported number of blend animations (" + std::to_string(num_blend_animations) + ")"); ASSIMP_LOG_WARN(MDL_HALFLIFE_LOG_HEADER "Unsupported number of blend animations (", num_blend_animations, ")");
return false; return false;
} }
} }

View File

@ -132,7 +132,7 @@ void NFFImporter::LoadNFF2MaterialTable(std::vector<ShadingInfo> &output,
// Check whether we can read from the file // Check whether we can read from the file
if (!file.get()) { if (!file.get()) {
ASSIMP_LOG_ERROR("NFF2: Unable to open material library " + path + "."); ASSIMP_LOG_ERROR("NFF2: Unable to open material library ", path, ".");
return; return;
} }

View File

@ -556,7 +556,7 @@ void ObjFileParser::getMaterialDesc() {
// This may be the case if the material library is missing. We don't want to lose all // This may be the case if the material library is missing. We don't want to lose all
// materials if that happens, so create a new named material instead of discarding it // materials if that happens, so create a new named material instead of discarding it
// completely. // completely.
ASSIMP_LOG_ERROR("OBJ: failed to locate material " + strName + ", creating new material"); ASSIMP_LOG_ERROR("OBJ: failed to locate material ", strName, ", creating new material");
m_pModel->m_pCurrentMaterial = new ObjFile::Material(); m_pModel->m_pCurrentMaterial = new ObjFile::Material();
m_pModel->m_pCurrentMaterial->MaterialName.Set(strName); m_pModel->m_pCurrentMaterial->MaterialName.Set(strName);
m_pModel->m_MaterialLib.push_back(strName); m_pModel->m_MaterialLib.push_back(strName);
@ -620,12 +620,12 @@ void ObjFileParser::getMaterialLib() {
IOStream *pFile = m_pIO->Open(absName); IOStream *pFile = m_pIO->Open(absName);
if (nullptr == pFile) { if (nullptr == pFile) {
ASSIMP_LOG_ERROR("OBJ: Unable to locate material file " + strMatName); ASSIMP_LOG_ERROR("OBJ: Unable to locate material file ", strMatName);
std::string strMatFallbackName = m_originalObjFileName.substr(0, m_originalObjFileName.length() - 3) + "mtl"; std::string strMatFallbackName = m_originalObjFileName.substr(0, m_originalObjFileName.length() - 3) + "mtl";
ASSIMP_LOG_INFO("OBJ: Opening fallback material file " + strMatFallbackName); ASSIMP_LOG_INFO("OBJ: Opening fallback material file ", strMatFallbackName);
pFile = m_pIO->Open(strMatFallbackName); pFile = m_pIO->Open(strMatFallbackName);
if (!pFile) { if (!pFile) {
ASSIMP_LOG_ERROR("OBJ: Unable to locate fallback material file " + strMatFallbackName); ASSIMP_LOG_ERROR("OBJ: Unable to locate fallback material file ", strMatFallbackName);
m_DataIt = skipLine<DataArrayIt>(m_DataIt, m_DataItEnd, m_uiLine); m_DataIt = skipLine<DataArrayIt>(m_DataIt, m_DataItEnd, m_uiLine);
return; return;
} }
@ -660,7 +660,7 @@ void ObjFileParser::getNewMaterial() {
std::map<std::string, ObjFile::Material *>::iterator it = m_pModel->m_MaterialMap.find(strMat); std::map<std::string, ObjFile::Material *>::iterator it = m_pModel->m_MaterialMap.find(strMat);
if (it == m_pModel->m_MaterialMap.end()) { if (it == m_pModel->m_MaterialMap.end()) {
// Show a warning, if material was not found // Show a warning, if material was not found
ASSIMP_LOG_WARN("OBJ: Unsupported material requested: " + strMat); ASSIMP_LOG_WARN("OBJ: Unsupported material requested: ", strMat);
m_pModel->m_pCurrentMaterial = m_pModel->m_pDefaultMaterial; m_pModel->m_pCurrentMaterial = m_pModel->m_pDefaultMaterial;
} else { } else {
// Set new material // Set new material

View File

@ -155,7 +155,7 @@ uint16_t OgreBinarySerializer::ReadHeader(bool readLen) {
#if (OGRE_BINARY_SERIALIZER_DEBUG == 1) #if (OGRE_BINARY_SERIALIZER_DEBUG == 1)
if (id != HEADER_CHUNK_ID) { if (id != HEADER_CHUNK_ID) {
ASSIMP_LOG_DEBUG(Formatter::format() << (assetMode == AM_Mesh ? MeshHeaderToString(static_cast<MeshChunkId>(id)) : SkeletonHeaderToString(static_cast<SkeletonChunkId>(id)))); ASSIMP_LOG_DEBUG((assetMode == AM_Mesh ? MeshHeaderToString(static_cast<MeshChunkId>(id)) : SkeletonHeaderToString(static_cast<SkeletonChunkId>(id))));
} }
#endif #endif

View File

@ -477,7 +477,7 @@ bool OgreImporter::ReadTextureUnit(const std::string &textureUnitName, stringstr
return false; return false;
} }
if (textureType == aiTextureType_NONE) { if (textureType == aiTextureType_NONE) {
ASSIMP_LOG_WARN("Failed to detect texture type for '" + textureRef + "', ignoring texture_unit."); ASSIMP_LOG_WARN("Failed to detect texture type for '", textureRef, "', ignoring texture_unit.");
return false; return false;
} }

View File

@ -446,7 +446,7 @@ void Q3BSPFileImporter::createMaterials(const Q3BSP::Q3BSPModel *pModel, aiScene
normalizePathName(tmp, texName); normalizePathName(tmp, texName);
if (!importTextureFromArchive(pModel, pArchive, pScene, pMatHelper, textureId)) { if (!importTextureFromArchive(pModel, pArchive, pScene, pMatHelper, textureId)) {
ASSIMP_LOG_ERROR("Cannot import texture from archive " + texName); ASSIMP_LOG_ERROR("Cannot import texture from archive ", texName);
} }
} }
} }

View File

@ -455,14 +455,14 @@ void glTF2Importer::ImportMeshes(glTF2::Asset &r) {
if (attr.normal.size() > 0 && attr.normal[0]) { if (attr.normal.size() > 0 && attr.normal[0]) {
if (attr.normal[0]->count != aim->mNumVertices) { if (attr.normal[0]->count != aim->mNumVertices) {
DefaultLogger::get()->warn("Normal count in mesh \"" + mesh.name + "\" does not match the vertex count, normals ignored."); DefaultLogger::get()->warn("Normal count in mesh \"", mesh.name, "\" does not match the vertex count, normals ignored.");
} else { } else {
attr.normal[0]->ExtractData(aim->mNormals); attr.normal[0]->ExtractData(aim->mNormals);
// only extract tangents if normals are present // only extract tangents if normals are present
if (attr.tangent.size() > 0 && attr.tangent[0]) { if (attr.tangent.size() > 0 && attr.tangent[0]) {
if (attr.tangent[0]->count != aim->mNumVertices) { if (attr.tangent[0]->count != aim->mNumVertices) {
DefaultLogger::get()->warn("Tangent count in mesh \"" + mesh.name + "\" does not match the vertex count, tangents ignored."); DefaultLogger::get()->warn("Tangent count in mesh \"", mesh.name, "\" does not match the vertex count, tangents ignored.");
} else { } else {
// generate bitangents from normals and tangents according to spec // generate bitangents from normals and tangents according to spec
Tangent *tangents = nullptr; Tangent *tangents = nullptr;
@ -485,7 +485,7 @@ void glTF2Importer::ImportMeshes(glTF2::Asset &r) {
for (size_t c = 0; c < attr.color.size() && c < AI_MAX_NUMBER_OF_COLOR_SETS; ++c) { for (size_t c = 0; c < attr.color.size() && c < AI_MAX_NUMBER_OF_COLOR_SETS; ++c) {
if (attr.color[c]->count != aim->mNumVertices) { if (attr.color[c]->count != aim->mNumVertices) {
DefaultLogger::get()->warn("Color stream size in mesh \"" + mesh.name + DefaultLogger::get()->warn("Color stream size in mesh \"", mesh.name,
"\" does not match the vertex count"); "\" does not match the vertex count");
continue; continue;
} }
@ -508,7 +508,7 @@ void glTF2Importer::ImportMeshes(glTF2::Asset &r) {
} }
if (attr.texcoord[tc]->count != aim->mNumVertices) { if (attr.texcoord[tc]->count != aim->mNumVertices) {
DefaultLogger::get()->warn("Texcoord stream size in mesh \"" + mesh.name + DefaultLogger::get()->warn("Texcoord stream size in mesh \"", mesh.name,
"\" does not match the vertex count"); "\" does not match the vertex count");
continue; continue;
} }

View File

@ -89,7 +89,7 @@ public:
mBase += getOsSeparator(); mBase += getOsSeparator();
} }
DefaultLogger::get()->info("Import root directory is \'" + mBase + "\'"); DefaultLogger::get()->info("Import root directory is \'", mBase, "\'");
} }
/** Destructor. */ /** Destructor. */

View File

@ -665,7 +665,7 @@ const aiScene* Importer::ReadFile( const char* _pFile, unsigned int pFlags) {
if ( nullptr != desc ) { if ( nullptr != desc ) {
ext = desc->mName; ext = desc->mName;
} }
ASSIMP_LOG_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 ); pimpl->mProgressHandler->UpdateFileRead( 0, fileSize );
if (profiler) { if (profiler) {

View File

@ -160,7 +160,7 @@ aiReturn aiGetMaterialFloatArray(const aiMaterial *pMat,
break; break;
} }
if (!IsSpace(*cur)) { if (!IsSpace(*cur)) {
ASSIMP_LOG_ERROR("Material property" + std::string(pKey) + ASSIMP_LOG_ERROR("Material property", pKey,
" is a string; failed to parse a float array out of it."); " is a string; failed to parse a float array out of it.");
return AI_FAILURE; return AI_FAILURE;
} }
@ -238,7 +238,7 @@ aiReturn aiGetMaterialIntegerArray(const aiMaterial *pMat,
break; break;
} }
if (!IsSpace(*cur)) { if (!IsSpace(*cur)) {
ASSIMP_LOG_ERROR("Material property" + std::string(pKey) + ASSIMP_LOG_ERROR("Material property", pKey,
" is a string; failed to parse an integer array out of it."); " is a string; failed to parse an integer array out of it.");
return AI_FAILURE; return AI_FAILURE;
} }
@ -306,8 +306,7 @@ aiReturn aiGetMaterialString(const aiMaterial *pMat,
memcpy(pOut->data, prop->mData + 4, pOut->length + 1); memcpy(pOut->data, prop->mData + 4, pOut->length + 1);
} else { } else {
// TODO - implement lexical cast as well // TODO - implement lexical cast as well
ASSIMP_LOG_ERROR("Material property" + std::string(pKey) + ASSIMP_LOG_ERROR("Material property", pKey, " was found, but is no string");
" was found, but is no string");
return AI_FAILURE; return AI_FAILURE;
} }
return AI_SUCCESS; return AI_SUCCESS;

View File

@ -99,7 +99,7 @@ void ValidateDSProcess::ReportWarning(const char *msg, ...) {
ai_assert(iLen > 0); ai_assert(iLen > 0);
va_end(args); va_end(args);
ASSIMP_LOG_WARN("Validation warning: " + std::string(szBuffer, iLen)); ASSIMP_LOG_WARN("Validation warning: ", std::string(szBuffer, iLen));
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------