From 23747f9d11f61f466eadcd0b7845ce62dd17b9a3 Mon Sep 17 00:00:00 2001 From: donovaly Date: Sat, 27 Mar 2021 23:20:59 +0100 Subject: [PATCH] fix animation issue SO's auto rotation has its own rotation logic that ends at fixed positions. This collides with the "to nearest" option whose aim is to rotate to the next sensible state taking into account from what position the rotation was started. Thus the solution is to disable SO's auto rotation while the cube is rotated. --- src/Gui/NaviCube.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/Gui/NaviCube.cpp b/src/Gui/NaviCube.cpp index 46aef1748bbb..5ce991e9c024 100644 --- a/src/Gui/NaviCube.cpp +++ b/src/Gui/NaviCube.cpp @@ -945,9 +945,7 @@ void NaviCubeImplementation::handleResize() { m_PrevWidth = view[0]; m_PrevHeight = view[1]; m_View3DInventorViewer->getSoRenderManager()->scheduleRedraw(); - } - } void NaviCubeImplementation::drawNaviCube(bool pickMode) { @@ -1294,6 +1292,12 @@ bool NaviCubeImplementation::mouseReleased(short x, short y) { ParameterGrp::handle hGrpNavi = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/NaviCube"); bool toNearest = hGrpNavi->GetBool("NaviRotateToNearest", true); + // 3D animation (UseAutoRotatio) collides with the rotation to the nearest state + // thus when enabled, disable them temprarily for the cube rotation + bool UseAutoRotation = hGrp->GetBool("UseAutoRotation", false); + if (UseAutoRotation && toNearest) + m_View3DInventorViewer->setAnimationEnabled(false); + switch (pick) { default: return false; @@ -1624,6 +1628,10 @@ bool NaviCubeImplementation::mouseReleased(short x, short y) { handleMenu(); break; } + + // re-anable UseAutoRotation after the cube rotation was done + if (UseAutoRotation && toNearest) + m_View3DInventorViewer->setAnimationEnabled(true); } return true; }