diff --git a/src/Gui/NavigationStyle.cpp b/src/Gui/NavigationStyle.cpp index cc317ffa1d..5b4243bbf5 100644 --- a/src/Gui/NavigationStyle.cpp +++ b/src/Gui/NavigationStyle.cpp @@ -1067,9 +1067,19 @@ SbBool NavigationStyle::isAnimating() const return this->currentmode == NavigationStyle::SPINNING; } -NavigationAnimator* NavigationStyle::getAnimator() const +void NavigationStyle::startAnimating(const std::shared_ptr& animation, bool wait) const { - return this->animator; + if (wait) { + animator->startAndWait(animation); + } + else { + animator->start(animation); + } +} + +void NavigationStyle::stopAnimating() const +{ + animator->stop(); } void NavigationStyle::setSensitivity(float val) diff --git a/src/Gui/NavigationStyle.h b/src/Gui/NavigationStyle.h index 74546372f4..c499776456 100644 --- a/src/Gui/NavigationStyle.h +++ b/src/Gui/NavigationStyle.h @@ -38,7 +38,7 @@ #include #include #include - +#include // forward declarations class SoEvent; @@ -54,6 +54,7 @@ namespace Gui { class View3DInventorViewer; class NavigationAnimator; class AbstractMouseSelection; +class NavigationAnimation; /** * @author Werner Mayer @@ -124,7 +125,8 @@ public: SbBool isAnimationEnabled() const; SbBool isAnimating() const; - NavigationAnimator* getAnimator() const; + void startAnimating(const std::shared_ptr& animation, bool wait = false) const; + void stopAnimating() const; void setSensitivity(float); float getSensitivity() const; diff --git a/src/Gui/View3DInventorViewer.cpp b/src/Gui/View3DInventorViewer.cpp index bd82320c8c..eb3cde7394 100644 --- a/src/Gui/View3DInventorViewer.cpp +++ b/src/Gui/View3DInventorViewer.cpp @@ -3110,12 +3110,7 @@ void View3DInventorViewer::startAnimation(const SbRotation& orientation, auto animation = std::make_shared( navigation, orientation, rotationCenter, translation, duration); - if (wait) { - navigation->getAnimator()->startAndWait(animation); - } - else { - navigation->getAnimator()->start(animation); - } + navigation->startAnimating(animation, wait); } /** @@ -3127,12 +3122,12 @@ void View3DInventorViewer::startAnimation(const SbRotation& orientation, void View3DInventorViewer::startSpinningAnimation(const SbVec3f& axis, float velocity) { auto animation = std::make_shared(navigation, axis, velocity); - navigation->getAnimator()->start(animation); + navigation->startAnimating(animation); } void View3DInventorViewer::stopAnimating() { - navigation->getAnimator()->stop(); + navigation->stopAnimating(); } void View3DInventorViewer::setPopupMenuEnabled(const SbBool on)