Bladeren bron

- 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

ulfjorensen 15 jaren geleden
bovenliggende
commit
f601309db5
4 gewijzigde bestanden met toevoegingen van 31 en 1 verwijderingen
  1. 1 0
      code/AssimpPCH.h
  2. 23 0
      code/BoostWorkaround/boost/lexical_cast.hpp
  3. 2 0
      code/XFileParser.cpp
  4. 5 1
      workspaces/vc9/assimp.vcproj

+ 1 - 0
code/AssimpPCH.h

@@ -128,6 +128,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #include <boost/format.hpp>
 #include <boost/foreach.hpp>
 #include <boost/static_assert.hpp>
+#include <boost/lexical_cast.hpp>
 
 // Public ASSIMP headers
 #include "../include/DefaultLogger.h"

+ 23 - 0
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 <typename TargetType, typename SourceType>
+	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

+ 2 - 0
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<std::string>( mLineNumber);
 	pMaterial->mName = matName;
 	pMaterial->mIsReference = false;
 

+ 5 - 1
workspaces/vc9/assimp.vcproj

@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="Windows-1252"?>
 <VisualStudioProject
 	ProjectType="Visual C++"
-	Version="9.00"
+	Version="9,00"
 	Name="assimp"
 	ProjectGUID="{5691E159-2D9B-407F-971F-EA5C592DC524}"
 	RootNamespace="assimp"
@@ -3990,6 +3990,10 @@
 					RelativePath="..\..\code\BoostWorkaround\boost\format.hpp"
 					>
 				</File>
+				<File
+					RelativePath="..\..\code\BoostWorkaround\boost\lexical_cast.hpp"
+					>
+				</File>
 				<File
 					RelativePath="..\..\code\BoostWorkaround\boost\pointer_cast.hpp"
 					>