mirror of
https://github.com/leozide/leocad
synced 2025-01-17 18:11:42 +01:00
Fixed multiple checkpoints when using the mouse to edit.
This commit is contained in:
parent
0f953e1f63
commit
f8a85809e8
3 changed files with 28 additions and 26 deletions
|
@ -1939,51 +1939,51 @@ void lcMainWindow::HandleCommand(lcCommandId CommandId)
|
|||
break;
|
||||
|
||||
case LC_PIECE_MOVE_PLUSX:
|
||||
lcGetActiveModel()->MoveSelectedObjects(mActiveView->GetMoveDirection(lcVector3(lcMax(GetMoveXYSnap(), 0.01f), 0.0f, 0.0f)), true, true);
|
||||
lcGetActiveModel()->MoveSelectedObjects(mActiveView->GetMoveDirection(lcVector3(lcMax(GetMoveXYSnap(), 0.01f), 0.0f, 0.0f)), true, true, true);
|
||||
break;
|
||||
|
||||
case LC_PIECE_MOVE_MINUSX:
|
||||
lcGetActiveModel()->MoveSelectedObjects(mActiveView->GetMoveDirection(lcVector3(-lcMax(GetMoveXYSnap(), 0.01f), 0.0f, 0.0f)), true, true);
|
||||
lcGetActiveModel()->MoveSelectedObjects(mActiveView->GetMoveDirection(lcVector3(-lcMax(GetMoveXYSnap(), 0.01f), 0.0f, 0.0f)), true, true, true);
|
||||
break;
|
||||
|
||||
case LC_PIECE_MOVE_PLUSY:
|
||||
lcGetActiveModel()->MoveSelectedObjects(mActiveView->GetMoveDirection(lcVector3(0.0f, lcMax(GetMoveXYSnap(), 0.01f), 0.0f)), true, true);
|
||||
lcGetActiveModel()->MoveSelectedObjects(mActiveView->GetMoveDirection(lcVector3(0.0f, lcMax(GetMoveXYSnap(), 0.01f), 0.0f)), true, true, true);
|
||||
break;
|
||||
|
||||
case LC_PIECE_MOVE_MINUSY:
|
||||
lcGetActiveModel()->MoveSelectedObjects(mActiveView->GetMoveDirection(lcVector3(0.0f, -lcMax(GetMoveXYSnap(), 0.01f), 0.0f)), true, true);
|
||||
lcGetActiveModel()->MoveSelectedObjects(mActiveView->GetMoveDirection(lcVector3(0.0f, -lcMax(GetMoveXYSnap(), 0.01f), 0.0f)), true, true, true);
|
||||
break;
|
||||
|
||||
case LC_PIECE_MOVE_PLUSZ:
|
||||
lcGetActiveModel()->MoveSelectedObjects(mActiveView->GetMoveDirection(lcVector3(0.0f, 0.0f, lcMax(GetMoveZSnap(), 0.01f))), true, true);
|
||||
lcGetActiveModel()->MoveSelectedObjects(mActiveView->GetMoveDirection(lcVector3(0.0f, 0.0f, lcMax(GetMoveZSnap(), 0.01f))), true, true, true);
|
||||
break;
|
||||
|
||||
case LC_PIECE_MOVE_MINUSZ:
|
||||
lcGetActiveModel()->MoveSelectedObjects(mActiveView->GetMoveDirection(lcVector3(0.0f, 0.0f, -lcMax(GetMoveZSnap(), 0.01f))), true, true);
|
||||
lcGetActiveModel()->MoveSelectedObjects(mActiveView->GetMoveDirection(lcVector3(0.0f, 0.0f, -lcMax(GetMoveZSnap(), 0.01f))), true, true, true);
|
||||
break;
|
||||
|
||||
case LC_PIECE_ROTATE_PLUSX:
|
||||
lcGetActiveModel()->RotateSelectedPieces(mActiveView->GetMoveDirection(lcVector3(lcMax(GetAngleSnap(), 1.0f), 0.0f, 0.0f)), true, true);
|
||||
lcGetActiveModel()->RotateSelectedPieces(mActiveView->GetMoveDirection(lcVector3(lcMax(GetAngleSnap(), 1.0f), 0.0f, 0.0f)), true, true, true);
|
||||
break;
|
||||
|
||||
case LC_PIECE_ROTATE_MINUSX:
|
||||
lcGetActiveModel()->RotateSelectedPieces(mActiveView->GetMoveDirection(-lcVector3(lcMax(GetAngleSnap(), 1.0f), 0.0f, 0.0f)), true, true);
|
||||
lcGetActiveModel()->RotateSelectedPieces(mActiveView->GetMoveDirection(-lcVector3(lcMax(GetAngleSnap(), 1.0f), 0.0f, 0.0f)), true, true, true);
|
||||
break;
|
||||
|
||||
case LC_PIECE_ROTATE_PLUSY:
|
||||
lcGetActiveModel()->RotateSelectedPieces(mActiveView->GetMoveDirection(lcVector3(0.0f, lcMax(GetAngleSnap(), 1.0f), 0.0f)), true, true);
|
||||
lcGetActiveModel()->RotateSelectedPieces(mActiveView->GetMoveDirection(lcVector3(0.0f, lcMax(GetAngleSnap(), 1.0f), 0.0f)), true, true, true);
|
||||
break;
|
||||
|
||||
case LC_PIECE_ROTATE_MINUSY:
|
||||
lcGetActiveModel()->RotateSelectedPieces(mActiveView->GetMoveDirection(lcVector3(0.0f, -lcMax(GetAngleSnap(), 1.0f), 0.0f)), true, true);
|
||||
lcGetActiveModel()->RotateSelectedPieces(mActiveView->GetMoveDirection(lcVector3(0.0f, -lcMax(GetAngleSnap(), 1.0f), 0.0f)), true, true, true);
|
||||
break;
|
||||
|
||||
case LC_PIECE_ROTATE_PLUSZ:
|
||||
lcGetActiveModel()->RotateSelectedPieces(mActiveView->GetMoveDirection(lcVector3(0.0f, 0.0f, lcMax(GetAngleSnap(), 1.0f))), true, true);
|
||||
lcGetActiveModel()->RotateSelectedPieces(mActiveView->GetMoveDirection(lcVector3(0.0f, 0.0f, lcMax(GetAngleSnap(), 1.0f))), true, true, true);
|
||||
break;
|
||||
|
||||
case LC_PIECE_ROTATE_MINUSZ:
|
||||
lcGetActiveModel()->RotateSelectedPieces(mActiveView->GetMoveDirection(lcVector3(0.0f, 0.0f, -lcMax(GetAngleSnap(), 1.0f))), true, true);
|
||||
lcGetActiveModel()->RotateSelectedPieces(mActiveView->GetMoveDirection(lcVector3(0.0f, 0.0f, -lcMax(GetAngleSnap(), 1.0f))), true, true, true);
|
||||
break;
|
||||
|
||||
case LC_PIECE_MINIFIG_WIZARD:
|
||||
|
|
|
@ -2048,7 +2048,7 @@ bool lcModel::RemoveSelectedObjects()
|
|||
return RemovedPiece || RemovedCamera || RemovedLight;
|
||||
}
|
||||
|
||||
void lcModel::MoveSelectedObjects(const lcVector3& PieceDistance, const lcVector3& ObjectDistance, bool Relative, bool Update)
|
||||
void lcModel::MoveSelectedObjects(const lcVector3& PieceDistance, const lcVector3& ObjectDistance, bool Relative, bool Update, bool Checkpoint)
|
||||
{
|
||||
bool Moved = false;
|
||||
lcMatrix44 RelativeRotation;
|
||||
|
@ -2107,12 +2107,13 @@ void lcModel::MoveSelectedObjects(const lcVector3& PieceDistance, const lcVector
|
|||
if (Moved && Update)
|
||||
{
|
||||
gMainWindow->UpdateAllViews();
|
||||
if (Checkpoint)
|
||||
SaveCheckpoint("Moving");
|
||||
gMainWindow->UpdateFocusObject(GetFocusObject());
|
||||
}
|
||||
}
|
||||
|
||||
void lcModel::RotateSelectedPieces(const lcVector3& Angles, bool Relative, bool Update)
|
||||
void lcModel::RotateSelectedPieces(const lcVector3& Angles, bool Relative, bool Update, bool Checkpoint)
|
||||
{
|
||||
if (Angles.LengthSquared() < 0.001f)
|
||||
return;
|
||||
|
@ -2203,6 +2204,7 @@ void lcModel::RotateSelectedPieces(const lcVector3& Angles, bool Relative, bool
|
|||
if (Rotated && Update)
|
||||
{
|
||||
gMainWindow->UpdateAllViews();
|
||||
if (Checkpoint)
|
||||
SaveCheckpoint("Rotating");
|
||||
gMainWindow->UpdateFocusObject(GetFocusObject());
|
||||
}
|
||||
|
@ -2213,19 +2215,19 @@ void lcModel::TransformSelectedObjects(lcTransformType TransformType, const lcVe
|
|||
switch (TransformType)
|
||||
{
|
||||
case LC_TRANSFORM_ABSOLUTE_TRANSLATION:
|
||||
MoveSelectedObjects(Transform, false, true);
|
||||
MoveSelectedObjects(Transform, false, true, true);
|
||||
break;
|
||||
|
||||
case LC_TRANSFORM_RELATIVE_TRANSLATION:
|
||||
MoveSelectedObjects(Transform, true, true);
|
||||
MoveSelectedObjects(Transform, true, true, true);
|
||||
break;
|
||||
|
||||
case LC_TRANSFORM_ABSOLUTE_ROTATION:
|
||||
RotateSelectedPieces(Transform, false, true);
|
||||
RotateSelectedPieces(Transform, false, true, true);
|
||||
break;
|
||||
|
||||
case LC_TRANSFORM_RELATIVE_ROTATION:
|
||||
RotateSelectedPieces(Transform, true, true);
|
||||
RotateSelectedPieces(Transform, true, true, true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -3273,7 +3275,7 @@ void lcModel::UpdateMoveTool(const lcVector3& Distance)
|
|||
lcVector3 PieceDistance = LockVector(SnapPosition(Distance) - SnapPosition(mMouseToolDistance));
|
||||
lcVector3 ObjectDistance = Distance - mMouseToolDistance;
|
||||
|
||||
MoveSelectedObjects(PieceDistance, ObjectDistance, true, true);
|
||||
MoveSelectedObjects(PieceDistance, ObjectDistance, true, true, false);
|
||||
mMouseToolDistance = Distance;
|
||||
|
||||
gMainWindow->UpdateFocusObject(GetFocusObject());
|
||||
|
@ -3283,7 +3285,7 @@ void lcModel::UpdateMoveTool(const lcVector3& Distance)
|
|||
void lcModel::UpdateRotateTool(const lcVector3& Angles)
|
||||
{
|
||||
lcVector3 Delta = LockVector(SnapRotation(Angles) - SnapRotation(mMouseToolDistance));
|
||||
RotateSelectedPieces(Delta, true, false);
|
||||
RotateSelectedPieces(Delta, true, false, false);
|
||||
mMouseToolDistance = Angles;
|
||||
|
||||
gMainWindow->UpdateFocusObject(GetFocusObject());
|
||||
|
|
|
@ -300,13 +300,13 @@ public:
|
|||
void ZoomExtents(lcCamera* Camera, float Aspect);
|
||||
void Zoom(lcCamera* Camera, float Amount);
|
||||
|
||||
void MoveSelectedObjects(const lcVector3& Distance, bool Relative, bool Update)
|
||||
void MoveSelectedObjects(const lcVector3& Distance, bool Relative, bool Update, bool Checkpoint)
|
||||
{
|
||||
MoveSelectedObjects(Distance, Distance, Relative, Update);
|
||||
MoveSelectedObjects(Distance, Distance, Relative, Update, Checkpoint);
|
||||
}
|
||||
|
||||
void MoveSelectedObjects(const lcVector3& PieceDistance, const lcVector3& ObjectDistance, bool Relative, bool Update);
|
||||
void RotateSelectedPieces(const lcVector3& Angles, bool Relative, bool Update);
|
||||
void MoveSelectedObjects(const lcVector3& PieceDistance, const lcVector3& ObjectDistance, bool Relative, bool Update, bool Checkpoint);
|
||||
void RotateSelectedPieces(const lcVector3& Angles, bool Relative, bool Update, bool Checkpoint);
|
||||
void TransformSelectedObjects(lcTransformType TransformType, const lcVector3& Transform);
|
||||
void SetObjectProperty(lcObject* Object, lcObjectPropertyType ObjectPropertyType, const void* Value);
|
||||
|
||||
|
|
Loading…
Reference in a new issue