diff options
author | Jere Tuliniemi <jere.tuliniemi@qt.io> | 2020-04-13 23:11:35 +0300 |
---|---|---|
committer | Jere Tuliniemi <jere.tuliniemi@qt.io> | 2020-04-14 12:57:15 +0300 |
commit | f07a25c618432e08a145d714781b52c534a694da (patch) | |
tree | f2fbdd88f11f54a2f44e9f37104af44df500605e | |
parent | a05990a7d083ead234b5ef443afdfd3f83fe78ed (diff) |
Lazy load custom material subpresentations
Search through custom material string properties for subpresentation
ids.
Task-number: QT3DS-4090
Change-Id: Ia6a7227a9b9c5eb069f5670e7188644bf212ae8c
Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
-rw-r--r-- | src/engine/Qt3DSRenderRuntimeBinding.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/engine/Qt3DSRenderRuntimeBinding.cpp b/src/engine/Qt3DSRenderRuntimeBinding.cpp index 7535af6..3d7dac8 100644 --- a/src/engine/Qt3DSRenderRuntimeBinding.cpp +++ b/src/engine/Qt3DSRenderRuntimeBinding.cpp @@ -254,6 +254,24 @@ struct Qt3DSRenderScene : public Q3DStudio::IScene Q3DStudio::UVariant value; if (theElement.GetAttribute(ATTRIBUTE_SUBPRESENTATION, value)) subs.push_back(m_Context->GetStringTable().HandleToStr(value.m_StringHandle)); + } else if (theTranslator && theTranslator->GetUIPType() + == GraphObjectTypes::CustomMaterial) { + // Add custom material strings to the subpresentation list since any string + // property could be a texture with a subpresentation source. + // Non-subpresentation strings are filtered out by the function caller. + int numProperties = theElement.GetNumProperties(); + for (int i = 0; i < numProperties; ++i) { + auto property = theElement.GetPropertyByIndex(i); + if (property.hasValue()) { + auto value = property.getValue(); + if (value.first.type() == ATTRIBUTETYPE_STRING) { + auto stringValue = m_Context->GetStringTable().HandleToStr( + value.second->m_StringHandle); + if (stringValue.IsValid()) + subs.push_back(stringValue); + } + } + } } } } |