diff options
author | Laszlo Agocs <laszlo.agocs@theqtcompany.com> | 2015-02-13 14:11:08 +0100 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@theqtcompany.com> | 2015-02-13 14:58:06 +0000 |
commit | 209efae5307bf6cf519848205dbbe637c62c4ae2 (patch) | |
tree | 4ddf105cfe9a59391a058665d4b670079e69f02d /src/plugins | |
parent | 664b73dd36de6205cc84a219f936dd744a2dc184 (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/plugins')
-rw-r--r-- | src/plugins/sceneparsers/assimp/assimpparser.cpp | 7 | ||||
-rw-r--r-- | src/plugins/sceneparsers/assimp/assimpparser_p.h | 4 |
2 files changed, 7 insertions, 4 deletions
diff --git a/src/plugins/sceneparsers/assimp/assimpparser.cpp b/src/plugins/sceneparsers/assimp/assimpparser.cpp index 781899611..054c3ab79 100644 --- a/src/plugins/sceneparsers/assimp/assimpparser.cpp +++ b/src/plugins/sceneparsers/assimp/assimpparser.cpp @@ -52,6 +52,7 @@ #include <QColor> #include <qmath.h> #include <Qt3DRenderer/private/renderlogging_p.h> +#include <Qt3DCore/private/qurlhelper_p.h> QT_BEGIN_NAMESPACE @@ -273,8 +274,9 @@ QMatrix4x4 AssimpParser::aiMatrix4x4ToQMatrix4x4(const aiMatrix4x4 &matrix) * Sets the \a path used by the parser to load the asset file. * If the file is valid, this will trigger the parsing of the file. */ -void AssimpParser::setFilePath(const QString& path) +void AssimpParser::setSource(const QUrl &source) { + const QString path = QUrlHelper::urlToLocalFileOrQrc(source); QFileInfo file(path); m_sceneDir = file.absoluteDir(); if (!file.exists()) { @@ -288,8 +290,9 @@ void AssimpParser::setFilePath(const QString& path) * Returns true if the extension of \a path is supported by * the assimp parser. */ -bool AssimpParser::isPathExtensionSupported(const QString &path) +bool AssimpParser::isExtensionSupported(const QUrl &source) { + const QString path = QUrlHelper::urlToLocalFileOrQrc(source); return AssimpParser::isAssimpPath(path); } diff --git a/src/plugins/sceneparsers/assimp/assimpparser_p.h b/src/plugins/sceneparsers/assimp/assimpparser_p.h index cb446e426..31bfb7bc1 100644 --- a/src/plugins/sceneparsers/assimp/assimpparser_p.h +++ b/src/plugins/sceneparsers/assimp/assimpparser_p.h @@ -78,8 +78,8 @@ public: static bool isAssimpPath(const QString& path); // SceneParserInterface interface - void setFilePath(const QString& path) Q_DECL_OVERRIDE; - bool isPathExtensionSupported(const QString &path) Q_DECL_OVERRIDE; + void setSource(const QUrl& source) Q_DECL_OVERRIDE; + bool isExtensionSupported(const QUrl &source) Q_DECL_OVERRIDE; QEntity *scene(QString id = QString()) Q_DECL_OVERRIDE; QEntity *node(QString id) Q_DECL_OVERRIDE; |