diff options
author | Antti Määttä <antti.maatta@qt.io> | 2020-04-22 15:14:30 +0300 |
---|---|---|
committer | Antti Määttä <antti.maatta@qt.io> | 2020-04-24 10:45:17 +0300 |
commit | 5ae9d1039383f7dadaa7229785820f0ae32fb67a (patch) | |
tree | dd7497bb7c237f0734eb5ce9695fc351f695e913 | |
parent | bfb68aef8924c87d9aff1e5b809ef0557bc305de (diff) |
Add default texture paths to source paths
The custom material/effect default textures are added to the graph object
attribute list so that they can be loaded when delayed loading is enabled.
Task-number: QT3DS-4037
Change-Id: I88219b49a6d696de7ca45b900aa3628d48de701e
Reviewed-by: Jere Tuliniemi <jere.tuliniemi@qt.io>
Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
-rw-r--r-- | src/uipparser/Qt3DSUIPParserImpl.cpp | 14 | ||||
-rw-r--r-- | src/uipparser/Qt3DSUIPParserImpl.h | 3 |
2 files changed, 12 insertions, 5 deletions
diff --git a/src/uipparser/Qt3DSUIPParserImpl.cpp b/src/uipparser/Qt3DSUIPParserImpl.cpp index 02bd3ad..4190915 100644 --- a/src/uipparser/Qt3DSUIPParserImpl.cpp +++ b/src/uipparser/Qt3DSUIPParserImpl.cpp @@ -842,16 +842,19 @@ void CUIPParserImpl::AddFloat4Attribute(TPropertyDescAndValueList &outDescList, void CUIPParserImpl::AddStringAttribute(IPresentation &inPresentation, TPropertyDescAndValueList &outDescList, - CRegisteredString inAttStrName, const char *inValue) + CRegisteredString inAttStrName, const char *inValue, + bool addSourceAsString) { qt3ds::foundation::CStringHandle theString = inPresentation.GetStringTable().GetHandle(inValue); UVariant theValue; theValue.m_StringHandle = theString.handle(); outDescList.push_back( eastl::make_pair(SPropertyDesc(inAttStrName, ATTRIBUTETYPE_STRING), theValue)); - if (CHash::HashAttribute(inAttStrName.c_str()) == Q3DStudio::ATTRIBUTE_SOURCEPATH && inValue - && *inValue) + if ((addSourceAsString + || CHash::HashAttribute(inAttStrName.c_str()) == Q3DStudio::ATTRIBUTE_SOURCEPATH) + && inValue && *inValue) { AddSourcePath(inValue, false); + } } void CUIPParserImpl::AddElementRefAttribute(TPropertyDescAndValueList &outDescList, @@ -944,7 +947,10 @@ void CUIPParserImpl::GetAttributeList(IPresentation &inPresentation, const char *theDataPtr = ""; if (!IsTrivial(inValue)) theReader.Read(theDataPtr); - AddStringAttribute(inPresentation, outDescList, inPropNameStrs[0], theDataPtr); + bool addSourceAsString = inAdditionalType + == ERuntimeAdditionalMetaDataType::ERuntimeAdditionalMetaDataTypeTexture; + AddStringAttribute(inPresentation, outDescList, inPropNameStrs[0], theDataPtr, + addSourceAsString); break; } case ERuntimeDataModelDataTypeLong4: { diff --git a/src/uipparser/Qt3DSUIPParserImpl.h b/src/uipparser/Qt3DSUIPParserImpl.h index 85f8c18..939ba35 100644 --- a/src/uipparser/Qt3DSUIPParserImpl.h +++ b/src/uipparser/Qt3DSUIPParserImpl.h @@ -661,7 +661,8 @@ protected: ERuntimeAdditionalMetaDataType inAdditionalType, CRegisteredString *inAttStrNames, qt3dsdm::SFloat4 &inValue); void AddStringAttribute(IPresentation &inPresentation, TPropertyDescAndValueList &outDescList, - CRegisteredString inAttStrName, const char *inValue); + CRegisteredString inAttStrName, const char *inValue, + bool addSourceAsString = false); void AddElementRefAttribute(TPropertyDescAndValueList &outDescList, CRegisteredString inAttStrName, SElement *inElement); |