From b520fe0b6d5323ada9a68dcd680b4b6facfa14d7 Mon Sep 17 00:00:00 2001 From: Gerd Wachsmuth Date: Tue, 2 Jan 2024 11:34:17 +0100 Subject: [PATCH] Undo/redo preserve selected step Fixes leozide/leocad#788 --- common/lc_model.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/common/lc_model.cpp b/common/lc_model.cpp index 999aefb5..a57c38c3 100644 --- a/common/lc_model.cpp +++ b/common/lc_model.cpp @@ -1748,12 +1748,19 @@ void lcModel::LoadCheckPoint(lcModelHistoryEntry* CheckPoint) LoadedInfos.push_back(Info); } + // Remember the current step + const lcStep CurrentStep = mCurrentStep; + DeleteModel(); QBuffer Buffer(&CheckPoint->File); Buffer.open(QIODevice::ReadOnly); LoadLDraw(Buffer, lcGetActiveProject()); + // Reset the current step + mCurrentStep = CurrentStep; + CalculateStep(CurrentStep); + gMainWindow->UpdateTimeline(true, false); gMainWindow->UpdateCameraMenu(); gMainWindow->UpdateCurrentStep();