summaryrefslogtreecommitdiffstats
path: root/src/Authoring/Qt3DStudio/Palettes
diff options
context:
space:
mode:
authorMiikka Heikkinen <miikka.heikkinen@qt.io>2019-08-19 16:51:08 +0300
committerMiikka Heikkinen <miikka.heikkinen@qt.io>2019-08-23 10:45:56 +0300
commitc66b4928e382121e62a2b9a94d7df57f2d15f65f (patch)
treec2438f4d07c7eee0e46cee0bcfdc2e3c7e777f30 /src/Authoring/Qt3DStudio/Palettes
parent0a5506e4b0713abfe5c0433618ab630412711802 (diff)
Refresh import fixes
- Fixed various issues caused by refresh not being done inside transaction. - Added a confirmation prompt to refresh import to warn user about the operation not being undoable and resetting the undo stack. - Fixed issue where material class update was attempted even if just materialdef file was changed. This should only be done when shader is updated. - Fixed refreshing import that is not referenced currently. - Synced import images and meshes dir names given to ImportImpl constructor and saved to .import file, as the latter are used when refreshing import. "Meshes" vs "meshes" caused breakage of referred highlights and mesh visually updating on editor in some cases. - Fixed the material getting lost when refreshing import where the model name changes but the material stays the same. Task-number: QT3DS-3876 Task-number: QT3DS-3879 Task-number: QT3DS-3880 Change-Id: I65e59a570b01b58d3252457f590b9f4425758865 Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io> Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
Diffstat (limited to 'src/Authoring/Qt3DStudio/Palettes')
-rw-r--r--src/Authoring/Qt3DStudio/Palettes/Project/ProjectView.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/Authoring/Qt3DStudio/Palettes/Project/ProjectView.cpp b/src/Authoring/Qt3DStudio/Palettes/Project/ProjectView.cpp
index 82115094..7946e8a2 100644
--- a/src/Authoring/Qt3DStudio/Palettes/Project/ProjectView.cpp
+++ b/src/Authoring/Qt3DStudio/Palettes/Project/ProjectView.cpp
@@ -468,9 +468,15 @@ void ProjectView::refreshImport(int row) const
const QFileInfo newFile(g_StudioApp.GetDialogs()->ConfirmRefreshModelFile(fullSrcPath));
if (newFile.exists() && newFile.isFile()) {
// We don't want to create undo point of "Refresh Import", undoing this sort of
- // thing is supposed to be done in the DCC tool.
- g_StudioApp.GetCore()->GetDoc()->getSceneEditor()->RefreshImport(
- oldFile.canonicalFilePath(), newFile.canonicalFilePath());
+ // thing is supposed to be done in the DCC tool. However, we do want to do the
+ // refresh inside a transaction to make sure signaling works correctly.
+ SCOPED_DOCUMENT_EDITOR(*g_StudioApp.GetCore()->GetDoc(), QObject::tr("Refresh Import"))
+ ->RefreshImport(oldFile.canonicalFilePath(), newFile.canonicalFilePath(), path);
+ // Clear undo/redo stack to ensure stack is not corrupted
+ // after refresh (stack may contain additions/deletions with chosen import,
+ // in which case undoing/redoing those actions can result in crashes or wrong meshes)
+ g_StudioApp.GetCore()->GetCmdStack()->Clear();
+ g_StudioApp.GetCore()->GetDoc()->SetModifiedFlag(true);
}
}
}