Update connections before using the view manipulator.

This commit is contained in:
Leonardo Zide 2024-11-30 12:36:30 -08:00
parent fd61c1c9f9
commit 17078dd447
3 changed files with 5 additions and 4 deletions

View file

@ -257,6 +257,7 @@ public:
void Paste(bool PasteToCurrentStep); void Paste(bool PasteToCurrentStep);
void DuplicateSelectedPieces(); void DuplicateSelectedPieces();
void PaintSelectedPieces(); void PaintSelectedPieces();
void UpdateTrainTrackConnections(lcPiece* FocusPiece) const;
void GetScene(lcScene* Scene, const lcCamera* ViewCamera, bool AllowHighlight, bool AllowFade) 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; void AddSubModelRenderMeshes(lcScene* Scene, const lcMatrix44& WorldMatrix, int DefaultColorIndex, lcRenderMeshState RenderMeshState, bool ParentActive) const;
@ -391,8 +392,6 @@ protected:
void AddPiece(lcPiece* Piece); void AddPiece(lcPiece* Piece);
void InsertPiece(lcPiece* Piece, size_t Index); void InsertPiece(lcPiece* Piece, size_t Index);
void UpdateTrainTrackConnections(lcPiece* FocusPiece) const;
lcPOVRayOptions mPOVRayOptions; lcPOVRayOptions mPOVRayOptions;
lcModelProperties mProperties; lcModelProperties mProperties;
Project* const mProject; Project* const mProject;

View file

@ -9,7 +9,7 @@
// auto replace cross when going over a straight section // auto replace cross when going over a straight section
// redo gizmo // redo gizmo
// add cross to gizmo // add cross to gizmo
// rotate around connections // rotate around connections shortcut
// shortcuts for changing active connection // shortcuts for changing active connection
// move config to json // move config to json
// add other track types // add other track types

View file

@ -960,11 +960,13 @@ std::pair<lcTrackTool, quint32> lcViewManipulator::UpdateSelectMove()
if (Focus && Focus->IsPiece()) if (Focus && Focus->IsPiece())
{ {
const lcPiece* Piece = (lcPiece*)Focus; lcPiece* Piece = (lcPiece*)Focus;
const lcTrainTrackInfo* TrainTrackInfo = Piece->mPieceInfo->GetTrainTrackInfo(); const lcTrainTrackInfo* TrainTrackInfo = Piece->mPieceInfo->GetTrainTrackInfo();
if (TrainTrackInfo) if (TrainTrackInfo)
{ {
ActiveModel->UpdateTrainTrackConnections(Piece);
const std::vector<lcTrainTrackConnection>& Connections = TrainTrackInfo->GetConnections(); const std::vector<lcTrainTrackConnection>& Connections = TrainTrackInfo->GetConnections();
for (quint32 ConnectionIndex = 0; ConnectionIndex < Connections.size(); ConnectionIndex++) for (quint32 ConnectionIndex = 0; ConnectionIndex < Connections.size(); ConnectionIndex++)