mirror of
https://github.com/leozide/leocad
synced 2024-12-24 21:58:12 +01:00
Fixed train track insert while in submodel editing.
This commit is contained in:
parent
17078dd447
commit
642e0965ae
3 changed files with 13 additions and 1 deletions
|
@ -1348,8 +1348,15 @@ void lcModel::GetScene(lcScene* Scene, const lcCamera* ViewCamera, bool AllowHig
|
|||
void lcModel::AddSubModelRenderMeshes(lcScene* Scene, const lcMatrix44& WorldMatrix, int DefaultColorIndex, lcRenderMeshState RenderMeshState, bool ParentActive) const
|
||||
{
|
||||
for (const std::unique_ptr<lcPiece>& Piece : mPieces)
|
||||
{
|
||||
if (Piece->IsVisibleInSubModel())
|
||||
{
|
||||
if (Piece->IsFocused())
|
||||
UpdateTrainTrackConnections(Piece.get());
|
||||
|
||||
Piece->AddSubModelRenderMeshes(Scene, WorldMatrix, DefaultColorIndex, RenderMeshState, ParentActive);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QImage lcModel::GetStepImage(bool Zoom, int Width, int Height, lcStep Step)
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
// shortcuts for changing active connection
|
||||
// move config to json
|
||||
// add other track types
|
||||
// crash when focusing a track during in place submodel editing because GetScene doesn't have the focus piece
|
||||
// macros to encode/decode mTrackToolSection
|
||||
|
||||
void lcTrainTrackInit(lcPiecesLibrary* Library)
|
||||
|
|
|
@ -438,6 +438,9 @@ void lcView::UpdatePiecePreview()
|
|||
lcTrainTrackType TrainTrackType = static_cast<lcTrainTrackType>((mTrackToolSection >> 8) & 0xff);
|
||||
|
||||
std::tie(PreviewInfo, mPiecePreviewTransform) = TrainTrackInfo->GetPieceInsertTransform(Piece, ConnectionIndex, TrainTrackType);
|
||||
|
||||
if (GetActiveModel() != mModel)
|
||||
mPiecePreviewTransform = lcMul(mPiecePreviewTransform, mActiveSubmodelTransform);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2497,6 +2500,9 @@ void lcView::OnButtonDown(lcTrackButton TrackButton)
|
|||
if (!mPiecePreviewInfo)
|
||||
break;
|
||||
|
||||
if (GetActiveModel() != mModel)
|
||||
mPiecePreviewTransform = lcMul(mPiecePreviewTransform, lcMatrix44AffineInverse(mActiveSubmodelTransform));
|
||||
|
||||
ActiveModel->InsertPieceToolClicked(mPiecePreviewInfo, mPiecePreviewTransform);
|
||||
|
||||
if ((mMouseModifiers & Qt::ControlModifier) == 0)
|
||||
|
|
Loading…
Reference in a new issue