summaryrefslogtreecommitdiffstats
path: root/src/runtimerender/resourcemanager
diff options
context:
space:
mode:
authorJanne Kangas <janne.kangas@qt.io>2020-04-02 14:03:24 +0300
committerJanne Kangas <janne.kangas@qt.io>2020-04-07 04:45:05 +0000
commita05990a7d083ead234b5ef443afdfd3f83fe78ed (patch)
treea55dd009a7519cfa68202e0e808244f72870448f /src/runtimerender/resourcemanager
parent2a53b02190c15f4e63ff982c9c07616db99b2e8e (diff)
Make attributes referenced for custom materials
Mark custom material attributes as referenced always in order to make it possible to use setAttribute. Also fix file path error for images used in custom materials that also have "controlledproperty" attribute (=datainput controller) set. Task-id: QT3DS-4091 Task-id: QT3DS-4092 Task-id: QT3DS-4072 Change-Id: Icf39269ac3fed3f615cb5f7d52cd4e28176f5350 Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
Diffstat (limited to 'src/runtimerender/resourcemanager')
-rw-r--r--src/runtimerender/resourcemanager/Qt3DSRenderBufferManager.cpp27
1 files changed, 21 insertions, 6 deletions
diff --git a/src/runtimerender/resourcemanager/Qt3DSRenderBufferManager.cpp b/src/runtimerender/resourcemanager/Qt3DSRenderBufferManager.cpp
index 3d0781d..38d021a 100644
--- a/src/runtimerender/resourcemanager/Qt3DSRenderBufferManager.cpp
+++ b/src/runtimerender/resourcemanager/Qt3DSRenderBufferManager.cpp
@@ -399,16 +399,31 @@ struct SBufferManager : public IBufferManager
if (!theLoadedImage) {
if (QDir(inImagePath.c_str()).isRelative()) {
QString searchPath = inImagePath.c_str();
- if (searchPath.startsWith(QLatin1String("./")))
- searchPath.prepend(QLatin1Char('.'));
- int loops = 0;
- while (!theLoadedImage && ++loops <= 3) {
+
+ // Trying relative to search directories.
+ if (searchPath.startsWith(QLatin1String("../"))) {
+ auto searchPathRel = searchPath.right(searchPath.length() - 3);
theLoadedImage = SLoadedTexture::Load(
- searchPath.toUtf8(), m_Context->GetFoundation(),
+ searchPathRel.toUtf8(), m_Context->GetFoundation(),
*m_InputStreamFactory, true, false,
m_Context->GetRenderContextType(), false, this);
- searchPath.prepend(QLatin1String("../"));
}
+
+ if (!theLoadedImage) {
+ if (searchPath.startsWith(QLatin1String("./")))
+ searchPath.prepend(QLatin1Char('.'));
+
+ int loops = 0;
+ while (!theLoadedImage && ++loops <= 3) {
+ theLoadedImage = SLoadedTexture::Load(
+ searchPath.toUtf8(), m_Context->GetFoundation(),
+ *m_InputStreamFactory, true, false,
+ m_Context->GetRenderContextType(), false, this);
+ searchPath.prepend(QLatin1String("../"));
+ }
+ }
+
+
} else {
// Some textures, for example environment maps for custom materials,
// have absolute path at this point. It points to the wrong place with