Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package leocad for openSUSE:Factory checked in at 2021-04-29 22:46:07 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/leocad (Old) and /work/SRC/openSUSE:Factory/.leocad.new.1947 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "leocad" Thu Apr 29 22:46:07 2021 rev:4 rq:889125 version:21.03 Changes: -------- --- /work/SRC/openSUSE:Factory/leocad/leocad.changes 2021-04-17 23:25:14.357622086 +0200 +++ /work/SRC/openSUSE:Factory/.leocad.new.1947/leocad.changes 2021-04-29 22:52:45.282066998 +0200 @@ -1,0 +2,10 @@ +Wed Apr 28 19:05:13 UTC 2021 - Gustavo Pichorim Boiko <gbo...@suse.com> + +- Backport upstream fixes for moving of rotated pieces. + Added patches: + * 0001-Don-t-enable-relative-transforms-by-default.patch + * 0002-Disabled-relative-movement-when-moving-pieces-withou.patch + * 0003-Fixed-moving-pieces-while-editing-submodels-in-place.patch + * 0004-Fixed-drawing-the-rotate-overlay-during-in-place-sub.patch + +------------------------------------------------------------------- New: ---- 0001-Don-t-enable-relative-transforms-by-default.patch 0002-Disabled-relative-movement-when-moving-pieces-withou.patch 0003-Fixed-moving-pieces-while-editing-submodels-in-place.patch 0004-Fixed-drawing-the-rotate-overlay-during-in-place-sub.patch ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ leocad.spec ++++++ --- /var/tmp/diff_new_pack.u2aDOF/_old 2021-04-29 22:52:45.806064664 +0200 +++ /var/tmp/diff_new_pack.u2aDOF/_new 2021-04-29 22:52:45.806064664 +0200 @@ -23,6 +23,10 @@ License: GPL-2.0-only URL: http://leocad.org Source0: https://github.com/leozide/leocad/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz +Patch0: 0001-Don-t-enable-relative-transforms-by-default.patch +Patch1: 0002-Disabled-relative-movement-when-moving-pieces-withou.patch +Patch2: 0003-Fixed-moving-pieces-while-editing-submodels-in-place.patch +Patch3: 0004-Fixed-drawing-the-rotate-overlay-during-in-place-sub.patch BuildRequires: fdupes BuildRequires: gcc-c++ BuildRequires: hicolor-icon-theme @@ -42,6 +46,10 @@ %prep %setup -q +%patch0 -p1 +%patch1 -p1 +%patch2 -p1 +%patch3 -p1 %build %qmake5 ++++++ 0001-Don-t-enable-relative-transforms-by-default.patch ++++++ >From cd588f64aa832dd1e6af5f4a9e4982930977ec12 Mon Sep 17 00:00:00 2001 From: Leonardo Zide <leoz...@gmail.com> Date: Sat, 24 Apr 2021 10:03:33 -0700 Subject: [PATCH 1/4] Don't enable relative transforms by default. --- common/lc_mainwindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/lc_mainwindow.cpp b/common/lc_mainwindow.cpp index d34e1272..198260ed 100644 --- a/common/lc_mainwindow.cpp +++ b/common/lc_mainwindow.cpp @@ -62,7 +62,7 @@ lcMainWindow::lcMainWindow() mMoveXYSnapIndex = 4; mMoveZSnapIndex = 3; mAngleSnapIndex = 5; - mRelativeTransform = true; + mRelativeTransform = false; mLocalTransform = false; mCurrentPieceInfo = nullptr; mSelectionMode = lcSelectionMode::Single; -- 2.31.1 ++++++ 0002-Disabled-relative-movement-when-moving-pieces-withou.patch ++++++ >From 249fa262f7957e7ff849e78af35c5131af447fa6 Mon Sep 17 00:00:00 2001 From: Leonardo Zide <leoz...@gmail.com> Date: Sat, 24 Apr 2021 10:15:13 -0700 Subject: [PATCH 2/4] Disabled relative movement when moving pieces without using the arrows. --- common/lc_mainwindow.cpp | 2 +- common/lc_model.cpp | 8 ++++---- common/lc_model.h | 8 ++++---- common/lc_view.cpp | 8 ++++---- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/common/lc_mainwindow.cpp b/common/lc_mainwindow.cpp index 198260ed..d34e1272 100644 --- a/common/lc_mainwindow.cpp +++ b/common/lc_mainwindow.cpp @@ -62,7 +62,7 @@ lcMainWindow::lcMainWindow() mMoveXYSnapIndex = 4; mMoveZSnapIndex = 3; mAngleSnapIndex = 5; - mRelativeTransform = false; + mRelativeTransform = true; mLocalTransform = false; mCurrentPieceInfo = nullptr; mSelectionMode = lcSelectionMode::Single; diff --git a/common/lc_model.cpp b/common/lc_model.cpp index f5277b12..ec80ec0f 100644 --- a/common/lc_model.cpp +++ b/common/lc_model.cpp @@ -2596,12 +2596,12 @@ bool lcModel::RemoveSelectedObjects() return RemovedPiece || RemovedCamera || RemovedLight; } -void lcModel::MoveSelectedObjects(const lcVector3& PieceDistance, const lcVector3& ObjectDistance, bool Relative, bool AlternateButtonDrag, bool Update, bool Checkpoint) +void lcModel::MoveSelectedObjects(const lcVector3& PieceDistance, const lcVector3& ObjectDistance, bool AllowRelative, bool AlternateButtonDrag, bool Update, bool Checkpoint) { bool Moved = false; lcMatrix33 RelativeRotation; - if (Relative) + if (AllowRelative) RelativeRotation = GetRelativeRotation(); else RelativeRotation = lcMatrix33Identity(); @@ -4071,12 +4071,12 @@ void lcModel::UpdateCameraTool(const lcVector3& Position) UpdateAllViews(); } -void lcModel::UpdateMoveTool(const lcVector3& Distance, bool AlternateButtonDrag) +void lcModel::UpdateMoveTool(const lcVector3& Distance, bool AllowRelative, bool AlternateButtonDrag) { lcVector3 PieceDistance = SnapPosition(Distance) - SnapPosition(mMouseToolDistance); lcVector3 ObjectDistance = Distance - mMouseToolDistance; - MoveSelectedObjects(PieceDistance, ObjectDistance, true, AlternateButtonDrag, true, false); + MoveSelectedObjects(PieceDistance, ObjectDistance, AllowRelative, AlternateButtonDrag, true, false); mMouseToolDistance = Distance; gMainWindow->UpdateSelectedObjects(false); diff --git a/common/lc_model.h b/common/lc_model.h index d1f4ef81..fad3fddd 100644 --- a/common/lc_model.h +++ b/common/lc_model.h @@ -304,7 +304,7 @@ public: void UpdateSpotLightTool(const lcVector3& Position); void BeginCameraTool(const lcVector3& Position, const lcVector3& Target); void UpdateCameraTool(const lcVector3& Position); - void UpdateMoveTool(const lcVector3& Distance, bool AlternateButtonDrag); + void UpdateMoveTool(const lcVector3& Distance, bool AllowRelative, bool AlternateButtonDrag); void UpdateRotateTool(const lcVector3& Angles, bool AlternateButtonDrag); void UpdateScaleTool(const float Scale); void EraserToolClicked(lcObject* Object); @@ -320,12 +320,12 @@ public: void ZoomExtents(lcCamera* Camera, float Aspect); void Zoom(lcCamera* Camera, float Amount); - void MoveSelectedObjects(const lcVector3& Distance, bool Relative, bool AlternateButtonDrag, bool Update, bool Checkpoint) + void MoveSelectedObjects(const lcVector3& Distance, bool AllowRelative, bool AlternateButtonDrag, bool Update, bool Checkpoint) { - MoveSelectedObjects(Distance, Distance, Relative, AlternateButtonDrag, Update, Checkpoint); + MoveSelectedObjects(Distance, Distance, AllowRelative, AlternateButtonDrag, Update, Checkpoint); } - void MoveSelectedObjects(const lcVector3& PieceDistance, const lcVector3& ObjectDistance, bool Relative, bool AlternateButtonDrag, bool Update, bool Checkpoint); + void MoveSelectedObjects(const lcVector3& PieceDistance, const lcVector3& ObjectDistance, bool AllowRelative, bool AlternateButtonDrag, bool Update, bool Checkpoint); void RotateSelectedPieces(const lcVector3& Angles, bool Relative, bool RotatePivotPoint, bool Update, bool Checkpoint); void ScaleSelectedPieces(const float Scale, bool Update, bool Checkpoint); void TransformSelectedObjects(lcTransformType TransformType, const lcVector3& Transform); diff --git a/common/lc_view.cpp b/common/lc_view.cpp index a1dba97b..92a9d408 100644 --- a/common/lc_view.cpp +++ b/common/lc_view.cpp @@ -3585,7 +3585,7 @@ void lcView::OnMouseMove() lcVector3 Distance = Intersection - MoveStart; Distance = lcMul(Distance, lcMatrix33AffineInverse(RelativeRotation)); - ActiveModel->UpdateMoveTool(Distance, mTrackButton != lcTrackButton::Left); + ActiveModel->UpdateMoveTool(Distance, true, mTrackButton != lcTrackButton::Left); } else if (mTrackTool == lcTrackTool::MoveXY || mTrackTool == lcTrackTool::MoveXZ || mTrackTool == lcTrackTool::MoveYZ) { @@ -3610,7 +3610,7 @@ void lcView::OnMouseMove() { lcVector3 Distance = Intersection - MoveStart; Distance = lcMul(Distance, lcMatrix33AffineInverse(RelativeRotation)); - ActiveModel->UpdateMoveTool(Distance, mTrackButton != lcTrackButton::Left); + ActiveModel->UpdateMoveTool(Distance, true, mTrackButton != lcTrackButton::Left); } } } @@ -3618,7 +3618,7 @@ void lcView::OnMouseMove() { lcMatrix44 NewPosition = GetPieceInsertPosition(true, mMouseDownPiece); lcVector3 Distance = NewPosition.GetTranslation() - mMouseDownPosition; - ActiveModel->UpdateMoveTool(Distance, mTrackButton != lcTrackButton::Left); + ActiveModel->UpdateMoveTool(Distance, false, mTrackButton != lcTrackButton::Left); } else if (mTrackTool == lcTrackTool::ScalePlus || mTrackTool == lcTrackTool::ScaleMinus) { @@ -3671,7 +3671,7 @@ void lcView::OnMouseMove() if (lcLineSegmentPlaneIntersection(&MoveStart, MouseDownStart, MouseDownEnd, Plane)) { lcVector3 Distance = Intersection - MoveStart; - ActiveModel->UpdateMoveTool(Distance, mTrackButton != lcTrackButton::Left); + ActiveModel->UpdateMoveTool(Distance, true, mTrackButton != lcTrackButton::Left); } } } -- 2.31.1 ++++++ 0003-Fixed-moving-pieces-while-editing-submodels-in-place.patch ++++++ >From 371c248f103a06ac169cf4e0b77ad1ef76f58f35 Mon Sep 17 00:00:00 2001 From: Leonardo Zide <leoz...@gmail.com> Date: Sun, 25 Apr 2021 11:36:35 -0700 Subject: [PATCH 3/4] Fixed moving pieces while editing submodels in place. --- common/lc_view.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/common/lc_view.cpp b/common/lc_view.cpp index 92a9d408..8a6abb13 100644 --- a/common/lc_view.cpp +++ b/common/lc_view.cpp @@ -3561,9 +3561,16 @@ void lcView::OnMouseMove() const lcVector3& MouseDownStart = Points[2]; const lcVector3& MouseDownEnd = Points[3]; - lcVector3 Center; + lcVector3 OverlayCenter; lcMatrix33 RelativeRotation; - ActiveModel->GetMoveRotateTransform(Center, RelativeRotation); + ActiveModel->GetMoveRotateTransform(OverlayCenter, RelativeRotation); + + lcMatrix44 WorldMatrix = lcMatrix44(RelativeRotation, OverlayCenter); + + if (ActiveModel != mModel) + WorldMatrix = lcMul(WorldMatrix, mActiveSubmodelTransform); + + const lcVector3 Center = WorldMatrix.GetTranslation(); if (mTrackTool == lcTrackTool::MoveX || mTrackTool == lcTrackTool::MoveY || mTrackTool == lcTrackTool::MoveZ) { @@ -3575,7 +3582,7 @@ void lcView::OnMouseMove() else Direction = lcVector3(0.0f, 0.0f, 1.0f); - Direction = lcMul(Direction, RelativeRotation); + Direction = lcMul30(Direction, WorldMatrix); lcVector3 Intersection; lcClosestPointsBetweenLines(Center, Center + Direction, CurrentStart, CurrentEnd, &Intersection, nullptr); @@ -3584,7 +3591,7 @@ void lcView::OnMouseMove() lcClosestPointsBetweenLines(Center, Center + Direction, MouseDownStart, MouseDownEnd, &MoveStart, nullptr); lcVector3 Distance = Intersection - MoveStart; - Distance = lcMul(Distance, lcMatrix33AffineInverse(RelativeRotation)); + Distance = lcMul(Distance, lcMatrix33AffineInverse(lcMatrix33(WorldMatrix))); ActiveModel->UpdateMoveTool(Distance, true, mTrackButton != lcTrackButton::Left); } else if (mTrackTool == lcTrackTool::MoveXY || mTrackTool == lcTrackTool::MoveXZ || mTrackTool == lcTrackTool::MoveYZ) -- 2.31.1 ++++++ 0004-Fixed-drawing-the-rotate-overlay-during-in-place-sub.patch ++++++ >From ccd9904c4cd7f305b168490750d94016a936a104 Mon Sep 17 00:00:00 2001 From: Leonardo Zide <leoz...@gmail.com> Date: Sun, 25 Apr 2021 12:02:57 -0700 Subject: [PATCH 4/4] Fixed drawing the rotate overlay during in place submodel edits. --- common/lc_view.cpp | 38 +++++++++++++++++++++++--------------- 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/common/lc_view.cpp b/common/lc_view.cpp index 8a6abb13..133939f9 100644 --- a/common/lc_view.cpp +++ b/common/lc_view.cpp @@ -1489,6 +1489,11 @@ void lcView::DrawRotateOverlay() lcVector3 MouseToolDistance = ActiveModel->SnapRotation(ActiveModel->GetMouseToolDistance()); bool HasAngle = false; + lcMatrix44 WorldMatrix = lcMatrix44(RelativeRotation, OverlayCenter); + + if (ActiveModel != mModel) + WorldMatrix = lcMul(WorldMatrix, mActiveSubmodelTransform); + // Draw a disc showing the rotation amount. if (MouseToolDistance.LengthSquared() != 0.0f && (mTrackButton != lcTrackButton::None)) { @@ -1532,10 +1537,9 @@ void lcView::DrawRotateOverlay() if (fabsf(Angle) >= fabsf(Step)) { - lcMatrix44 WorldMatrix = lcMatrix44(RelativeRotation, OverlayCenter); - WorldMatrix = lcMul(lcMatrix44FromAxisAngle(lcVector3(Rotation[1], Rotation[2], Rotation[3]), Rotation[0] * LC_DTOR), WorldMatrix); + lcMatrix44 RotatedWorldMatrix = lcMul(lcMatrix44FromAxisAngle(lcVector3(Rotation[1], Rotation[2], Rotation[3]), Rotation[0] * LC_DTOR), WorldMatrix); - mContext->SetWorldMatrix(WorldMatrix); + mContext->SetWorldMatrix(RotatedWorldMatrix); glEnable(GL_BLEND); @@ -1587,7 +1591,7 @@ void lcView::DrawRotateOverlay() if (gMainWindow->GetTool() == lcTool::Rotate && !HasAngle && mTrackButton == lcTrackButton::None) { lcMatrix44 Mat = lcMatrix44AffineInverse(mCamera->mWorldView); - Mat.SetTranslation(OverlayCenter); + Mat.SetTranslation(WorldMatrix.GetTranslation()); lcVector3 Verts[32]; @@ -1615,9 +1619,9 @@ void lcView::DrawRotateOverlay() ViewDir.Normalize(); // Transform ViewDir to local space. - ViewDir = lcMul(ViewDir, lcMatrix33AffineInverse(RelativeRotation)); + ViewDir = lcMul(ViewDir, lcMatrix33AffineInverse(lcMatrix33(WorldMatrix))); - mContext->SetWorldMatrix(lcMatrix44(RelativeRotation, OverlayCenter)); + mContext->SetWorldMatrix(WorldMatrix); // Draw each axis circle. for (int i = 0; i < 3; i++) @@ -1712,9 +1716,8 @@ void lcView::DrawRotateOverlay() break; }; - lcMatrix44 WorldMatrix = lcMatrix44(RelativeRotation, OverlayCenter); - WorldMatrix = lcMul(lcMatrix44FromAxisAngle(lcVector3(Rotation[1], Rotation[2], Rotation[3]), Rotation[0] * LC_DTOR), WorldMatrix); - mContext->SetWorldMatrix(WorldMatrix); + lcMatrix44 RotatedWorldMatrix = lcMul(lcMatrix44FromAxisAngle(lcVector3(Rotation[1], Rotation[2], Rotation[3]), Rotation[0] * LC_DTOR), WorldMatrix); + mContext->SetWorldMatrix(RotatedWorldMatrix); mContext->SetColor(0.8f, 0.8f, 0.0f, 1.0f); @@ -1742,7 +1745,7 @@ void lcView::DrawRotateOverlay() } // Draw text. - lcVector3 ScreenPos = ProjectPoint(OverlayCenter); + lcVector3 ScreenPos = ProjectPoint(WorldMatrix.GetTranslation()); mContext->SetMaterial(lcMaterialType::UnlitTextureModulate); mContext->SetWorldMatrix(lcMatrix44Identity()); @@ -2165,11 +2168,16 @@ float lcView::GetOverlayScale() const lcModel* ActiveModel = GetActiveModel(); ActiveModel->GetMoveRotateTransform(OverlayCenter, RelativeRotation); - lcVector3 ScreenPos = ProjectPoint(OverlayCenter); + lcMatrix44 WorldMatrix = lcMatrix44(RelativeRotation, OverlayCenter); + + if (ActiveModel != mModel) + WorldMatrix = lcMul(WorldMatrix, mActiveSubmodelTransform); + + lcVector3 ScreenPos = ProjectPoint(WorldMatrix.GetTranslation()); ScreenPos[0] += 10.0f; lcVector3 Point = UnprojectPoint(ScreenPos); - lcVector3 Dist(Point - OverlayCenter); + lcVector3 Dist(Point - WorldMatrix.GetTranslation()); return Dist.Length() * 5.0f; } @@ -3605,7 +3613,7 @@ void lcView::OnMouseMove() else PlaneNormal = lcVector3(1.0f, 0.0f, 0.0f); - PlaneNormal = lcMul(PlaneNormal, RelativeRotation); + PlaneNormal = lcMul30(PlaneNormal, WorldMatrix); lcVector4 Plane(PlaneNormal, -lcDot(PlaneNormal, Center)); lcVector3 Intersection; @@ -3616,7 +3624,7 @@ void lcView::OnMouseMove() if (lcLineSegmentPlaneIntersection(&MoveStart, MouseDownStart, MouseDownEnd, Plane)) { lcVector3 Distance = Intersection - MoveStart; - Distance = lcMul(Distance, lcMatrix33AffineInverse(RelativeRotation)); + Distance = lcMul(Distance, lcMatrix33AffineInverse(lcMatrix33(WorldMatrix))); ActiveModel->UpdateMoveTool(Distance, true, mTrackButton != lcTrackButton::Left); } } @@ -3635,7 +3643,7 @@ void lcView::OnMouseMove() else Direction = lcVector3(-1.0f, 0.0f, 0.0f); - Direction = lcMul(Direction, RelativeRotation); + Direction = lcMul30(Direction, WorldMatrix); lcVector3 Intersection; lcClosestPointsBetweenLines(Center, Center + Direction, CurrentStart, CurrentEnd, &Intersection, nullptr); -- 2.31.1