Fixed multiple checkpoints when using the mouse to edit.

This commit is contained in:
leo 2015-03-16 01:15:30 +00:00
parent 0f953e1f63
commit f8a85809e8
3 changed files with 28 additions and 26 deletions

View file

@ -1939,51 +1939,51 @@ void lcMainWindow::HandleCommand(lcCommandId CommandId)
break; break;
case LC_PIECE_MOVE_PLUSX: 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; break;
case LC_PIECE_MOVE_MINUSX: 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; break;
case LC_PIECE_MOVE_PLUSY: 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; break;
case LC_PIECE_MOVE_MINUSY: 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; break;
case LC_PIECE_MOVE_PLUSZ: 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; break;
case LC_PIECE_MOVE_MINUSZ: 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; break;
case LC_PIECE_ROTATE_PLUSX: 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; break;
case LC_PIECE_ROTATE_MINUSX: 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; break;
case LC_PIECE_ROTATE_PLUSY: 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; break;
case LC_PIECE_ROTATE_MINUSY: 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; break;
case LC_PIECE_ROTATE_PLUSZ: 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; break;
case LC_PIECE_ROTATE_MINUSZ: 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; break;
case LC_PIECE_MINIFIG_WIZARD: case LC_PIECE_MINIFIG_WIZARD:

View file

@ -2048,7 +2048,7 @@ bool lcModel::RemoveSelectedObjects()
return RemovedPiece || RemovedCamera || RemovedLight; 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; bool Moved = false;
lcMatrix44 RelativeRotation; lcMatrix44 RelativeRotation;
@ -2107,12 +2107,13 @@ void lcModel::MoveSelectedObjects(const lcVector3& PieceDistance, const lcVector
if (Moved && Update) if (Moved && Update)
{ {
gMainWindow->UpdateAllViews(); gMainWindow->UpdateAllViews();
SaveCheckpoint("Moving"); if (Checkpoint)
SaveCheckpoint("Moving");
gMainWindow->UpdateFocusObject(GetFocusObject()); 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) if (Angles.LengthSquared() < 0.001f)
return; return;
@ -2203,7 +2204,8 @@ void lcModel::RotateSelectedPieces(const lcVector3& Angles, bool Relative, bool
if (Rotated && Update) if (Rotated && Update)
{ {
gMainWindow->UpdateAllViews(); gMainWindow->UpdateAllViews();
SaveCheckpoint("Rotating"); if (Checkpoint)
SaveCheckpoint("Rotating");
gMainWindow->UpdateFocusObject(GetFocusObject()); gMainWindow->UpdateFocusObject(GetFocusObject());
} }
} }
@ -2213,19 +2215,19 @@ void lcModel::TransformSelectedObjects(lcTransformType TransformType, const lcVe
switch (TransformType) switch (TransformType)
{ {
case LC_TRANSFORM_ABSOLUTE_TRANSLATION: case LC_TRANSFORM_ABSOLUTE_TRANSLATION:
MoveSelectedObjects(Transform, false, true); MoveSelectedObjects(Transform, false, true, true);
break; break;
case LC_TRANSFORM_RELATIVE_TRANSLATION: case LC_TRANSFORM_RELATIVE_TRANSLATION:
MoveSelectedObjects(Transform, true, true); MoveSelectedObjects(Transform, true, true, true);
break; break;
case LC_TRANSFORM_ABSOLUTE_ROTATION: case LC_TRANSFORM_ABSOLUTE_ROTATION:
RotateSelectedPieces(Transform, false, true); RotateSelectedPieces(Transform, false, true, true);
break; break;
case LC_TRANSFORM_RELATIVE_ROTATION: case LC_TRANSFORM_RELATIVE_ROTATION:
RotateSelectedPieces(Transform, true, true); RotateSelectedPieces(Transform, true, true, true);
break; break;
} }
} }
@ -3273,7 +3275,7 @@ void lcModel::UpdateMoveTool(const lcVector3& Distance)
lcVector3 PieceDistance = LockVector(SnapPosition(Distance) - SnapPosition(mMouseToolDistance)); lcVector3 PieceDistance = LockVector(SnapPosition(Distance) - SnapPosition(mMouseToolDistance));
lcVector3 ObjectDistance = Distance - mMouseToolDistance; lcVector3 ObjectDistance = Distance - mMouseToolDistance;
MoveSelectedObjects(PieceDistance, ObjectDistance, true, true); MoveSelectedObjects(PieceDistance, ObjectDistance, true, true, false);
mMouseToolDistance = Distance; mMouseToolDistance = Distance;
gMainWindow->UpdateFocusObject(GetFocusObject()); gMainWindow->UpdateFocusObject(GetFocusObject());
@ -3283,7 +3285,7 @@ void lcModel::UpdateMoveTool(const lcVector3& Distance)
void lcModel::UpdateRotateTool(const lcVector3& Angles) void lcModel::UpdateRotateTool(const lcVector3& Angles)
{ {
lcVector3 Delta = LockVector(SnapRotation(Angles) - SnapRotation(mMouseToolDistance)); lcVector3 Delta = LockVector(SnapRotation(Angles) - SnapRotation(mMouseToolDistance));
RotateSelectedPieces(Delta, true, false); RotateSelectedPieces(Delta, true, false, false);
mMouseToolDistance = Angles; mMouseToolDistance = Angles;
gMainWindow->UpdateFocusObject(GetFocusObject()); gMainWindow->UpdateFocusObject(GetFocusObject());

View file

@ -300,13 +300,13 @@ public:
void ZoomExtents(lcCamera* Camera, float Aspect); void ZoomExtents(lcCamera* Camera, float Aspect);
void Zoom(lcCamera* Camera, float Amount); 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 MoveSelectedObjects(const lcVector3& PieceDistance, const lcVector3& ObjectDistance, bool Relative, bool Update, bool Checkpoint);
void RotateSelectedPieces(const lcVector3& Angles, bool Relative, bool Update); void RotateSelectedPieces(const lcVector3& Angles, bool Relative, bool Update, bool Checkpoint);
void TransformSelectedObjects(lcTransformType TransformType, const lcVector3& Transform); void TransformSelectedObjects(lcTransformType TransformType, const lcVector3& Transform);
void SetObjectProperty(lcObject* Object, lcObjectPropertyType ObjectPropertyType, const void* Value); void SetObjectProperty(lcObject* Object, lcObjectPropertyType ObjectPropertyType, const void* Value);