summaryrefslogtreecommitdiffstats
path: root/src/runtime/q3dscustommaterial.cpp
diff options
context:
space:
mode:
authorJere Tuliniemi <jere.tuliniemi@qt.io>2019-01-10 15:58:37 +0200
committerJere Tuliniemi <jere.tuliniemi@qt.io>2019-01-15 12:14:12 +0000
commit5e9a1798cc697136aae4125a157e654d7e49530a (patch)
treea3dd42c0f4e84197547c7a786a4c7be406661698 /src/runtime/q3dscustommaterial.cpp
parent0cf63f1de93635c85fc3120cdfce3410a59edc9b (diff)
Support custom materials created from a QByteArray
Allow a QByteArray to be used to create a custom material instead reading it from a file. Task-number: QT3DS-2906 Change-Id: I2718240186b62c0ff2bf36e5313bed6754472066 Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io> Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io> Reviewed-by: Antti Määttä <antti.maatta@qt.io>
Diffstat (limited to 'src/runtime/q3dscustommaterial.cpp')
-rw-r--r--src/runtime/q3dscustommaterial.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/runtime/q3dscustommaterial.cpp b/src/runtime/q3dscustommaterial.cpp
index 77b8cb3..592c19f 100644
--- a/src/runtime/q3dscustommaterial.cpp
+++ b/src/runtime/q3dscustommaterial.cpp
@@ -176,7 +176,21 @@ Q3DSCustomMaterial Q3DSCustomMaterialParser::parse(const QString &filename, bool
*ok = false;
return Q3DSCustomMaterial();
}
+ return parse(ok);
+}
+Q3DSCustomMaterial Q3DSCustomMaterialParser::parse(const QByteArray &data, bool *ok)
+{
+ if (!setSourceData(data)) {
+ if (ok != nullptr)
+ *ok = false;
+ return Q3DSCustomMaterial();
+ }
+ return parse(ok);
+}
+
+Q3DSCustomMaterial Q3DSCustomMaterialParser::parse(bool *ok)
+{
m_material = Q3DSCustomMaterial();
QXmlStreamReader *r = reader();