The last key of Animation sequence cannot be removed?

Just ran into this myself. Appears to be a precision related problem in AnimationData::Trim

If you are able to update engine source, you can change this line in AnimSequenceHelpers.cpp:

	const FFrameNumber EndFrameTrim = FrameRate.AsFrameTime(TrimEnd).RoundToFrame();

To this:

	const FFrameNumber EndFrameTrim = InSequence->GetPlayLength() == TrimEnd ? NumKeys : FrameRate.AsFrameTime(TrimEnd).RoundToFrame();

This should fix the problem. Floating point equality is generally frowned upon, but it happens to work correctly in this case because the source of TrimEnd is exactly the same Sequence->GetPlayLength() call just from further up the call chain.

There might be a more “correct” way to fix this, but this seems to work well enough.

1 Like