mirror of
https://github.com/leozide/leocad
synced 2024-11-16 07:47:27 +01:00
Merge pull request #896 from gerw/master
Undo/redo preserve selected step
This commit is contained in:
commit
63272bcc78
1 changed files with 34 additions and 0 deletions
|
@ -1748,12 +1748,46 @@ void lcModel::LoadCheckPoint(lcModelHistoryEntry* CheckPoint)
|
|||
LoadedInfos.push_back(Info);
|
||||
}
|
||||
|
||||
// Remember the current step
|
||||
const lcStep CurrentStep = mCurrentStep;
|
||||
|
||||
// Remember the camera names
|
||||
std::vector<QString> CameraNames;
|
||||
if (gMainWindow)
|
||||
{
|
||||
std::vector<lcView*> Views = lcView::GetModelViews(this);
|
||||
CameraNames.resize( Views.size() );
|
||||
for (unsigned int i = 0; i < Views.size(); i++)
|
||||
{
|
||||
lcCamera* Camera = Views[i]->GetCamera();
|
||||
if (!Camera->IsSimple() && mCameras.FindIndex(Camera) != -1)
|
||||
CameraNames[i] = Camera->GetName();
|
||||
else
|
||||
CameraNames[i] = "";
|
||||
}
|
||||
}
|
||||
|
||||
DeleteModel();
|
||||
|
||||
QBuffer Buffer(&CheckPoint->File);
|
||||
Buffer.open(QIODevice::ReadOnly);
|
||||
LoadLDraw(Buffer, lcGetActiveProject());
|
||||
|
||||
// Reset the current step
|
||||
mCurrentStep = CurrentStep;
|
||||
CalculateStep(CurrentStep);
|
||||
|
||||
// Reset the cameras
|
||||
if (gMainWindow)
|
||||
{
|
||||
std::vector<lcView*> Views = lcView::GetModelViews(this);
|
||||
for (unsigned int i = 0; i < CameraNames.size(); i++)
|
||||
{
|
||||
if (CameraNames[i] != "")
|
||||
Views[i]->SetCamera(CameraNames[i]);
|
||||
}
|
||||
}
|
||||
|
||||
gMainWindow->UpdateTimeline(true, false);
|
||||
gMainWindow->UpdateCurrentStep();
|
||||
gMainWindow->UpdateSelectedObjects(true);
|
||||
|
|
Loading…
Reference in a new issue