From ebc6a5fa9edee8de35ab27abbeb8556aadcf9344 Mon Sep 17 00:00:00 2001 From: Jonathan Klein Date: Sat, 16 Mar 2013 20:59:47 +0100 Subject: [PATCH] Ogre: Material nullptr-fix, Loader is hopefully no longer confused by 'submeshnames' tag --- code/OgreImporter.cpp | 9 +++++++++ code/OgreMaterial.cpp | 5 ++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/code/OgreImporter.cpp b/code/OgreImporter.cpp index 72141e4..21b9749 100644 --- a/code/OgreImporter.cpp +++ b/code/OgreImporter.cpp @@ -165,6 +165,15 @@ void OgreImporter::InternReadFile(const std::string &pFile, aiScene *pScene, Ass //____________________________________________________________ + //skip submeshnames (stupid irrxml) + if(MeshFile->getNodeName()==string("submeshnames")) + { + XmlRead(MeshFile.get()); + while(MeshFile->getNodeName()==string("submesh")) + XmlRead(MeshFile.get()); + } + + //----------------Load the skeleton: ------------------------------- vector Bones; vector Animations; diff --git a/code/OgreMaterial.cpp b/code/OgreMaterial.cpp index 48ab755..213fa21 100644 --- a/code/OgreMaterial.cpp +++ b/code/OgreMaterial.cpp @@ -65,9 +65,8 @@ namespace Ogre aiMaterial* OgreImporter::LoadMaterial(const std::string MaterialName) const { const aiScene* const m_CurrentScene=this->m_CurrentScene;//make sure, that we can access but not change the scene - (void)m_CurrentScene; - /*For bettetr understanding of the material parser, here is a material example file: + /*For better understanding of the material parser, here is a material example file: material Sarg { @@ -143,7 +142,7 @@ aiMaterial* OgreImporter::LoadMaterial(const std::string MaterialName) const if(NULL==MatFilePtr) { DefaultLogger::get()->error(m_MaterialLibFilename+" and "+MaterialFileName + " could not be opened, Material will not be loaded!"); - return NULL; + return new aiMaterial(); } } } -- 1.8.0.msysgit.0