Skip to content

Commit

Permalink
fix animation issue
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
donovaly authored and wwmayer committed Mar 29, 2021
1 parent e58ee29 commit 23747f9
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/Gui/NaviCube.cpp
Expand Up @@ -945,9 +945,7 @@ void NaviCubeImplementation::handleResize() {
m_PrevWidth = view[0];
m_PrevHeight = view[1];
m_View3DInventorViewer->getSoRenderManager()->scheduleRedraw();

}

}

void NaviCubeImplementation::drawNaviCube(bool pickMode) {
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit 23747f9

Please sign in to comment.