diff --git a/Engine/Source/Runtime/Engine/Private/Animation/AnimMontage.cpp b/Engine/Source/Runtime/Engine/Private/Animation/AnimMontage.cpp index 85aa68048a06..fb91d607ce99 100644 --- a/Engine/Source/Runtime/Engine/Private/Animation/AnimMontage.cpp +++ b/Engine/Source/Runtime/Engine/Private/Animation/AnimMontage.cpp @@ -877,8 +877,8 @@ void FAnimMontageInstance::Stop(const FAlphaBlend& InBlendOut, bool bInterrupt) bInterrupted = bInterrupt; } - // if desired weight is > 0.f, turn that off - if (Blend.GetDesiredValue() > 0.f) + // if it hasn't stopped, stop now + if (IsStopped() == false) { // do not use default Montage->BlendOut // depending on situation, the BlendOut time can change @@ -1073,7 +1073,7 @@ bool FAnimMontageInstance::SetNextSectionID(int32 const & SectionID, int32 const void FAnimMontageInstance::OnMontagePositionChanged(FName const & ToSectionName) { - if (bPlaying && (Blend.GetDesiredValue() == 0.f)) + if (bPlaying && IsStopped()) { UE_LOG(LogAnimation, Warning, TEXT("Changing section on Montage (%s) to '%s' during blend out. This can cause incorrect visuals!"), *GetNameSafe(Montage), *ToSectionName.ToString()); @@ -1437,8 +1437,8 @@ void FAnimMontageInstance::Advance(float DeltaTime, struct FRootMotionMovementPa } } - // If current section is last one, check to trigger a blend out. - if( NextSectionIndex == INDEX_NONE ) + // If current section is last one, check to trigger a blend out and if it hasn't stopped yet, see if we should stop + if (NextSectionIndex == INDEX_NONE && !IsStopped()) { const float DeltaPosToEnd = bPlayingForward ? (CurrentSectionLength - PosInSection) : PosInSection; const float DeltaTimeToEnd = DeltaPosToEnd / FMath::Abs(CombinedPlayRate); @@ -1504,7 +1504,7 @@ void FAnimMontageInstance::Advance(float DeltaTime, struct FRootMotionMovementPa } // If this Montage has no weight, it should be terminated. - if ((Blend.GetDesiredValue()<= ZERO_ANIMWEIGHT_THRESH) && (Blend.IsComplete())) + if (IsStopped() && (Blend.IsComplete())) { // nothing else to do Terminate();