diff options
-rw-r--r-- | creatorplugin/tocreator/qt3dsceneeditor/GeneratedScene_scene_res/GeneratedScene.qml | 1 | ||||
-rw-r--r-- | editorlib/src/editorsceneparser.cpp | 19 | ||||
-rw-r--r-- | editorlib/src/editorsceneparser.h | 1 |
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; |