From d2bea94768ffd8f0595db7ecb59d557927fb0467 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Fri, 9 Jun 2017 15:52:21 -0700 Subject: [PATCH] simplify fileOnUrl to always look right beside FBX --- libraries/fbx/src/FBXReader.cpp | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/libraries/fbx/src/FBXReader.cpp b/libraries/fbx/src/FBXReader.cpp index 236daf6443..6d4f586c52 100644 --- a/libraries/fbx/src/FBXReader.cpp +++ b/libraries/fbx/src/FBXReader.cpp @@ -460,17 +460,11 @@ FBXLight extractLight(const FBXNode& object) { } QByteArray fileOnUrl(const QByteArray& filepath, const QString& url) { - QString path = QFileInfo(url).path(); - QByteArray filename = filepath; - QFileInfo checkFile(path + "/" + filepath); + // in order to match the behaviour when loading models from remote URLs + // we assume that all external textures are right beside the loaded model + // ignoring any relative paths or absolute paths inside of models - // check if the file exists at the RelativeFilename - if (!(checkFile.exists() && checkFile.isFile())) { - // if not, assume it is in the fbx directory - filename = filename.mid(filename.lastIndexOf('/') + 1); - } - - return filename; + return filepath.mid(filepath.lastIndexOf('/') + 1); } FBXGeometry* FBXReader::extractFBXGeometry(const QVariantHash& mapping, const QString& url) {