summaryrefslogtreecommitdiffstats
path: root/editorlib/src/editorscene.cpp
diff options
context:
space:
mode:
authorMiikka Heikkinen <miikka.heikkinen@qt.io>2016-11-07 15:39:49 +0200
committerMiikka Heikkinen <miikka.heikkinen@qt.io>2016-11-08 09:23:33 +0000
commitb3a15d608daf1065f8da3b985b4d9e189fcd977b (patch)
tree05533d8dc80bf240171c02815b0640f332f300dc /editorlib/src/editorscene.cpp
parent65e5d11f194224b74a8aa51f49c75e6f31ff9e37 (diff)
New export GLTF dialog
Allows setting export options and more intuitive scene name handling. Change-Id: Iad586760bcdb83ae24ef3118139fb20aac1a56d1 Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
Diffstat (limited to 'editorlib/src/editorscene.cpp')
-rw-r--r--editorlib/src/editorscene.cpp26
1 files changed, 15 insertions, 11 deletions
diff --git a/editorlib/src/editorscene.cpp b/editorlib/src/editorscene.cpp
index c9e0cc5..1d5a4ce 100644
--- a/editorlib/src/editorscene.cpp
+++ b/editorlib/src/editorscene.cpp
@@ -2179,19 +2179,21 @@ void EditorScene::changeCameraPosition(EditorScene::CameraPosition preset)
camera->setUpVector(up);
}
-bool EditorScene::exportGltfScene(const QUrl &fileUrl)
+bool EditorScene::exportGltfScene(const QUrl &folder, const QString &exportName,
+ const QJSValue &options)
{
#ifdef GLTF_EXPORTER_AVAILABLE
if (canExportGltf()) {
- QVariantHash options;
- // Export binary json for maximum loading efficiency
- options.insert(QStringLiteral("binaryJson"), QVariant(true));
- QString exportDir = fileUrl.toLocalFile();
- int index = exportDir.lastIndexOf(QLatin1Char('/'));
- QString sceneName = exportDir.mid(index + 1);
- exportDir.chop(sceneName.length() + 1);
- if (exportDir.length() > 0 && sceneName.length() > 0) {
- if (!m_gltfExporter->exportScene(m_sceneEntity, exportDir, sceneName, options))
+ QString exportDir = folder.toLocalFile();
+ QVariantHash optionsHash;
+ const QString binaryKey = QStringLiteral("binaryJson");
+ const QString compactKey = QStringLiteral("compactJson");
+ if (options.hasProperty(binaryKey))
+ optionsHash.insert(binaryKey, options.property(binaryKey).toBool());
+ if (options.hasProperty(compactKey))
+ optionsHash.insert(compactKey, options.property(compactKey).toBool());
+ if (exportDir.length() > 0 && exportName.length() > 0) {
+ if (!m_gltfExporter->exportScene(m_sceneEntity, exportDir, exportName, optionsHash))
setError(m_gltfExportFailString);
else
return true;
@@ -2200,7 +2202,9 @@ bool EditorScene::exportGltfScene(const QUrl &fileUrl)
}
}
#else
- Q_UNUSED(fileUrl)
+ Q_UNUSED(folder)
+ Q_UNUSED(exportName)
+ Q_UNUSED(options)
#endif
return false;
}