From f601309db570ee53a6ddce07c20eac08e016cd7e Mon Sep 17 00:00:00 2001 From: ulfjorensen Date: Fri, 8 Oct 2010 17:27:59 +0000 Subject: [PATCH] - anonym XFile materials are named now, to prevent them from being merged somehow - added another boost dependency - lexical_cast - and a little replacement for all those boost haters out there git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@826 67173fc5-114c-0410-ac8e-9d2fd5bffc1f --- code/AssimpPCH.h | 1 + code/BoostWorkaround/boost/lexical_cast.hpp | 23 +++++++++++++++++++++ code/XFileParser.cpp | 2 ++ workspaces/vc9/assimp.vcproj | 6 +++++- 4 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 code/BoostWorkaround/boost/lexical_cast.hpp diff --git a/code/AssimpPCH.h b/code/AssimpPCH.h index 7ad7a0ca1..dfb18ef2a 100644 --- a/code/AssimpPCH.h +++ b/code/AssimpPCH.h @@ -128,6 +128,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include #include +#include // Public ASSIMP headers #include "../include/DefaultLogger.h" diff --git a/code/BoostWorkaround/boost/lexical_cast.hpp b/code/BoostWorkaround/boost/lexical_cast.hpp new file mode 100644 index 000000000..e6e36d025 --- /dev/null +++ b/code/BoostWorkaround/boost/lexical_cast.hpp @@ -0,0 +1,23 @@ +/// A quick replacement for boost::lexical_cast for all the Boost haters out there + +#ifndef __AI_BOOST_WORKAROUND_LEXICAL_CAST +#define __AI_BOOST_WORKAROUND_LEXICAL_CAST + +namespace boost +{ + + /// A quick replacement for boost::lexical_cast - should work for all types a stringstream can handle + template + TargetType lexical_cast( const SourceType& source) + { + std::stringstream stream; + TargetType result; + + stream << source; + stream >> result; + return result; + } + +} // namespace boost + +#endif // __AI_BOOST_WORKAROUND_LEXICAL_CAST \ No newline at end of file diff --git a/code/XFileParser.cpp b/code/XFileParser.cpp index 3bad8c963..0a9e23e0a 100644 --- a/code/XFileParser.cpp +++ b/code/XFileParser.cpp @@ -710,6 +710,8 @@ void XFileParser::ParseDataObjectMaterial( Material* pMaterial) { std::string matName; readHeadOfDataObject( &matName); + if( matName.empty()) + matName = std::string( "material") + boost::lexical_cast( mLineNumber); pMaterial->mName = matName; pMaterial->mIsReference = false; diff --git a/workspaces/vc9/assimp.vcproj b/workspaces/vc9/assimp.vcproj index 0c76d5a63..cd1525e9d 100644 --- a/workspaces/vc9/assimp.vcproj +++ b/workspaces/vc9/assimp.vcproj @@ -1,7 +1,7 @@ + +