summaryrefslogtreecommitdiffstats
path: root/src/Authoring
diff options
context:
space:
mode:
authorJanne Kangas <janne.kangas@qt.io>2020-03-13 14:48:25 +0200
committerJanne Kangas <janne.kangas@qt.io>2020-03-24 07:10:36 +0200
commit8065d16d4b63d428aa712e8d83848898e3054184 (patch)
treecc3f49852fb94f7f39fc2102d5df19639c69754c /src/Authoring
parent083e4516a60252d842fb264ac995ca9b92cc71ba (diff)
Force immediate render after files change
Force rendering to keep edit camera view and scene camera views in sync after shader recompilation. Also only clear shader error if object has valid translation. Task-id: QT3DS-4045 Change-Id: I5f3e6feab41f56c00c9bb8190263e73510c04309 Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io> Reviewed-by: Antti Määttä <antti.maatta@qt.io> Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
Diffstat (limited to 'src/Authoring')
-rw-r--r--src/Authoring/Client/Code/Core/Doc/DocumentEditor.cpp4
-rw-r--r--src/Authoring/Client/Code/Core/Doc/IDocSceneGraph.h1
-rw-r--r--src/Authoring/Qt3DStudio/Palettes/Inspector/InspectorControlModel.cpp3
-rw-r--r--src/Authoring/Qt3DStudio/Palettes/Project/ProjectFileSystemModel.cpp5
-rw-r--r--src/Authoring/Qt3DStudio/Render/IStudioRenderer.h3
-rw-r--r--src/Authoring/Qt3DStudio/Render/StudioRenderer.cpp12
6 files changed, 17 insertions, 11 deletions
diff --git a/src/Authoring/Client/Code/Core/Doc/DocumentEditor.cpp b/src/Authoring/Client/Code/Core/Doc/DocumentEditor.cpp
index c7654b82..9ef85efd 100644
--- a/src/Authoring/Client/Code/Core/Doc/DocumentEditor.cpp
+++ b/src/Authoring/Client/Code/Core/Doc/DocumentEditor.cpp
@@ -5511,10 +5511,10 @@ public:
if (hasProgressFired)
theDispatch.FireOnProgressEnd();
- if (requestRender && m_Doc.GetSceneGraph())
- m_Doc.GetSceneGraph()->RequestRender();
if (hasDispatchNotificationScope)
theDispatch.FireEndDataModelNotifications();
+ if (requestRender && m_Doc.GetSceneGraph())
+ m_Doc.GetSceneGraph()->RenderNow();
}
};
}
diff --git a/src/Authoring/Client/Code/Core/Doc/IDocSceneGraph.h b/src/Authoring/Client/Code/Core/Doc/IDocSceneGraph.h
index 4043e864..1bebfedf 100644
--- a/src/Authoring/Client/Code/Core/Doc/IDocSceneGraph.h
+++ b/src/Authoring/Client/Code/Core/Doc/IDocSceneGraph.h
@@ -63,6 +63,7 @@ public:
// Request that this object renders. May be ignored if a transaction
// is ongoing so we don't get multiple rendering per transaction.
virtual void RequestRender() = 0;
+ virtual void RenderNow() = 0;
};
}
#endif
diff --git a/src/Authoring/Qt3DStudio/Palettes/Inspector/InspectorControlModel.cpp b/src/Authoring/Qt3DStudio/Palettes/Inspector/InspectorControlModel.cpp
index 09f7f5e0..aaeb7a89 100644
--- a/src/Authoring/Qt3DStudio/Palettes/Inspector/InspectorControlModel.cpp
+++ b/src/Authoring/Qt3DStudio/Palettes/Inspector/InspectorControlModel.cpp
@@ -925,7 +925,8 @@ void InspectorControlModel::updateValidState(InspectorControlBase *inItem) const
// Check the validity of shader.
if (inItem->m_title == tr("Shader")) {
- auto err = g_StudioApp.getRenderer().getObjectError(inItem->m_instance);
+ QString err;
+ g_StudioApp.getRenderer().getObjectError(inItem->m_instance, err);
if (!err.isEmpty()) {
inItem->m_tooltip = err;
inItem->m_valid = false;
diff --git a/src/Authoring/Qt3DStudio/Palettes/Project/ProjectFileSystemModel.cpp b/src/Authoring/Qt3DStudio/Palettes/Project/ProjectFileSystemModel.cpp
index 77a2a24a..9d608276 100644
--- a/src/Authoring/Qt3DStudio/Palettes/Project/ProjectFileSystemModel.cpp
+++ b/src/Authoring/Qt3DStudio/Palettes/Project/ProjectFileSystemModel.cpp
@@ -253,11 +253,12 @@ void ProjectFileSystemModel::checkShaders(const int startRow, const int endRow)
if (currRow >= startRow && startRow == -1 && currRow <= endRow)
continue;
- auto err = g_StudioApp.getRenderer().getObjectError(instance);
+ QString err;
+ auto res = g_StudioApp.getRenderer().getObjectError(instance, err);
if (!err.isEmpty() && currRow != -1)
m_items[currRow].error = bridge->GetSourcePath(instance) + QStringLiteral("\n\n") + err;
- else if (currRow != -1)
+ else if (currRow != -1 && res)
m_items[currRow].error = QString();
}
}
diff --git a/src/Authoring/Qt3DStudio/Render/IStudioRenderer.h b/src/Authoring/Qt3DStudio/Render/IStudioRenderer.h
index 3faa65d9..6adaafbf 100644
--- a/src/Authoring/Qt3DStudio/Render/IStudioRenderer.h
+++ b/src/Authoring/Qt3DStudio/Render/IStudioRenderer.h
@@ -67,7 +67,8 @@ public:
virtual void SetGuidesEnabled(bool val) = 0;
virtual bool AreGuidesEditable() const = 0;
virtual void SetGuidesEditable(bool val) = 0;
- virtual QString getObjectError(qt3dsdm::Qt3DSDMInstanceHandle theInstance) const = 0;
+ virtual bool getObjectError(qt3dsdm::Qt3DSDMInstanceHandle theInstance,
+ QString &error) const = 0;
// Setting the camera to -1 disables the edit cameras
// So setting the camera to 0- (numcameras - 1) will set change the active
// edit camera.
diff --git a/src/Authoring/Qt3DStudio/Render/StudioRenderer.cpp b/src/Authoring/Qt3DStudio/Render/StudioRenderer.cpp
index dd2c2519..4ec63e19 100644
--- a/src/Authoring/Qt3DStudio/Render/StudioRenderer.cpp
+++ b/src/Authoring/Qt3DStudio/Render/StudioRenderer.cpp
@@ -417,13 +417,15 @@ struct SRendererImpl : public IStudioRenderer,
Render();
}
- QString getObjectError(qt3dsdm::Qt3DSDMInstanceHandle theInstance) const
+ bool getObjectError(qt3dsdm::Qt3DSDMInstanceHandle theInstance, QString &error) const
{
auto translator = m_Translation->GetOrCreateTranslator(theInstance);
- if (translator)
- return static_cast<SGraphObjectTranslator *>(translator)->GetError();
- else
- return {};
+ if (translator) {
+ error = static_cast<SGraphObjectTranslator *>(translator)->GetError();
+ return true;
+ }
+ error = QString();
+ return false;
}
void getPreviewFbo(QSize &outFboDim, qt3ds::QT3DSU32 &outFboTexture) override