Overwriting an anim sequence may scale the play rate of the anim instead of modifying underlying frame rate

The frame rate for an anim sequence is not being changed as expected when its being overwritten / re-imported. We have a fix for this by just adding a reimport scope below.

UAnimSequence* FAnimationRecorder::StopRecord(bool bShowMessage)
{
	double StartTime, ElapsedTime = 0;
 
	if (IsValid(AnimationObject) && !AnimationObject->HasAnyFlags(RF_BeginDestroyed | RF_FinishDestroyed))
	{
		IAnimationDataController& Controller = AnimationObject->GetController();
		int32 NumKeys = LastFrame.Value + 1;
 
		//Set Interpolation type (Step or Linear), doesn't look like there is a controller for this.
		AnimationObject->Interpolation = Interpolation;
 
		// BUG FIX START
		IAnimationDataModel::FReimportScope ReimportScope(AnimationObject->GetDataModel());
		// BUG FIX END
...

[Attachment Removed]

Steps to Reproduce

  1. Bake an anim sequence from a level sequence that targets 24 fps
  2. Create a montage from that anim sequence - now the montage will be set to 24 fps
  3. Bake another anim sequence from the same level seqeuence, but overwrite the aforementioned one with it. That anim should target 30 fps.
  4. Notice how the fps doesn’t change on that exported anim, but instead the play rate is scaled - this is the bug!
    [Attachment Removed]

Thanks,

I’ve logged an issue that you can follow here, https://issues.unrealengine.com/issue/UE-387695

But yeah, that looks like a good change that you should keep in your engine.

Dustin

[Attachment Removed]