simplify fileOnUrl to always look right beside FBX

This commit is contained in:
Stephen Birarda 2017-06-09 15:52:21 -07:00
parent 6006fa0fe1
commit d2bea94768

View file

@ -460,17 +460,11 @@ FBXLight extractLight(const FBXNode& object) {
} }
QByteArray fileOnUrl(const QByteArray& filepath, const QString& url) { QByteArray fileOnUrl(const QByteArray& filepath, const QString& url) {
QString path = QFileInfo(url).path(); // in order to match the behaviour when loading models from remote URLs
QByteArray filename = filepath; // we assume that all external textures are right beside the loaded model
QFileInfo checkFile(path + "/" + filepath); // ignoring any relative paths or absolute paths inside of models
// check if the file exists at the RelativeFilename return filepath.mid(filepath.lastIndexOf('/') + 1);
if (!(checkFile.exists() && checkFile.isFile())) {
// if not, assume it is in the fbx directory
filename = filename.mid(filename.lastIndexOf('/') + 1);
}
return filename;
} }
FBXGeometry* FBXReader::extractFBXGeometry(const QVariantHash& mapping, const QString& url) { FBXGeometry* FBXReader::extractFBXGeometry(const QVariantHash& mapping, const QString& url) {