diff options
-rw-r--r-- | src/runtime/Qt3DSApplication.cpp | 7 | ||||
-rw-r--r-- | src/runtimerender/resourcemanager/Qt3DSRenderBufferManager.cpp | 9 |
2 files changed, 9 insertions, 7 deletions
diff --git a/src/runtime/Qt3DSApplication.cpp b/src/runtime/Qt3DSApplication.cpp index 5c6dbb7..db5d359 100644 --- a/src/runtime/Qt3DSApplication.cpp +++ b/src/runtime/Qt3DSApplication.cpp @@ -2267,9 +2267,10 @@ bool AssetHandlers::handlePresentation(SApp &app, SAssetValue &asset, bool initI CFileTools::CombineBaseAndRelative(app.GetProjectDirectory().c_str(), asset.GetSource(), thePathStr); - QDir::addSearchPath(QStringLiteral("qt3dstudio"), - QFileInfo(QString(thePathStr.c_str())) - .absoluteDir().absolutePath()); + const QString absPath = QFileInfo(QString(thePathStr.c_str())).absoluteDir().absolutePath(); + if (!QDir::searchPaths(QStringLiteral("qt3dstudio")).contains(absPath)) + QDir::addSearchPath(QStringLiteral("qt3dstudio"), absPath); + SPresentationAsset &thePresentationAsset = *asset.getDataPtr<SPresentationAsset>(); eastl::vector<SElementAttributeReference> theUIPReferences; diff --git a/src/runtimerender/resourcemanager/Qt3DSRenderBufferManager.cpp b/src/runtimerender/resourcemanager/Qt3DSRenderBufferManager.cpp index 87fe54c..6a0fdff 100644 --- a/src/runtimerender/resourcemanager/Qt3DSRenderBufferManager.cpp +++ b/src/runtimerender/resourcemanager/Qt3DSRenderBufferManager.cpp @@ -61,12 +61,14 @@ static const QString QT3DSTUDIO_TAG = QStringLiteral("qt3dstudio"); static QFileInfo matchCaseInsensitiveFile(const QString& file) { - const auto searchFromPaths = [](QString file) -> QFileInfo { + QStringList searchDirectories = QDir::searchPaths(QT3DSTUDIO_TAG); + std::reverse(searchDirectories.begin(), searchDirectories.end()); + + const auto searchFromPaths = [searchDirectories](QString file) -> QFileInfo { QFileInfo fileInfo(file); if (fileInfo.exists()) return fileInfo; - const QStringList searchDirectories = QDir::searchPaths(QT3DSTUDIO_TAG); for (const auto &directoryPath : searchDirectories) { auto path = QDir::cleanPath(directoryPath + '/' + file); QFileInfo info(path); @@ -203,6 +205,7 @@ QString IBufferManager::resolveImagePath(const QString &sourcePath, bool preferK } // First check ktx files if preferKtx is set + QString result; if (preferKtx) { QString ktxSource = path; const bool originalIsKtx = path.endsWith(QLatin1String("ktx"), Qt::CaseInsensitive); @@ -211,7 +214,6 @@ QString IBufferManager::resolveImagePath(const QString &sourcePath, bool preferK ktxSource = ktxSource.left(index); ktxSource.append(QLatin1String(".ktx")); } - QString result; if (checkFileExists(ktxSource, relative, result)) return result; if (originalIsKtx) { @@ -220,7 +222,6 @@ QString IBufferManager::resolveImagePath(const QString &sourcePath, bool preferK } } - QString result; if (checkFileExists(path, relative, result)) return result; |