Gui: Refactor navigation animations

- Animations are played through an Animator
- Standard animations have a fixed duration and inherit from QVariantAnimation
- The animation duration can be changed in the preferences
- Fix animations when using the two arrows above the NaviCube
- Start an animation or start and wait for an animation
- Replaces standard camera animations (e.g. by selecting standard views or NaviCube) with FixedTimeAnimation
- Replace View3DInventorViewer's CameraAnimation with FixedTimeAnimation
- Replace OpenInventor navigation style infinite spin animation with SpinningAnimation
- Stops an active animation when a new animation is started
- Stops an active animation when the user starts dragging, panning or zooming
- Refactor reorientCamera so it can be used in animations
- Enable animations by default
This commit is contained in:
Rexbas
2023-04-30 19:26:27 +02:00
committed by wwmayer
parent 4d17f4831a
commit 37e600e766
15 changed files with 685 additions and 352 deletions

View File

@@ -91,7 +91,7 @@ void DemoMode::reset()
view->getViewer()->stopAnimating();
ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath
("User parameter:BaseApp/Preferences/View");
hGrp->Notify("UseAutoRotation");
hGrp->Notify("UseNavigationAnimations");
}
void DemoMode::accept()
@@ -150,7 +150,7 @@ Gui::View3DInventor* DemoMode::activeView() const
float DemoMode::getSpeed(int v) const
{
float speed = (static_cast<float>(v)) / 50.0f; // let 2.0 be the maximum speed
float speed = (static_cast<float>(v)) / 10.0f; // let 10.0 be the maximum speed
return speed;
}
@@ -273,8 +273,9 @@ void DemoMode::startAnimation(Gui::View3DInventor* view)
{
if (!view->getViewer()->isAnimationEnabled())
view->getViewer()->setAnimationEnabled(true);
view->getViewer()->startAnimating(getDirection(view),
getSpeed(ui->speedSlider->value()));
view->getViewer()->startSpinningAnimation(getDirection(view),
getSpeed(ui->speedSlider->value()));
}
void DemoMode::onTimerCheckToggled(bool on)