Great to hear! Looking at the same code in our 4.16, I haven’t been able to successfully apply the same fix/
4.16 has:
FSourceParam::FSourceParam(float InNumInterpFrames)
: StartValue(0.0f)
, EndValue(0.0f)
, CurrentValue(0.0f)
, NumInterpFrames(InNumInterpFrames)
, NumInterpFramesInverse(0.0f)
, Frame(0.0f)
, bIsInit(true)
, bIsDone(false)
{
NumInterpFramesInverse = (NumInterpFrames == 0.0f ? 0.0f : (1.0f / NumInterpFrames));
}
void FSourceParam::Reset()
{
bIsInit = true;
}
void FSourceParam::SetValue(float InValue)
{
if (bIsInit || NumInterpFrames == 0.0f)
{
bIsInit = false;
CurrentValue = InValue;
StartValue = InValue;
EndValue = InValue;
Frame = NumInterpFrames;
bIsDone = true;
}
else
{
StartValue = CurrentValue;
EndValue = InValue;
Frame = 0.0f;
bIsDone = false;
}
}
float FSourceParam::Update()
{
if (!bIsDone)
{
float Alpha = Frame * NumInterpFramesInverse;
if (Alpha >= 1.0f)
{
bIsDone = true;
CurrentValue = EndValue;
}
else
{
CurrentValue = FMath::Lerp(StartValue, EndValue, Alpha);
}
Frame += 1.0f;
}
return CurrentValue;
}
float FSourceParam::GetValue() const
{
return CurrentValue;
}
The original 4.16 code seems more closer to what you changed it to, as it sets bIsDone to true if it is an init and thus doesn’t do the lerp. I did try and match it more to 4.17 but it didnt seem to fix the issue at all. I imagine it might be that something else in 4.17 helps fix this issue. I need look at getting 4.17 merged, but that is a few day process for us and as we launching next monday on early access, I wont have time to do that just yet. I will let you know how I go there.