diff options
-rw-r--r-- | src/runtimerender/graphobjects/Qt3DSRenderDynamicObject.cpp | 4 | ||||
-rw-r--r-- | src/runtimerender/resourcemanager/Qt3DSRenderBufferManager.cpp | 27 | ||||
-rw-r--r-- | src/uipparser/Qt3DSUIPParserImpl.cpp | 3 |
3 files changed, 25 insertions, 9 deletions
diff --git a/src/runtimerender/graphobjects/Qt3DSRenderDynamicObject.cpp b/src/runtimerender/graphobjects/Qt3DSRenderDynamicObject.cpp index 086453c..1dd352c 100644 --- a/src/runtimerender/graphobjects/Qt3DSRenderDynamicObject.cpp +++ b/src/runtimerender/graphobjects/Qt3DSRenderDynamicObject.cpp @@ -125,8 +125,8 @@ void SDynamicObject::SetStrPropertyValueT(dynamic::SPropertyDefinition &inDefini if (inProjectDir == NULL) inProjectDir = ""; if (CFileTools::RequiresCombineBaseAndRelative(inValue)) { - QString absolute = QDir(inProjectDir).filePath(inValue); - ioWorkspace.assign(absolute.toLatin1().constData()); + QString path = QDir(inProjectDir).cleanPath(inValue); + ioWorkspace.assign(path.toLatin1().constData()); SetPropertyValueT(inDefinition, inStrTable.RegisterStr(ioWorkspace.c_str())); // We also adjust the image path in the definition // I could not find a better place 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 diff --git a/src/uipparser/Qt3DSUIPParserImpl.cpp b/src/uipparser/Qt3DSUIPParserImpl.cpp index 6503dbe..02bd3ad 100644 --- a/src/uipparser/Qt3DSUIPParserImpl.cpp +++ b/src/uipparser/Qt3DSUIPParserImpl.cpp @@ -1212,7 +1212,8 @@ void CUIPParserImpl::CacheGraphRequiredAttributes(qt3dsdm::IDOMReader &inReader) m_ParseElementManager.MarkAttributeAsReferenced(theData, "observedproperty"); // Behaviors need all attributes possible on the object on them all the time. - if (AreEqual(theType, "Behavior") || AreEqual(theType, "RenderPlugin")) { + if (AreEqual(theType, "Behavior") || AreEqual(theType, "RenderPlugin") + || AreEqual(theType, "CustomMaterial")) { m_ParseElementManager.MarkAllAttributesAsReferenced(theData); } |