diff --git a/code/OgreImporter.h b/code/OgreImporter.h index b4c958a65..1a16aa860 100644 --- a/code/OgreImporter.h +++ b/code/OgreImporter.h @@ -5,11 +5,8 @@ #ifndef ASSIMP_BUILD_NO_OGRE_IMPORTER #include "BaseImporter.h" -#include "irrXMLWrapper.h" #include "OgreParsingUtils.h" -#include <vector> - namespace Assimp { namespace Ogre diff --git a/code/OgreMaterial.cpp b/code/OgreMaterial.cpp index 506b0fde9..5ce162ed9 100644 --- a/code/OgreMaterial.cpp +++ b/code/OgreMaterial.cpp @@ -46,7 +46,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include <sstream> #include "OgreImporter.h" -#include "irrXMLWrapper.h" #include "TinyFormatter.h" using namespace std; @@ -195,8 +194,8 @@ aiMaterial* OgreImporter::ReadMaterial(const std::string &pFile, Assimp::IOSyste if (linePart == partTechnique) { - string techniqueName = Trim(SkipLine(ss)); - ReadTechnique(techniqueName, ss, material); + string techniqueName = SkipLine(ss); + ReadTechnique(Trim(techniqueName), ss, material); } // Read informations from a custom material @@ -315,8 +314,8 @@ bool OgreImporter::ReadTechnique(const std::string &techniqueName, stringstream /// @todo Techniques have other attributes than just passes. if (linePart == partPass) { - string passName = Trim(SkipLine(ss)); - ReadPass(passName, ss, material); + string passName = SkipLine(ss); + ReadPass(Trim(passName), ss, material); } } return true; @@ -374,8 +373,8 @@ bool OgreImporter::ReadPass(const std::string &passName, stringstream &ss, aiMat } else if (linePart == partTextureUnit) { - string textureUnitName = Trim(SkipLine(ss)); - ReadTextureUnit(textureUnitName, ss, material); + string textureUnitName = SkipLine(ss); + ReadTextureUnit(Trim(textureUnitName), ss, material); } } return true; diff --git a/code/OgreParsingUtils.h b/code/OgreParsingUtils.h index 40ee35d4c..9e5b83e82 100644 --- a/code/OgreParsingUtils.h +++ b/code/OgreParsingUtils.h @@ -33,7 +33,10 @@ inline int GetAttribute<int>(const XmlReader* reader, const std::string &name) if (value) return atoi(value); else + { ThrowAttibuteError(reader, name); + return 0; + } } template<> @@ -43,7 +46,10 @@ inline unsigned int GetAttribute<unsigned int>(const XmlReader* reader, const st if (value) return static_cast<unsigned int>(atoi(value)); ///< @todo Find a better way... else + { ThrowAttibuteError(reader, name); + return 0; + } } template<> @@ -53,7 +59,10 @@ inline float GetAttribute<float>(const XmlReader* reader, const std::string &nam if (value) return fast_atof(value); else + { ThrowAttibuteError(reader, name); + return 0.f; + } } template<> @@ -63,7 +72,10 @@ inline std::string GetAttribute<std::string>(const XmlReader* reader, const std: if (value) return std::string(value); else + { ThrowAttibuteError(reader, name); + return ""; + } } template<> @@ -75,7 +87,10 @@ inline bool GetAttribute<bool>(const XmlReader* reader, const std::string &name) else if (ASSIMP_stricmp(value, "false") == 0) return false; else + { ThrowAttibuteError(reader, name, "Boolean value is expected to be 'true' or 'false', encountered '" + value + "'"); + return false; + } } inline bool NextNode(XmlReader* reader)