mirror of
https://github.com/leozide/leocad
synced 2025-01-17 18:11:42 +01:00
Remove empty steps when moving pieces to a new model.
This commit is contained in:
parent
1794e8c9c2
commit
f7aa4890ee
1 changed files with 7 additions and 1 deletions
|
@ -2214,6 +2214,7 @@ void lcModel::MoveSelectionToModel(lcModel* Model)
|
|||
|
||||
lcArray<lcPiece*> Pieces;
|
||||
lcPiece* ModelPiece = NULL;
|
||||
lcStep FirstStep = LC_STEP_MAX;
|
||||
|
||||
for (int PieceIdx = 0; PieceIdx < mPieces.GetSize(); )
|
||||
{
|
||||
|
@ -2224,6 +2225,7 @@ void lcModel::MoveSelectionToModel(lcModel* Model)
|
|||
mPieces.RemoveIndex(PieceIdx);
|
||||
Piece->SetGroup(NULL); // todo: copy groups
|
||||
Pieces.Add(Piece);
|
||||
FirstStep = qMin(FirstStep, Piece->GetStepShow());
|
||||
|
||||
if (!ModelPiece)
|
||||
{
|
||||
|
@ -2239,7 +2241,11 @@ void lcModel::MoveSelectionToModel(lcModel* Model)
|
|||
}
|
||||
|
||||
for (int PieceIdx = 0; PieceIdx < Pieces.GetSize(); PieceIdx++)
|
||||
Model->AddPiece(Pieces[PieceIdx]);
|
||||
{
|
||||
lcPiece* Piece = Pieces[PieceIdx];
|
||||
Piece->SetStepShow(Piece->GetStepShow() - FirstStep + 1);
|
||||
Model->AddPiece(Piece);
|
||||
}
|
||||
|
||||
lcArray<lcModel*> UpdatedModels;
|
||||
Model->UpdatePieceInfo(UpdatedModels);
|
||||
|
|
Loading…
Reference in a new issue