summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiikka Heikkinen <miikka.heikkinen@qt.io>2016-06-29 15:28:02 +0300
committerMiikka Heikkinen <miikka.heikkinen@qt.io>2016-06-30 06:39:38 +0000
commit5a4a524f8e242b4669a1a97619d7448d013ff11d (patch)
tree724bf7171cb7d2523756c15ff7f029538d9d396d
parent6cd403a996bed7a4d4726f75ce6cf086233a354f (diff)
Don't save camera projection matrix
Projection matrix can be calculated from other values, so storing it is unnecessary. Setting it explicitly changes the projection type to custom, which we don't support. Change-Id: Iec7f8b08f52c1693aa9e4dde4c896e994fc8b364 Reviewed-by: Mika Salmela <mika.salmela@qt.io> Reviewed-by: Titta Heikkala <titta.heikkala@qt.io>
-rw-r--r--creatorplugin/tocreator/qt3dsceneeditor/GeneratedScene_scene_res/GeneratedScene.qml1
-rw-r--r--editorlib/src/editorsceneparser.cpp19
-rw-r--r--editorlib/src/editorsceneparser.h1
3 files changed, 19 insertions, 2 deletions
diff --git a/creatorplugin/tocreator/qt3dsceneeditor/GeneratedScene_scene_res/GeneratedScene.qml b/creatorplugin/tocreator/qt3dsceneeditor/GeneratedScene_scene_res/GeneratedScene.qml
index c01c07f..ff262d9 100644
--- a/creatorplugin/tocreator/qt3dsceneeditor/GeneratedScene_scene_res/GeneratedScene.qml
+++ b/creatorplugin/tocreator/qt3dsceneeditor/GeneratedScene_scene_res/GeneratedScene.qml
@@ -64,7 +64,6 @@ Scene3D {
farPlane: 50
fieldOfView: 45
aspectRatio: 1.7777777910232544
- projectionMatrix: Qt.matrix4x4(1.358,0,0,0,0,2.41421,0,0,0,0,-1.00401,-0.200401,0,0,-1,0)
position: Qt.vector3d(4,5,-5)
viewCenter: Qt.vector3d(0,0,0)
}
diff --git a/editorlib/src/editorsceneparser.cpp b/editorlib/src/editorsceneparser.cpp
index 06d004a..fa2185b 100644
--- a/editorlib/src/editorsceneparser.cpp
+++ b/editorlib/src/editorsceneparser.cpp
@@ -730,7 +730,10 @@ void EditorSceneParser::outEntity(Qt3DCore::QEntity *entity)
m_idMap.insert(quint64(entity), entityId);
outItemId(entityId);
- outGenericProperties(type, entity);
+ if (type == Camera)
+ outCamera(entity);
+ else
+ outGenericProperties(type, entity);
// Output components
Qt3DCore::QComponentVector componentList = entity->components();
@@ -1071,6 +1074,20 @@ void EditorSceneParser::outSceneLoader(Qt3DCore::QComponent *component)
outGenericProperties(SceneLoader, component);
}
+void EditorSceneParser::outCamera(Qt3DCore::QEntity *entity)
+{
+ QVector<QMetaProperty> properties = m_propertyMap.value(Camera);
+ QObject *defaultObject = m_defaultObjectMap.value(Camera);
+ for (int i = 0; i < properties.size(); i++) {
+ QString propertyName = properties.at(i).name();
+ // Skip storing projection matrix for cameras, as setting it explicitly changes camera
+ // projectionType to CustomProjection, which we don't support.
+ // Also, projection matrix will be determined from other values, so storing it is unnecessary.
+ if (propertyName != QStringLiteral("projectionMatrix"))
+ outGenericProperty(entity, properties.at(i), defaultObject);
+ }
+}
+
QString EditorSceneParser::indent() const
{
return QString(m_spaceArray.constData(), m_indentLevel * 4);
diff --git a/editorlib/src/editorsceneparser.h b/editorlib/src/editorsceneparser.h
index 4525346..be5e440 100644
--- a/editorlib/src/editorsceneparser.h
+++ b/editorlib/src/editorsceneparser.h
@@ -124,6 +124,7 @@ private:
const QMetaProperty &property, const QObject *defaultComponent);
void outHelperFunctions();
void outSceneLoader(Qt3DCore::QComponent *component);
+ void outCamera(Qt3DCore::QEntity *entity);
QString indent() const;
EditorItemType itemType(QObject *item) const;