Sequencer FBX import tangent issue

When importing an fbx animation some curves/tangents are not imported properly. This seems related to the code from Engine/Source/Editor/MovieSceneTools/Private

/MovieSceneToolHelpers.cpp#1267-1290. In the code we can see that the ArriveTangent and LeaveTangent are divided by a time offset. Removing this division fixes the issue. I was wondering if there was a reason for this code and if it would create other issues to remove it.

for (auto SourceIt = Source.GetKeyHandleIterator(); SourceIt; ++SourceIt)
	{
		FRichCurveKey &Key = Source.GetKey(*SourceIt);
		float ArriveTangent = Key.ArriveTangent;
		FKeyHandle PrevKeyHandle = Source.GetPreviousKey(*SourceIt);
		if (Source.IsKeyHandleValid(PrevKeyHandle))
		{
			FRichCurveKey &PrevKey = Source.GetKey(PrevKeyHandle);
			ArriveTangent = ArriveTangent / (Key.Time - PrevKey.Time);

		}
		float LeaveTangent = Key.LeaveTangent;
		FKeyHandle NextKeyHandle = Source.GetNextKey(*SourceIt);
		if (Source.IsKeyHandleValid(NextKeyHandle))
		{
			FRichCurveKey &NextKey = Source.GetKey(NextKeyHandle);
			LeaveTangent = LeaveTangent / (NextKey.Time - Key.Time);
		}

		FFrameNumber KeyTime = (Key.Time * FrameRate).RoundToFrame();
		MovieSceneToolHelpers::SetOrAddKey(ChannelData, KeyTime, Key.Value, ArriveTangent, LeaveTangent,
				Key.InterpMode, Key.TangentMode, FrameRate, Key.TangentWeightMode,
				Key.ArriveTangentWeight, Key.LeaveTangentWeight);
	}

Please note the animated track in the attached example is different from the screenshots below.

Issue (original code)

[Image Removed]

Expected result

[Image Removed]

[Attachment Removed]

Steps to Reproduce

  1. Create a level sequence.
  2. Import the fbx attached in the fbx file. (disable reduce key option)
  3. Notice the current focal length curve issue. Tangents are wrong compared to the FBX data.
    [Attachment Removed]

Yes, looks like the code changed at some point to use FRichCurve and not the FbxAnimCurvein that function and the tangent transform is already happeing in auto ComputeWeightInternal = [](float TimeA, float TimeB, const float TangentSlope, const float TangentWeight)

which is called by UnFbx::FFbxImporter::ImportCurve(const FbxAnimCurve* FbxCurve, FRichCurve& RichCurve, const FbxTimeSpan &AnimTimeSpan, const bool bNegative/*=false*/, const float ValueScale/*=1.f*/, const bool bAutoSetTangents /*= true*/)

. So that change looks good. Let us know if you want to file a PR to fix this, if not we will just fix in Main.

[Attachment Removed]

[mention removed]​ You guys can go ahead and fix it in main.

[Attachment Removed]

[mention removed]​ Did you guys do any work for this?

[Attachment Removed]

Sorry never got the other communication, just submitted with CL 55193127, jire UE-384572

[Attachment Removed]