Merge pull request #672 from Ang3lus/Fix-mtl-realtive-path
Properly build path to the mtl file when loading objpull/488/merge
commit
1b3381d03d
|
@ -138,7 +138,7 @@ void ObjFileImporter::InternReadFile( const std::string& pFile, aiScene* pScene,
|
||||||
if ( pos != std::string::npos ) {
|
if ( pos != std::string::npos ) {
|
||||||
modelName = pFile.substr(pos+1, pFile.size() - pos - 1);
|
modelName = pFile.substr(pos+1, pFile.size() - pos - 1);
|
||||||
folderName = pFile.substr( 0, pos );
|
folderName = pFile.substr( 0, pos );
|
||||||
if ( folderName.empty() ) {
|
if ( !folderName.empty() ) {
|
||||||
pIOHandler->PushDirectory( folderName );
|
pIOHandler->PushDirectory( folderName );
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -539,7 +539,10 @@ void ObjFileParser::getMaterialLib()
|
||||||
const std::string strMatName(pStart, &(*m_DataIt));
|
const std::string strMatName(pStart, &(*m_DataIt));
|
||||||
std::string absName;
|
std::string absName;
|
||||||
if ( m_pIO->StackSize() > 0 ) {
|
if ( m_pIO->StackSize() > 0 ) {
|
||||||
const std::string &path = m_pIO->CurrentDirectory();
|
std::string path = m_pIO->CurrentDirectory();
|
||||||
|
if ( '/' != *path.rbegin() ) {
|
||||||
|
path += '/';
|
||||||
|
}
|
||||||
absName = path + strMatName;
|
absName = path + strMatName;
|
||||||
} else {
|
} else {
|
||||||
absName = strMatName;
|
absName = strMatName;
|
||||||
|
|
Loading…
Reference in New Issue