Load submodels inside mpd files before loading files from disk.

This commit is contained in:
leozide 2017-08-29 11:11:29 -07:00
parent bf75ce012f
commit 9e12f52bcd

View file

@ -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<lcModel*> UpdatedModels;
UpdatedModels.AllocGrow(mModels.GetSize());