From c6e9b0ff716bd9c44b70a8232b650d2417ffac26 Mon Sep 17 00:00:00 2001 From: Marco Callieri Date: Fri, 15 Jun 2018 17:06:25 +0200 Subject: [PATCH] corrected bug in visibility project save, and in project append - layer visibility, when read from project, is now correctly restored - appending project on empty window does no longer make MeshLab crash --- src/meshlab/mainwindow_RunTime.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/meshlab/mainwindow_RunTime.cpp b/src/meshlab/mainwindow_RunTime.cpp index 22de1edc21..4349185c31 100644 --- a/src/meshlab/mainwindow_RunTime.cpp +++ b/src/meshlab/mainwindow_RunTime.cpp @@ -2303,6 +2303,7 @@ bool MainWindow::openProject(QString fileName) QMessageBox::critical(this, tr("Meshlab Opening Error"), "Unable to open MeshLab Project file"); return false; } + GLA()->updateMeshSetVisibilities(); for (int i=0; imeshList.size(); i++) { QString fullPath = meshDoc()->meshList[i]->fullName(); @@ -2389,11 +2390,9 @@ bool MainWindow::appendProject(QString fileName) if (fileNameList.isEmpty()) return false; - // Common Part: init a Doc if necessary, and + // Ccheck if we have a doc and if it is empty bool activeDoc = (bool) !mdiarea->subWindowList().empty() && mdiarea->currentSubWindow(); - bool activeEmpty = activeDoc && meshDoc()->meshList.empty(); - - if (activeEmpty) // it is wrong to try appending to an empty project, even if it is possible + if (!activeDoc || meshDoc()->meshList.empty()) // it is wrong to try appending to an empty project, even if it is possible { QMessageBox::critical(this, tr("Meshlab Opening Error"), "Current project is empty, cannot append"); return false; @@ -2438,14 +2437,15 @@ bool MainWindow::appendProject(QString fileName) if (QString(fi.suffix()).toLower() == "mlp" || QString(fi.suffix()).toLower() == "mlb") { - int alreadyLoadedNum = meshDoc()->meshList.size(); + int alreadyLoadedNum = meshDoc()->meshList.size(); std::map rendOpt; if (!MeshDocumentFromXML(*meshDoc(),fileName, QString(fi.suffix()).toLower() == "mlb", rendOpt)) { QMessageBox::critical(this, tr("Meshlab Opening Error"), "Unable to open MeshLab Project file"); return false; } - for (int i = alreadyLoadedNum; imeshList.size(); i++) + GLA()->updateMeshSetVisibilities(); + for (int i = alreadyLoadedNum; imeshList.size(); i++) { QString fullPath = meshDoc()->meshList[i]->fullName(); meshDoc()->setBusy(true);