From: Rudolf Polzer Date: Sun, 25 Jul 2010 15:10:39 +0000 (+0200) Subject: improve the max shader name length in brushexport plugin X-Git-Tag: xonotic-v0.5.0~245^2~4 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=f78b813d8b4c458d22eaa5fa779fb25678de79c1;p=xonotic%2Fnetradiant.git improve the max shader name length in brushexport plugin --- diff --git a/contrib/brushexport/export.cpp b/contrib/brushexport/export.cpp index a83f7ebc..c406f198 100644 --- a/contrib/brushexport/export.cpp +++ b/contrib/brushexport/export.cpp @@ -11,6 +11,9 @@ // this is very evil, but right now there is no better way #include "../../radiant/brush.h" +#define MAX_MATERIAL_NAME (64+9-1) +// MAX_QPATH plus "textures/" prefix, allow trailing NUL to fit + /* Abstract baseclass for modelexporters the class collects all the data which then gets @@ -279,9 +282,9 @@ bool ExportDataAsWavefront::WriteToFile(const std::string& path, collapsemode mo if(mat != lastMat) { - if(limNames && mat.size() > 20) + if(limNames && mat.size() > MAX_MATERIAL_NAME) { - out << "\nusemtl " << mat.substr(mat.size() - 20, mat.size()).c_str(); + out << "\nusemtl " << mat.substr(mat.size() - MAX_MATERIAL_NAME, mat.size()).c_str(); } else { out << "\nusemtl " << mat.c_str(); } @@ -308,9 +311,9 @@ bool ExportDataAsWavefront::WriteToFile(const std::string& path, collapsemode mo outMtl << "# Material Count: " << (const Unsigned)materials.size() << "\n\n"; for(std::set::const_iterator it(materials.begin()); it != materials.end(); ++it) { - if(limNames && it->size() > 20) + if(limNames && it->size() > MAX_MATERIAL_NAME) { - outMtl << "newmtl " << it->substr(it->size() - 20, it->size()).c_str() << "\n"; + outMtl << "newmtl " << it->substr(it->size() - MAX_MATERIAL_NAME, it->size()).c_str() << "\n"; } else { outMtl << "newmtl " << it->c_str() << "\n"; }