From 9e12f52bcd0c5bf1617a9100c7e74bcf28157384 Mon Sep 17 00:00:00 2001 From: leozide Date: Tue, 29 Aug 2017 11:11:29 -0700 Subject: [PATCH] Load submodels inside mpd files before loading files from disk. --- common/project.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/common/project.cpp b/common/project.cpp index f56d270f..722f1185 100644 --- a/common/project.cpp +++ b/common/project.cpp @@ -283,7 +283,10 @@ bool Project::Load(const QString& FileName) Model->SplitMPD(Buffer); if (mModels.IsEmpty() || !Model->GetProperties().mName.isEmpty()) + { mModels.Add(Model); + Model->CreatePieceInfo(this); + } else delete Model; } @@ -308,6 +311,7 @@ bool Project::Load(const QString& FileName) if (Model->LoadBinary(&MemFile)) { mModels.Add(Model); + Model->CreatePieceInfo(this); Model->SetSaved(); } else @@ -322,12 +326,12 @@ bool Project::Load(const QString& FileName) lcModel* Model = mModels[0]; if (Model->GetProperties().mName.isEmpty()) + { Model->SetName(FileInfo.fileName()); + lcGetPiecesLibrary()->RenamePiece(Model->GetPieceInfo(), FileInfo.fileName().toLatin1()); + } } - for (int ModelIdx = 0; ModelIdx < mModels.GetSize(); ModelIdx++) - mModels[ModelIdx]->CreatePieceInfo(this); - lcArray UpdatedModels; UpdatedModels.AllocGrow(mModels.GetSize());