diff --git a/Source/Engine/Animations/Graph/AnimGroup.Animation.cpp b/Source/Engine/Animations/Graph/AnimGroup.Animation.cpp
index a1f2a4565..1e4444af0 100644
--- a/Source/Engine/Animations/Graph/AnimGroup.Animation.cpp
+++ b/Source/Engine/Animations/Graph/AnimGroup.Animation.cpp
@@ -2441,10 +2441,14 @@ void AnimGraphExecutor::ProcessGroupAnimation(Box* boxBase, Node* nodeBase, Valu
{
if (bucket.LoopsLeft == 0)
{
- // End playing animation
+ // End playing animation and reset bucket params
value = tryGetValue(node->GetBox(1), Value::Null);
bucket.Index = -1;
slot.Animation = nullptr;
+ bucket.TimePosition = 0.0f;
+ bucket.BlendInPosition = 0.0f;
+ bucket.BlendOutPosition = 0.0f;
+ bucket.LoopsDone = 0;
return;
}
diff --git a/Source/Engine/Level/Actors/AnimatedModel.cpp b/Source/Engine/Level/Actors/AnimatedModel.cpp
index ee66c6c77..343710183 100644
--- a/Source/Engine/Level/Actors/AnimatedModel.cpp
+++ b/Source/Engine/Level/Actors/AnimatedModel.cpp
@@ -554,10 +554,11 @@ void AnimatedModel::StopSlotAnimation(const StringView& slotName, Animation* ani
{
for (auto& slot : GraphInstance.Slots)
{
- if (slot.Animation == anim && slot.Name == slotName)
+ if ((slot.Animation == anim || anim == nullptr) && slot.Name == slotName)
{
//slot.Animation = nullptr; // TODO: make an immediate version of this method and set the animation to nullptr.
- slot.Reset = true;
+ if (slot.Animation != nullptr)
+ slot.Reset = true;
break;
}
}
@@ -573,7 +574,7 @@ void AnimatedModel::PauseSlotAnimation(const StringView& slotName, Animation* an
{
for (auto& slot : GraphInstance.Slots)
{
- if (slot.Animation == anim && slot.Name == slotName)
+ if ((slot.Animation == anim || anim == nullptr) && slot.Name == slotName)
{
slot.Pause = true;
break;
@@ -595,7 +596,7 @@ bool AnimatedModel::IsPlayingSlotAnimation(const StringView& slotName, Animation
{
for (auto& slot : GraphInstance.Slots)
{
- if (slot.Animation == anim && slot.Name == slotName && !slot.Pause)
+ if ((slot.Animation == anim || anim == nullptr) && slot.Name == slotName && !slot.Pause)
return true;
}
return false;
diff --git a/Source/Engine/Level/Actors/AnimatedModel.h b/Source/Engine/Level/Actors/AnimatedModel.h
index a011be0d0..a520d6723 100644
--- a/Source/Engine/Level/Actors/AnimatedModel.h
+++ b/Source/Engine/Level/Actors/AnimatedModel.h
@@ -412,8 +412,8 @@ public:
/// Stops the animation playback on the slot in Anim Graph.
///
/// The name of the slot.
- /// The animation to stop.
- API_FUNCTION() void StopSlotAnimation(const StringView& slotName, Animation* anim);
+ /// The animation to check. Null to use slot name only.
+ API_FUNCTION() void StopSlotAnimation(const StringView& slotName, Animation* anim = nullptr);
///
/// Pauses all the animations playback on the all slots in Anim Graph.
@@ -424,8 +424,8 @@ public:
/// Pauses the animation playback on the slot in Anim Graph.
///
/// The name of the slot.
- /// The animation to pause.
- API_FUNCTION() void PauseSlotAnimation(const StringView& slotName, Animation* anim);
+ /// The animation to check. Null to use slot name only.
+ API_FUNCTION() void PauseSlotAnimation(const StringView& slotName, Animation* anim = nullptr);
///
/// Checks if any animation playback is active on any slot in Anim Graph (not paused).
@@ -436,8 +436,8 @@ public:
/// Checks if the animation playback is active on the slot in Anim Graph (not paused).
///
/// The name of the slot.
- /// The animation to check.
- API_FUNCTION() bool IsPlayingSlotAnimation(const StringView& slotName, Animation* anim);
+ /// The animation to check. Null to use slot name only.
+ API_FUNCTION() bool IsPlayingSlotAnimation(const StringView& slotName, Animation* anim = nullptr);
private:
void ApplyRootMotion(const Transform& rootMotionDelta);