From baafec9e9fecba9cb081cf3b51691b7d55930558 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lars=20M=C3=BCller?= <34514239+appgurueu@users.noreply.github.com> Date: Tue, 20 Aug 2024 11:51:52 +0200 Subject: [PATCH] Fix animations not being restartable (#15016) --- src/client/content_cao.cpp | 5 ++--- src/server/unit_sao.cpp | 5 +---- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/src/client/content_cao.cpp b/src/client/content_cao.cpp index 0044cc16e..5c008bca9 100644 --- a/src/client/content_cao.cpp +++ b/src/client/content_cao.cpp @@ -1526,9 +1526,8 @@ void GenericCAO::updateAnimation() if (!m_animated_meshnode) return; - if (m_animated_meshnode->getStartFrame() != m_animation_range.X || - m_animated_meshnode->getEndFrame() != m_animation_range.Y) - m_animated_meshnode->setFrameLoop(m_animation_range.X, m_animation_range.Y); + // Note: This sets the current frame as well, (re)starting the animation. + m_animated_meshnode->setFrameLoop(m_animation_range.X, m_animation_range.Y); if (m_animated_meshnode->getAnimationSpeed() != m_animation_speed) m_animated_meshnode->setAnimationSpeed(m_animation_speed); m_animated_meshnode->setTransitionTime(m_animation_blend); diff --git a/src/server/unit_sao.cpp b/src/server/unit_sao.cpp index 70594589b..f22929437 100644 --- a/src/server/unit_sao.cpp +++ b/src/server/unit_sao.cpp @@ -55,10 +55,7 @@ const ItemGroupList &UnitSAO::getArmorGroups() const void UnitSAO::setAnimation( v2f frame_range, float frame_speed, float frame_blend, bool frame_loop) { - if (std::tie(m_animation_range, m_animation_speed, m_animation_blend, - m_animation_loop) == - std::tie(frame_range, frame_speed, frame_blend, frame_loop)) - return; // no change + // Note: Always resend (even if parameters are unchanged) to restart animations. m_animation_range = frame_range; m_animation_speed = frame_speed; m_animation_blend = frame_blend;