Simplify code.

This commit is contained in:
Chandler Cox
2025-12-14 15:00:44 -06:00
parent 2d56411e5f
commit 0e627577fc
2 changed files with 4 additions and 39 deletions

View File

@@ -554,20 +554,7 @@ void AnimatedModel::StopSlotAnimation(const StringView& slotName, Animation* ani
{
for (auto& slot : GraphInstance.Slots)
{
if (slot.Animation == anim && slot.Name == slotName)
{
//slot.Animation = nullptr; // TODO: make an immediate version of this method and set the animation to nullptr.
slot.Reset = true;
break;
}
}
}
void AnimatedModel::StopSlotAnimation(const StringView& slotName)
{
for (auto& slot : GraphInstance.Slots)
{
if (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.
if (slot.Animation != nullptr)
@@ -609,17 +596,7 @@ bool AnimatedModel::IsPlayingSlotAnimation(const StringView& slotName, Animation
{
for (auto& slot : GraphInstance.Slots)
{
if (slot.Animation == anim && slot.Name == slotName && !slot.Pause)
return true;
}
return false;
}
bool AnimatedModel::IsPlayingSlotAnimation(const StringView& slotName)
{
for (auto& slot : GraphInstance.Slots)
{
if (slot.Name == slotName && !slot.Pause)
if ((slot.Animation == anim || anim == nullptr) && slot.Name == slotName && !slot.Pause)
return true;
}
return false;

View File

@@ -413,13 +413,7 @@ public:
/// </summary>
/// <param name="slotName">The name of the slot.</param>
/// <param name="anim">The animation to stop.</param>
API_FUNCTION() void StopSlotAnimation(const StringView& slotName, Animation* anim);
/// <summary>
/// Stops the animation playback on the slot in Anim Graph.
/// </summary>
/// <param name="slotName">The name of the slot.</param>
API_FUNCTION() void StopSlotAnimation(const StringView& slotName);
API_FUNCTION() void StopSlotAnimation(const StringView& slotName, Animation* anim = nullptr);
/// <summary>
/// Pauses all the animations playback on the all slots in Anim Graph.
@@ -443,13 +437,7 @@ public:
/// </summary>
/// <param name="slotName">The name of the slot.</param>
/// <param name="anim">The animation to check.</param>
API_FUNCTION() bool IsPlayingSlotAnimation(const StringView& slotName, Animation* anim);
/// <summary>
/// Checks if the animation playback is active on the slot in Anim Graph (not paused).
/// </summary>
/// <param name="slotName">The name of the slot.</param>
API_FUNCTION() bool IsPlayingSlotAnimation(const StringView& slotName);
API_FUNCTION() bool IsPlayingSlotAnimation(const StringView& slotName, Animation* anim = nullptr);
private:
void ApplyRootMotion(const Transform& rootMotionDelta);