summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorKaj Grönholm <kaj.gronholm@qt.io>2018-02-05 16:07:01 +0200
committerLaszlo Agocs <laszlo.agocs@qt.io>2018-02-07 10:28:36 +0000
commit03bb8ee7733b29bcc15dde674090152f545ec344 (patch)
tree3dabc66da6bb4afcf9c5477ccbcca19a54b94968 /tools
parent910baa1ba63da503c1a35477ad1e63854ad8712e (diff)
Document API for dynamic loading
Add Q3DS*Document classes to allow dynamically building presentation with multiple uip & qml documents. Each subdocument can either be loaded from file or from data. Some refactoring to slice Q3DSEngine methods more reusable. Also keep parsed Q3DSPresentation in engine side and not in Q3DSUipDocument, so documents are simple setter/getters. Contains autotests for documents and few extra cases into uipparser autotests. Task-number: QT3DS-855 Change-Id: Ia2c2ee8fd737719ddd9045a489d123564997a974 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Diffstat (limited to 'tools')
-rw-r--r--tools/q3dsviewer/q3dsmainwindow.cpp25
-rw-r--r--tools/qt3dsexplorer/q3dsexplorermainwindow.cpp2
2 files changed, 17 insertions, 10 deletions
diff --git a/tools/q3dsviewer/q3dsmainwindow.cpp b/tools/q3dsviewer/q3dsmainwindow.cpp
index c111a9b..88af662 100644
--- a/tools/q3dsviewer/q3dsmainwindow.cpp
+++ b/tools/q3dsviewer/q3dsmainwindow.cpp
@@ -121,24 +121,27 @@ Q3DStudioMainWindow::Q3DStudioMainWindow(Q3DSWindow *view, QWidget *parent)
QMenu *debugMenu = menuBar()->addMenu(tr("&Debug"));
debugMenu->addAction(tr("&Object graph..."), [=]() {
- Q3DSUtils::showObjectGraph(view->engine()->uipDocument()->presentation()->scene());
+ Q3DSUtils::showObjectGraph(view->engine()->presentation()->scene());
});
debugMenu->addAction(tr("&Scene slide graph..."), [=]() {
- Q3DSUtils::showObjectGraph(view->engine()->uipDocument()->presentation()->masterSlide());
+ Q3DSUtils::showObjectGraph(view->engine()->presentation()->masterSlide());
});
QAction *depthTexAction = debugMenu->addAction(tr("&Force depth texture"));
depthTexAction->setCheckable(true);
depthTexAction->setChecked(false);
connect(depthTexAction, &QAction::toggled, [=]() {
- Q3DSPresentation::forAllLayers(view->engine()->uipDocument()->presentation()->scene(), [=](Q3DSLayerNode *layer3DS) {
- view->engine()->sceneManager()->setDepthTextureEnabled(layer3DS, depthTexAction->isChecked());
+ Q3DSPresentation::forAllLayers(view->engine()->presentation()->scene(),
+ [=](Q3DSLayerNode *layer3DS) {
+ view->engine()->sceneManager()->setDepthTextureEnabled(
+ layer3DS, depthTexAction->isChecked());
});
});
QAction *ssaoAction = debugMenu->addAction(tr("Force SS&AO"));
ssaoAction->setCheckable(true);
ssaoAction->setChecked(false);
connect(ssaoAction, &QAction::toggled, [=]() {
- Q3DSPresentation::forAllLayers(view->engine()->uipDocument()->presentation()->scene(), [=](Q3DSLayerNode *layer3DS) {
+ Q3DSPresentation::forAllLayers(view->engine()->presentation()->scene(),
+ [=](Q3DSLayerNode *layer3DS) {
Q3DSPropertyChangeList changeList;
const QString value = ssaoAction->isChecked() ? QLatin1String("50") : QLatin1String("0");
changeList.append(Q3DSPropertyChange(QLatin1String("aostrength"), value));
@@ -148,15 +151,18 @@ Q3DStudioMainWindow::Q3DStudioMainWindow(Q3DSWindow *view, QWidget *parent)
});
QAction *rebuildMatAction = debugMenu->addAction(tr("&Rebuild model materials"));
connect(rebuildMatAction, &QAction::triggered, [=]() {
- Q3DSPresentation::forAllModels(view->engine()->uipDocument()->presentation()->scene(), [=](Q3DSModelNode *model3DS) {
+ Q3DSPresentation::forAllModels(view->engine()->presentation()->scene(),
+ [=](Q3DSModelNode *model3DS) {
view->engine()->sceneManager()->rebuildModelMaterial(model3DS);
});
});
QAction *toggleShadowAction = debugMenu->addAction(tr("&Toggle shadow casting for point lights"));
connect(toggleShadowAction, &QAction::triggered, [=]() {
- Q3DSPresentation::forAllObjectsOfType(view->engine()->uipDocument()->presentation()->scene(), Q3DSGraphObject::Light, [=](Q3DSGraphObject *obj) {
+ Q3DSPresentation::forAllObjectsOfType(view->engine()->presentation()->scene(),
+ Q3DSGraphObject::Light, [=](Q3DSGraphObject *obj) {
Q3DSLightNode *light3DS = static_cast<Q3DSLightNode *>(obj);
- if (light3DS->flags().testFlag(Q3DSNode::Active) && light3DS->lightType() == Q3DSLightNode::Point) {
+ if (light3DS->flags().testFlag(Q3DSNode::Active) &&
+ light3DS->lightType() == Q3DSLightNode::Point) {
Q3DSPropertyChangeList changeList;
const QString value = light3DS->castShadow() ? QLatin1String("false") : QLatin1String("true");
changeList.append(Q3DSPropertyChange(QLatin1String("castshadow"), value));
@@ -167,7 +173,8 @@ Q3DStudioMainWindow::Q3DStudioMainWindow(Q3DSWindow *view, QWidget *parent)
});
QAction *shadowResChangeAction = debugMenu->addAction(tr("&Maximize shadow map resolution for lights"));
connect(shadowResChangeAction, &QAction::triggered, [=]() {
- Q3DSPresentation::forAllObjectsOfType(view->engine()->uipDocument()->presentation()->scene(), Q3DSGraphObject::Light, [=](Q3DSGraphObject *obj) {
+ Q3DSPresentation::forAllObjectsOfType(view->engine()->presentation()->scene(),
+ Q3DSGraphObject::Light, [=](Q3DSGraphObject *obj) {
Q3DSLightNode *light3DS = static_cast<Q3DSLightNode *>(obj);
if (light3DS->flags().testFlag(Q3DSNode::Active)) {
Q3DSPropertyChangeList changeList;
diff --git a/tools/qt3dsexplorer/q3dsexplorermainwindow.cpp b/tools/qt3dsexplorer/q3dsexplorermainwindow.cpp
index 4b11893..539bfdb 100644
--- a/tools/qt3dsexplorer/q3dsexplorermainwindow.cpp
+++ b/tools/qt3dsexplorer/q3dsexplorermainwindow.cpp
@@ -133,7 +133,7 @@ Q3DSExplorerMainWindow::~Q3DSExplorerMainWindow()
void Q3DSExplorerMainWindow::updatePresentation()
{
- auto pres = m_view->engine()->uipDocument()->presentation();
+ auto pres = m_view->engine()->presentation();
m_slideExplorer->reset();
m_sceneExplorer->reset();
handleComponentSelected(nullptr);