summaryrefslogtreecommitdiffstats
path: root/src/render/io/gltfparser.cpp
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@theqtcompany.com>2015-02-13 14:11:08 +0100
committerLaszlo Agocs <laszlo.agocs@theqtcompany.com>2015-02-13 14:58:06 +0000
commit209efae5307bf6cf519848205dbbe637c62c4ae2 (patch)
tree4ddf105cfe9a59391a058665d4b670079e69f02d /src/render/io/gltfparser.cpp
parent664b73dd36de6205cc84a219f936dd744a2dc184 (diff)
Make scene parsers operate on URLs instead of raw filenames
This way they are compatible with how mesh and texture source URLs are handled. Change-Id: Ifeee504fd3f5957d23f5cade92a73663488bdaf9 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Diffstat (limited to 'src/render/io/gltfparser.cpp')
-rw-r--r--src/render/io/gltfparser.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/render/io/gltfparser.cpp b/src/render/io/gltfparser.cpp
index 459655771..c11e4d8f6 100644
--- a/src/render/io/gltfparser.cpp
+++ b/src/render/io/gltfparser.cpp
@@ -50,6 +50,7 @@
#include <Qt3DCore/qtransform.h>
#include <Qt3DCore/qmatrixtransform.h>
#include <Qt3DCore/qcameralens.h>
+#include <Qt3DCore/private/qurlhelper_p.h>
#include <qtexture.h>
#include <qparameter.h>
@@ -285,8 +286,9 @@ bool GLTFParser::setJSON( QJsonDocument json )
* Sets the \a path used by the parser to load the scene file.
* If the file is valid, parsing is automatically triggered.
*/
-void GLTFParser::setFilePath(const QString &path)
+void GLTFParser::setSource(const QUrl &source)
{
+ const QString path = QUrlHelper::urlToLocalFileOrQrc(source);
QFileInfo finfo(path);
if (!finfo.exists()) {
qWarning() << "missing file:" << path;
@@ -307,8 +309,9 @@ void GLTFParser::setFilePath(const QString &path)
* Returns true if the extension of \a path is supported by the
* GLTF parser.
*/
-bool GLTFParser::isPathExtensionSupported(const QString &path)
+bool GLTFParser::isExtensionSupported(const QUrl &source)
{
+ const QString path = QUrlHelper::urlToLocalFileOrQrc(source);
return GLTFParser::isGLTFPath(path);
}