diff options
Diffstat (limited to 'src/plugins/sceneparsers/gltf/gltfparser.cpp')
-rw-r--r-- | src/plugins/sceneparsers/gltf/gltfparser.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/plugins/sceneparsers/gltf/gltfparser.cpp b/src/plugins/sceneparsers/gltf/gltfparser.cpp index a4a0602c2..ba39e74ba 100644 --- a/src/plugins/sceneparsers/gltf/gltfparser.cpp +++ b/src/plugins/sceneparsers/gltf/gltfparser.cpp @@ -189,7 +189,12 @@ void GLTFParser::setSource(const QUrl &source) QFile f(path); f.open(QIODevice::ReadOnly); - if (!setJSON(QJsonDocument::fromJson(f.readAll()))) { + QByteArray jsonData = f.readAll(); + QJsonDocument sceneDocument = QJsonDocument::fromBinaryData(jsonData); + if (sceneDocument.isNull()) + sceneDocument = QJsonDocument::fromJson(jsonData); + + if (!setJSON(sceneDocument)) { qCWarning(GLTFParserLog) << "not a JSON document"; return; } |