Fixed dragging over another track always picking a different connection.
This commit is contained in:
+5
-5
@@ -1333,7 +1333,7 @@ void lcModel::GetScene(lcScene* Scene, const lcCamera* ViewCamera, bool AllowHig
|
||||
if (Scene->GetDrawInterface() && !Scene->GetActiveSubmodelInstance())
|
||||
{
|
||||
if (FocusPiece)
|
||||
UpdateTrainTrackConnections(FocusPiece);
|
||||
UpdateTrainTrackConnections(FocusPiece, false);
|
||||
|
||||
for (const std::unique_ptr<lcCamera>& Camera : mCameras)
|
||||
if (Camera.get() != ViewCamera && Camera->IsVisible())
|
||||
@@ -1352,7 +1352,7 @@ void lcModel::AddSubModelRenderMeshes(lcScene* Scene, const lcMatrix44& WorldMat
|
||||
if (Piece->IsVisibleInSubModel())
|
||||
{
|
||||
if (Piece->IsFocused())
|
||||
UpdateTrainTrackConnections(Piece.get());
|
||||
UpdateTrainTrackConnections(Piece.get(), false);
|
||||
|
||||
Piece->AddSubModelRenderMeshes(Scene, WorldMatrix, DefaultColorIndex, RenderMeshState, ParentActive);
|
||||
}
|
||||
@@ -2508,7 +2508,7 @@ void lcModel::RotateFocusedTrainTrack(int Direction)
|
||||
SaveCheckpoint(tr("Rotating"));
|
||||
}
|
||||
|
||||
void lcModel::UpdateTrainTrackConnections(lcPiece* TrackPiece) const
|
||||
void lcModel::UpdateTrainTrackConnections(lcPiece* TrackPiece, bool IgnoreSelected) const
|
||||
{
|
||||
if (!TrackPiece)
|
||||
return;
|
||||
@@ -2523,7 +2523,7 @@ void lcModel::UpdateTrainTrackConnections(lcPiece* TrackPiece) const
|
||||
|
||||
for (const std::unique_ptr<lcPiece>& Piece : mPieces)
|
||||
{
|
||||
if (Piece.get() == TrackPiece || !Piece->mPieceInfo->GetTrainTrackInfo())
|
||||
if (Piece.get() == TrackPiece || !Piece->mPieceInfo->GetTrainTrackInfo() || (IgnoreSelected && Piece->IsSelected()))
|
||||
continue;
|
||||
|
||||
for (int ConnectionIndex = 0; ConnectionIndex < ConnectionCount; ConnectionIndex++)
|
||||
@@ -4461,7 +4461,7 @@ void lcModel::InsertPieceToolClicked(const std::vector<lcPieceInfoTransform>& Pi
|
||||
gMainWindow->UpdateTimeline(false, false);
|
||||
ClearSelectionAndSetFocus(Piece, LC_PIECE_SECTION_POSITION, false);
|
||||
|
||||
UpdateTrainTrackConnections(Piece);
|
||||
UpdateTrainTrackConnections(Piece, false);
|
||||
|
||||
SaveCheckpoint(tr("Insert"));
|
||||
}
|
||||
|
||||
+1
-1
@@ -267,7 +267,7 @@ public:
|
||||
void Paste(bool PasteToCurrentStep);
|
||||
void DuplicateSelectedPieces();
|
||||
void PaintSelectedPieces();
|
||||
void UpdateTrainTrackConnections(lcPiece* TrackPiece) const;
|
||||
void UpdateTrainTrackConnections(lcPiece* TrackPiece, bool IgnoreSelected) 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;
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#include "lc_application.h"
|
||||
|
||||
// todo:
|
||||
// add 4.5v tracks
|
||||
// when moving existing pieces, lcView::OnMouseMove calls UpdateMoveTool which only takes a position and can't rotate curves
|
||||
// hide some of the 12v tracks to avoid bloat
|
||||
// better insert gizmo mouse detection
|
||||
// part picker preview should use the json colors
|
||||
|
||||
+2
-2
@@ -338,7 +338,7 @@ void lcView::ShowTrainTrackPopup()
|
||||
Piece = ActiveModel->AddPiece(Info, mTrackToolSection);
|
||||
|
||||
if (Piece)
|
||||
ActiveModel->UpdateTrainTrackConnections(Piece);
|
||||
ActiveModel->UpdateTrainTrackConnections(Piece, false);
|
||||
}
|
||||
|
||||
mWidget->UpdateMousePosition();
|
||||
@@ -500,7 +500,7 @@ std::vector<lcPieceInfoTransform> lcView::GetPieceInsertTransform(bool IgnoreSel
|
||||
|
||||
if (RayTrackInfo && InfoTrackInfo)
|
||||
{
|
||||
ActiveModel->UpdateTrainTrackConnections(MousePiece);
|
||||
ActiveModel->UpdateTrainTrackConnections(MousePiece, IgnoreSelected);
|
||||
|
||||
quint32 FocusSection = MousePiece->GetFocusSection();
|
||||
std::vector<lcPieceInfoTransform> TrainTracks = lcTrainTrackInfo::GetPieceInsertTransforms(MousePiece, Info, FocusSection);
|
||||
|
||||
Reference in New Issue
Block a user