When an animation is currently blending out due to automatic blend out or GameplayLogic, further StopMontage with specific BlendOut will not update the time to blend out of the current blending out Animation Montage.
The code will not allow this, because if you follow the current written code :
In
void FAnimMontageInstance::Stop(const FMontageBlendSettings& InBlendOutSettings, bool bInterrupt)
We have :
if (IsStopped() == false) { // If we are using Inertial Blend, blend time should be 0 to instantly stop the montage. FAlphaBlendArgs BlendOutArgs = InBlendOutSettings.Blend; const bool bShouldInertialize = InBlendOutSettings.BlendMode == EMontageBlendMode::Inertialization; BlendOutArgs.BlendTime = bShouldInertialize ? 0.0f : BlendOutArgs.BlendTime; // do not use default Montage->BlendOut // depending on situation, the BlendOut time can change InitializeBlend(FAlphaBlend(BlendOutArgs)); BlendStartAlpha = Blend.GetAlpha(); Blend.SetDesiredValue(0.f); Blend.Update(0.0f); // Only change the active blend profile if the montage isn't stopped. This is to prevent pops on a sudden blend profile switch ActiveBlendProfile = InBlendOutSettings.BlendProfile; if(Montage) { if (UAnimInstance* Inst = AnimInstance.Get()) { // Let AnimInstance know we are being stopped. Inst->OnMontageInstanceStopped(*this); Inst->QueueMontageBlendingOutEvent(FQueuedMontageBlendingOutEvent(Montage, bInterrupted, OnMontageBlendingOutStarted)); if (bShouldInertialize) { // Send the inertial blend request to the anim instance Inst->RequestMontageInertialization(Montage, InBlendOutSettings.Blend.BlendTime, InBlendOutSettings.BlendProfile); } } } }
The line causing problems is
Inst->OnMontageInstanceStopped(*this);
Which ->
ClearMontageInstanceReferences(StoppedMontageInstance);
And remove ActiveMontage like this
ActiveMontagesMap.Remove(MontageStopped);
BUT, in
void UAnimInstance::Montage_StopInternal(TFunctionRef<FMontageBlendSettings(const FAnimMontageInstance*)> AlphaBlendSelectorFunction, const UAnimMontage* Montage /*= nullptr*/)
When called we only stop montage that is referenced in the ActiveMontage map
FAnimMontageInstance* MontageInstance = GetActiveInstanceForMontage(Montage);
if (MontageInstance)
{
MontageInstance->Stop(AlphaBlendSelectorFunction(MontageInstance));
}
This makes It impossible for Stop to be called multiple times and update the blend time.
If it worked.
Blend time will only update if it lower than previous one.
There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-230954 in the post.
1 |
Component | UE - Anim - Gameplay |
---|---|
Affects Versions | 5.4.3, 5.5, 5.4.4 |
Target Fix | 5.6 |
Created | Nov 19, 2024 |
---|---|
Updated | Dec 11, 2024 |