summaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorSergey Dubitskiy <sergey.dubitskiy@nokia.com>2012-03-07 11:27:21 +1000
committerQt by Nokia <qt-info@nokia.com>2012-03-09 01:50:47 +0100
commitcb33734c90f32082311916488bdc04423acfeac8 (patch)
tree20c568d44ea3cc91151aa5614e5042cd915baa21 /src/plugins
parent3d90aa397b61e8609c7986891e0ef8eb907e1182 (diff)
Port to new Plugin Loader.
AiScene, Bezier and Obj plugins were ported. Task-number: QTBUG-24467 Change-Id: Ic0b31272cd9c13171da10857261eb296f0a0cd77 Reviewed-by: Alex Wilson <alex.wilson@nokia.com> Reviewed-by: Danny Pope <daniel.pope@nokia.com>
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/sceneformats/assimp/ai_plugin.cpp (renamed from src/plugins/sceneformats/assimp/main.cpp)50
-rw-r--r--src/plugins/sceneformats/assimp/ai_plugin.h62
-rw-r--r--src/plugins/sceneformats/assimp/ai_scene_plugin.json53
-rw-r--r--src/plugins/sceneformats/assimp/assimp.pro17
-rw-r--r--src/plugins/sceneformats/bezier/bezier.pro15
-rw-r--r--src/plugins/sceneformats/bezier/bezier_plugin.cpp (renamed from src/plugins/sceneformats/bezier/main.cpp)20
-rw-r--r--src/plugins/sceneformats/bezier/bezier_plugin.h62
-rw-r--r--src/plugins/sceneformats/bezier/bezier_scene_plugin.json6
-rw-r--r--src/plugins/sceneformats/obj/obj.pro15
-rw-r--r--src/plugins/sceneformats/obj/obj_plugin.cpp (renamed from src/plugins/sceneformats/obj/main.cpp)26
-rw-r--r--src/plugins/sceneformats/obj/obj_plugin.h62
-rw-r--r--src/plugins/sceneformats/obj/obj_scene_plugin.json5
-rw-r--r--src/plugins/sceneformats/obj/qglobjscenehandler.cpp1
-rw-r--r--src/plugins/sceneformats/obj/qglobjscenehandler.h2
14 files changed, 299 insertions, 97 deletions
diff --git a/src/plugins/sceneformats/assimp/main.cpp b/src/plugins/sceneformats/assimp/ai_plugin.cpp
index e9724a6da..9e1dbd6be 100644
--- a/src/plugins/sceneformats/assimp/main.cpp
+++ b/src/plugins/sceneformats/assimp/ai_plugin.cpp
@@ -39,52 +39,13 @@
**
****************************************************************************/
-#include "qglsceneformatplugin.h"
+#include "ai_plugin.h"
#include "qaiscenehandler.h"
-#include "assimp.hpp"
-
-#include <QtCore/qmap.h>
-#include <QtCore/qdebug.h>
-
QT_BEGIN_NAMESPACE
-class QAiScenePlugin : public QGLSceneFormatPlugin
-{
-public:
- QStringList keys() const;
- virtual QGLSceneFormatHandler *create(QIODevice *device, const QUrl& url, const QString &format) const;
-};
-
-QStringList QAiScenePlugin::keys() const
-{
- static QMultiMap<QString, QString> mimetypes;
- if (mimetypes.size() == 0)
- {
- mimetypes.insertMulti("3ds", "application/x-3ds");
- mimetypes.insertMulti("3ds", "image/x-3ds");
- mimetypes.insertMulti("dae", "model/x3d+binary");
- mimetypes.insertMulti("dxf", "application/x-dxf");
- }
- QStringList result;
- Assimp::Importer importer;
- aiString extns;
- importer.GetExtensionList(extns);
- QString qextns = QString::fromUtf8(extns.data, extns.length);
- QStringList extnList = qextns.split(';');
- for (int i = 0; i < extnList.size(); ++i)
- {
- QString xt = extnList.at(i);
- xt = xt.simplified();
- if (xt.startsWith(QLatin1String("*.")))
- xt = xt.mid(2);
- result << xt;
- QMap<QString, QString>::const_iterator it = mimetypes.constFind(xt);
- for ( ; it != mimetypes.constEnd(); ++it)
- result << it.value();
- }
- return result;
-}
+QAiScenePlugin::QAiScenePlugin() {}
+QAiScenePlugin::~QAiScenePlugin() {}
QGLSceneFormatHandler *QAiScenePlugin::create(QIODevice *device, const QUrl& url, const QString &format) const
{
@@ -94,7 +55,6 @@ QGLSceneFormatHandler *QAiScenePlugin::create(QIODevice *device, const QUrl& url
return new QAiSceneHandler;
}
-Q_EXPORT_STATIC_PLUGIN(QAiScenePlugin)
-Q_EXPORT_PLUGIN2(qsceneai, QAiScenePlugin)
-
QT_END_NAMESPACE
+
+
diff --git a/src/plugins/sceneformats/assimp/ai_plugin.h b/src/plugins/sceneformats/assimp/ai_plugin.h
new file mode 100644
index 000000000..ea0696785
--- /dev/null
+++ b/src/plugins/sceneformats/assimp/ai_plugin.h
@@ -0,0 +1,62 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef AI_PLUGIN_H
+#define AI_PLUGIN_H
+
+#include "qglsceneformatplugin.h"
+
+QT_BEGIN_NAMESPACE
+
+class QAiScenePlugin : public QObject, public QGLSceneFormatFactoryInterface
+{
+ Q_OBJECT
+ Q_INTERFACES(QGLSceneFormatFactoryInterface)
+ Q_PLUGIN_METADATA(IID "com.trolltech.Qt.QGLSceneFormatFactoryInterface" FILE "ai_scene_plugin.json")
+public:
+ QAiScenePlugin();
+ ~QAiScenePlugin();
+ virtual QGLSceneFormatHandler *create(QIODevice *device, const QUrl& url, const QString &format) const;
+};
+
+QT_END_NAMESPACE
+
+#endif // AI_PLUGIN_H
diff --git a/src/plugins/sceneformats/assimp/ai_scene_plugin.json b/src/plugins/sceneformats/assimp/ai_scene_plugin.json
new file mode 100644
index 000000000..a0c272e2b
--- /dev/null
+++ b/src/plugins/sceneformats/assimp/ai_scene_plugin.json
@@ -0,0 +1,53 @@
+{
+ "Keys": [
+ "3d",
+ "3ds",
+ "ac",
+ "ac3d",
+ "acc",
+ "ase",
+ "ask",
+ "b3d",
+ "blend",
+ "bvh",
+ "cob",
+ "csm",
+ "dae",
+ "dxf",
+ "enff",
+ "hmp",
+ "irr",
+ "irrmesh",
+ "lwo",
+ "lws",
+ "lxo",
+ "md2",
+ "md3",
+ "md5anim",
+ "md5camera",
+ "md5mesh",
+ "mdc",
+ "mdl",
+ "mesh.xml",
+ "mot",
+ "ms3d",
+ "ndo",
+ "nff",
+ "obj",
+ "off",
+ "pk3",
+ "ply",
+ "prj",
+ "q3o",
+ "q3s",
+ "raw",
+ "scn",
+ "smd",
+ "stl",
+ "ter",
+ "uc",
+ "vta",
+ "x",
+ "xml"
+ ]
+}
diff --git a/src/plugins/sceneformats/assimp/assimp.pro b/src/plugins/sceneformats/assimp/assimp.pro
index 39fbb5454..5a0fca51d 100644
--- a/src/plugins/sceneformats/assimp/assimp.pro
+++ b/src/plugins/sceneformats/assimp/assimp.pro
@@ -1,20 +1,29 @@
TARGET = qsceneai
+QT += 3d
+
+load(qt_plugin)
+
include(../../qpluginbase.pri)
HEADERS += qailoader.h \
qaiscene.h \
qaiscenehandler.h \
qaimesh.h \
ailoaderiostream.h \
- ailoaderiosystem.h
-SOURCES += main.cpp \
+ ailoaderiosystem.h \
+ ai_plugin.h
+SOURCES += \
qailoader.cpp \
qaiscene.cpp \
qaiscenehandler.cpp \
qaimesh.cpp \
ailoaderiostream.cpp \
- ailoaderiosystem.cpp
+ ailoaderiosystem.cpp \
+ ai_plugin.cpp
+
+OTHER_FILES += \
+ ai_scene_plugin.json
+
-QT += 3d
DESTDIR = $$QT.3d.plugins/sceneformats
target.path = $$[QT_INSTALL_PLUGINS]/sceneformats
diff --git a/src/plugins/sceneformats/bezier/bezier.pro b/src/plugins/sceneformats/bezier/bezier.pro
index 911dc60ef..870d6970c 100644
--- a/src/plugins/sceneformats/bezier/bezier.pro
+++ b/src/plugins/sceneformats/bezier/bezier.pro
@@ -1,13 +1,20 @@
TARGET = qscenebezier
+QT += 3d
+
+load(qt_plugin)
+
include(../../qpluginbase.pri)
HEADERS += qglbezierscene.h \
- qglbezierscenehandler.h
-SOURCES += main.cpp \
+ qglbezierscenehandler.h \
+ bezier_plugin.h
+SOURCES += \
qglbezierscene.cpp \
- qglbezierscenehandler.cpp
+ qglbezierscenehandler.cpp \
+ bezier_plugin.cpp
-QT += 3d
+OTHER_FILES += \
+ bezier_scene_plugin.json
DESTDIR = $$QT.3d.plugins/sceneformats
target.path = $$[QT_INSTALL_PLUGINS]/sceneformats
diff --git a/src/plugins/sceneformats/bezier/main.cpp b/src/plugins/sceneformats/bezier/bezier_plugin.cpp
index a56bc8653..91a81afe6 100644
--- a/src/plugins/sceneformats/bezier/main.cpp
+++ b/src/plugins/sceneformats/bezier/bezier_plugin.cpp
@@ -39,22 +39,13 @@
**
****************************************************************************/
-#include "qglsceneformatplugin.h"
+#include "bezier_plugin.h"
#include "qglbezierscenehandler.h"
QT_BEGIN_NAMESPACE
-class QGLBezierScenePlugin : public QGLSceneFormatPlugin
-{
-public:
- QStringList keys() const;
- virtual QGLSceneFormatHandler *create(QIODevice *device, const QUrl& url, const QString &format) const;
-};
-
-QStringList QGLBezierScenePlugin::keys() const
-{
- return QStringList() << QLatin1String("bezier") << QLatin1String("bez");
-}
+QGLBezierScenePlugin::QGLBezierScenePlugin() {}
+QGLBezierScenePlugin::~QGLBezierScenePlugin() {}
QGLSceneFormatHandler *QGLBezierScenePlugin::create(QIODevice *device, const QUrl& url, const QString &format) const
{
@@ -64,7 +55,6 @@ QGLSceneFormatHandler *QGLBezierScenePlugin::create(QIODevice *device, const QUr
return new QGLBezierSceneHandler;
}
-Q_EXPORT_STATIC_PLUGIN(QGLBezierScenePlugin)
-Q_EXPORT_PLUGIN2(qscenebezier, QGLBezierScenePlugin)
-
QT_END_NAMESPACE
+
+
diff --git a/src/plugins/sceneformats/bezier/bezier_plugin.h b/src/plugins/sceneformats/bezier/bezier_plugin.h
new file mode 100644
index 000000000..83b40b726
--- /dev/null
+++ b/src/plugins/sceneformats/bezier/bezier_plugin.h
@@ -0,0 +1,62 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef BEZIER_PLUGIN_H
+#define BEZIER_PLUGIN_H
+
+#include "qglsceneformatplugin.h"
+
+QT_BEGIN_NAMESPACE
+
+class QGLBezierScenePlugin : public QObject, public QGLSceneFormatFactoryInterface
+{
+ Q_OBJECT
+ Q_INTERFACES(QGLSceneFormatFactoryInterface)
+ Q_PLUGIN_METADATA(IID "com.trolltech.Qt.QGLSceneFormatFactoryInterface" FILE "bezier_scene_plugin.json")
+public:
+ QGLBezierScenePlugin();
+ ~QGLBezierScenePlugin();
+ virtual QGLSceneFormatHandler *create(QIODevice *device, const QUrl& url, const QString &format) const;
+};
+
+QT_END_NAMESPACE
+
+#endif // BEZIER_PLUGIN_H
diff --git a/src/plugins/sceneformats/bezier/bezier_scene_plugin.json b/src/plugins/sceneformats/bezier/bezier_scene_plugin.json
new file mode 100644
index 000000000..d91418547
--- /dev/null
+++ b/src/plugins/sceneformats/bezier/bezier_scene_plugin.json
@@ -0,0 +1,6 @@
+{
+ "Keys": [
+ "bezier",
+ "bez"
+ ]
+}
diff --git a/src/plugins/sceneformats/obj/obj.pro b/src/plugins/sceneformats/obj/obj.pro
index c20cc91f3..73bd0e8ec 100644
--- a/src/plugins/sceneformats/obj/obj.pro
+++ b/src/plugins/sceneformats/obj/obj.pro
@@ -1,13 +1,20 @@
TARGET = qsceneobj
+QT += 3d
+
+load(qt_plugin)
+
include(../../qpluginbase.pri)
HEADERS += qglobjscene.h \
- qglobjscenehandler.h
-SOURCES += main.cpp \
+ qglobjscenehandler.h \
+ obj_plugin.h
+SOURCES += \
qglobjscene.cpp \
- qglobjscenehandler.cpp
+ qglobjscenehandler.cpp \
+ obj_plugin.cpp
-QT += 3d
+OTHER_FILES += \
+ obj_scene_plugin.json
DESTDIR = $$QT.3d.plugins/sceneformats
target.path = $$[QT_INSTALL_PLUGINS]/sceneformats
diff --git a/src/plugins/sceneformats/obj/main.cpp b/src/plugins/sceneformats/obj/obj_plugin.cpp
index 46ed0b3f2..ae88ae374 100644
--- a/src/plugins/sceneformats/obj/main.cpp
+++ b/src/plugins/sceneformats/obj/obj_plugin.cpp
@@ -39,28 +39,14 @@
**
****************************************************************************/
-#include "qglsceneformatplugin.h"
+#include "obj_plugin.h"
#include "qglobjscenehandler.h"
QT_BEGIN_NAMESPACE
-//! [1]
-class QGLObjScenePlugin : public QGLSceneFormatPlugin
-{
-public:
- QStringList keys() const;
- virtual QGLSceneFormatHandler *create(QIODevice *device, const QUrl& url, const QString &format) const;
-};
-//! [1]
+QGLObjScenePlugin::QGLObjScenePlugin() {}
+QGLObjScenePlugin::~QGLObjScenePlugin() {}
-//! [2]
-QStringList QGLObjScenePlugin::keys() const
-{
- return QStringList() << QLatin1String("obj") << QLatin1String("model/obj");
-}
-//! [2]
-
-//! [3]
QGLSceneFormatHandler *QGLObjScenePlugin::create(QIODevice *device, const QUrl& url, const QString &format) const
{
Q_UNUSED(device);
@@ -68,11 +54,5 @@ QGLSceneFormatHandler *QGLObjScenePlugin::create(QIODevice *device, const QUrl&
Q_UNUSED(format);
return new QGLObjSceneHandler;
}
-//! [3]
-
-//! [4]
-Q_EXPORT_STATIC_PLUGIN(QGLObjScenePlugin)
-Q_EXPORT_PLUGIN2(qsceneobj, QGLObjScenePlugin)
-//! [4]
QT_END_NAMESPACE
diff --git a/src/plugins/sceneformats/obj/obj_plugin.h b/src/plugins/sceneformats/obj/obj_plugin.h
new file mode 100644
index 000000000..de9283a23
--- /dev/null
+++ b/src/plugins/sceneformats/obj/obj_plugin.h
@@ -0,0 +1,62 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef OBJ_PLUGIN_H
+#define OBJ_PLUGIN_H
+
+#include "qglsceneformatplugin.h"
+
+QT_BEGIN_NAMESPACE
+
+class QGLObjScenePlugin : public QObject, public QGLSceneFormatFactoryInterface
+{
+ Q_OBJECT
+ Q_INTERFACES(QGLSceneFormatFactoryInterface)
+ Q_PLUGIN_METADATA(IID "com.trolltech.Qt.QGLSceneFormatFactoryInterface" FILE "obj_scene_plugin.json")
+public:
+ QGLObjScenePlugin();
+ ~QGLObjScenePlugin();
+ virtual QGLSceneFormatHandler *create(QIODevice *device, const QUrl& url, const QString &format) const;
+};
+
+QT_END_NAMESPACE
+
+#endif // OBJ_PLUGIN_H
diff --git a/src/plugins/sceneformats/obj/obj_scene_plugin.json b/src/plugins/sceneformats/obj/obj_scene_plugin.json
new file mode 100644
index 000000000..b33d38205
--- /dev/null
+++ b/src/plugins/sceneformats/obj/obj_scene_plugin.json
@@ -0,0 +1,5 @@
+{
+ "Keys": [
+ "obj"
+ ]
+}
diff --git a/src/plugins/sceneformats/obj/qglobjscenehandler.cpp b/src/plugins/sceneformats/obj/qglobjscenehandler.cpp
index 9568be6d3..6ae0b7872 100644
--- a/src/plugins/sceneformats/obj/qglobjscenehandler.cpp
+++ b/src/plugins/sceneformats/obj/qglobjscenehandler.cpp
@@ -53,7 +53,6 @@ QT_BEGIN_NAMESPACE
QGLObjSceneHandler::QGLObjSceneHandler()
: QGLSceneFormatHandler()
- , palette(0)
, smoothing(QGL::Faceted)
, smoothingForced(false)
{
diff --git a/src/plugins/sceneformats/obj/qglobjscenehandler.h b/src/plugins/sceneformats/obj/qglobjscenehandler.h
index b55d29d1b..1cfd5551f 100644
--- a/src/plugins/sceneformats/obj/qglobjscenehandler.h
+++ b/src/plugins/sceneformats/obj/qglobjscenehandler.h
@@ -63,7 +63,7 @@ private:
void loadMaterials(QIODevice *device);
QGLTexture2D *loadTexture(const QString& name);
- QGLMaterialCollection *palette;
+ QSharedPointer<QGLMaterialCollection> palette;
QGL::Smoothing smoothing;
bool smoothingForced;
//! [2]