From 17078dd447b1016f4c740ef4119a12af8c44d959 Mon Sep 17 00:00:00 2001 From: Leonardo Zide Date: Sat, 30 Nov 2024 12:36:30 -0800 Subject: [PATCH] Update connections before using the view manipulator. --- common/lc_model.h | 3 +-- common/lc_traintrack.cpp | 2 +- common/lc_viewmanipulator.cpp | 4 +++- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/common/lc_model.h b/common/lc_model.h index 1f1e484d..3a1dc64e 100644 --- a/common/lc_model.h +++ b/common/lc_model.h @@ -257,6 +257,7 @@ public: void Paste(bool PasteToCurrentStep); void DuplicateSelectedPieces(); void PaintSelectedPieces(); + void UpdateTrainTrackConnections(lcPiece* FocusPiece) const; void GetScene(lcScene* Scene, const lcCamera* ViewCamera, bool AllowHighlight, bool AllowFade) const; void AddSubModelRenderMeshes(lcScene* Scene, const lcMatrix44& WorldMatrix, int DefaultColorIndex, lcRenderMeshState RenderMeshState, bool ParentActive) const; @@ -391,8 +392,6 @@ protected: void AddPiece(lcPiece* Piece); void InsertPiece(lcPiece* Piece, size_t Index); - void UpdateTrainTrackConnections(lcPiece* FocusPiece) const; - lcPOVRayOptions mPOVRayOptions; lcModelProperties mProperties; Project* const mProject; diff --git a/common/lc_traintrack.cpp b/common/lc_traintrack.cpp index 0f39e7f0..9665aefd 100644 --- a/common/lc_traintrack.cpp +++ b/common/lc_traintrack.cpp @@ -9,7 +9,7 @@ // auto replace cross when going over a straight section // redo gizmo // add cross to gizmo -// rotate around connections +// rotate around connections shortcut // shortcuts for changing active connection // move config to json // add other track types diff --git a/common/lc_viewmanipulator.cpp b/common/lc_viewmanipulator.cpp index 5cee29a7..85e0bfde 100644 --- a/common/lc_viewmanipulator.cpp +++ b/common/lc_viewmanipulator.cpp @@ -960,11 +960,13 @@ std::pair lcViewManipulator::UpdateSelectMove() if (Focus && Focus->IsPiece()) { - const lcPiece* Piece = (lcPiece*)Focus; + lcPiece* Piece = (lcPiece*)Focus; const lcTrainTrackInfo* TrainTrackInfo = Piece->mPieceInfo->GetTrainTrackInfo(); if (TrainTrackInfo) { + ActiveModel->UpdateTrainTrackConnections(Piece); + const std::vector& Connections = TrainTrackInfo->GetConnections(); for (quint32 ConnectionIndex = 0; ConnectionIndex < Connections.size(); ConnectionIndex++)