Description

We now have the following error that is generated in FFbxImporter::ValidateAnimStack

	if (!FMath::IsNearlyZero(SubFrame, KINDA_SMALL_NUMBER) && !FMath::IsNearlyEqual(SubFrame, 1.0f, KINDA_SMALL_NUMBER))
	{
		AddTokenizedErrorMessage(FTokenizedMessage::Create(EMessageSeverity::Error, FText::Format(LOCTEXT("Error_InvalidImportLength", "Animation length {0} is not compatible with import frame-rate {1} (sub frame {2}), animation has to be frame-border aligned."), FText::AsNumber(SequenceLengthInSeconds), TargetFrameRate.ToPrettyText(), FText::AsNumber(SubFrame))), FFbxErrors::Animation_InvalidData);
		return false;
	}

However, we always hit this error for animations that were generated with fractional framerates (like 29.97/NTSC). This is because the FBX import code assumes that framerates can be stored as an int rather than float/double (FFbxImporter::ImportAnimations):

		else
		{
			// For FBX data, "Frame Rate" is just the speed at which the animation is played back.  It can change
			// arbitrarily, and the underlying data can stay the same.  What we really want here is the Sampling Rate,
			// ie: the number of animation keys per second.  These are the individual animation curve keys
			// on the FBX nodes of the skeleton.  So we loop through the nodes of the skeleton and find the maximum number 
			// of keys that any node has, then divide this by the total length (in seconds) of the animation to find the 
			// sampling rate of this set of data 

			// we want the maximum resample rate, so that we don't lose any precision of fast anims,
			// and don't mind creating lerped frames for slow anims
			int32 BestResampleRate = GetMaxSampleRate(SortedLinks);

			if (BestResampleRate > 0)
			{
				ResampleRate = BestResampleRate;
			}
		}
Steps to Reproduce
  1. Attempt to import the attached FBX file (29.97fps)
  2. In the import options, make sure 'Use Default Sample Rate' is unticked and 'Custom Sample Rate' is 0 to ensure we use the FBX sample rate
  3. Import the file
    1. You should get an error about the frames not being accurate

Have Comments or More Details?

There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-161914 in the post.

44
Login to Vote

Unresolved
ComponentUE - Anim - Runtime
Affects Versions5.0.3
Target Fix5.2
CreatedAug 24, 2022
UpdatedNov 18, 2022