summaryrefslogtreecommitdiffstats
path: root/src/runtime/q3dsuippresentation.cpp
diff options
context:
space:
mode:
authorTomi Korpipaa <tomi.korpipaa@qt.io>2018-08-13 12:37:03 +0300
committerLaszlo Agocs <laszlo.agocs@qt.io>2018-08-23 09:01:26 +0000
commit10b0cabebd9f07725191f463e807ea815d68ceb2 (patch)
treece3c17ef290e19c084dd56f109fb8bd8af5b9b16 /src/runtime/q3dsuippresentation.cpp
parent3fb37b60055a66f124b3501fe4524c9e765a639b (diff)
Fix new project structure problem with effect and custom material textures
Task-number: QT3DS-2027 Task-number: QT3DS-2119 Change-Id: If9382f38ea8f87f14b23f76a81e448072b9f08c6 Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io> Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Diffstat (limited to 'src/runtime/q3dsuippresentation.cpp')
-rw-r--r--src/runtime/q3dsuippresentation.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/runtime/q3dsuippresentation.cpp b/src/runtime/q3dsuippresentation.cpp
index c33964f..b475c2a 100644
--- a/src/runtime/q3dsuippresentation.cpp
+++ b/src/runtime/q3dsuippresentation.cpp
@@ -3946,6 +3946,21 @@ QString Q3DSUipPresentation::assetFileName(const QString &xmlFileNameRef, int *p
fn += QLatin1Char('/');
fn += rawName;
path = QFileInfo(fn).absoluteFilePath();
+
+ // We need the path to uia files for some assets, for example the textures of effects
+ // As that is not readily available here, go up the directory hoping to find the
+ // file wanted. We're using 3 levels for now, as that is what Editor is using as well.
+ if (!QFileInfo(path).exists()) {
+ int loops = 0;
+ QString searchPath = QFileInfo(d->sourceFile).canonicalPath();
+ searchPath.append(QLatin1String("/../"));
+ while (!QFileInfo(searchPath + rawName).exists() && ++loops < 3)
+ searchPath.append(QLatin1String("../"));
+ if (QFileInfo(path).exists())
+ path = searchPath + rawName;
+ else
+ path = QFileInfo(fn).absoluteFilePath();
+ }
}
return path;
}