diff --git a/code/ObjFileParser.cpp b/code/ObjFileParser.cpp index bd73a88d9..dfa77dba2 100644 --- a/code/ObjFileParser.cpp +++ b/code/ObjFileParser.cpp @@ -179,7 +179,18 @@ void ObjFileParser::parseFile( IOStreamBuffer &streamBuffer ) { case 'u': // Parse a material desc. setter { - getMaterialDesc(); + std::string name; + + getNameNoSpace(m_DataIt, m_DataItEnd, name); + + size_t nextSpace = name.find(" "); + if (nextSpace != std::string::npos) + name = name.substr(0, nextSpace); + + if(name == "usemtl") + { + getMaterialDesc(); + } } break;