Skip to content

Commit

Permalink
corrected bug in visibility project save, and in project append
Browse files Browse the repository at this point in the history
- layer visibility, when read from project, is now correctly restored
- appending project on empty window does no longer make MeshLab crash
  • Loading branch information
mcallieri committed Jun 15, 2018
1 parent 8f42ebb commit c6e9b0f
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/meshlab/mainwindow_RunTime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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; i<meshDoc()->meshList.size(); i++)
{
QString fullPath = meshDoc()->meshList[i]->fullName();
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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<int, MLRenderingData> 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; i<meshDoc()->meshList.size(); i++)
GLA()->updateMeshSetVisibilities();
for (int i = alreadyLoadedNum; i<meshDoc()->meshList.size(); i++)
{
QString fullPath = meshDoc()->meshList[i]->fullName();
meshDoc()->setBusy(true);
Expand Down

0 comments on commit c6e9b0f

Please sign in to comment.