I don’t know if this is a bug or if I’m doing something wrong.
When you load a cubic keyframe with tangent to the sequencer, the tangent is not applied immediately, and the track is properly evaluated from the time when the curve editor is opened and the track is rendered to the UI.
The code below is part of the code I wrote based on the code inside the engine that imports the FBX Animation, and importing animation in this way causes problems.
bool FVmdImporter::ImportVmdCameraTransform(
const TArray<FVmdObject::FCameraKeyFrame>& CameraKeyFrames,
const FGuid ObjectBinding,
const UMovieSceneSequence* InSequence,
const UMmdUserImportVmdSettings* ImportVmdSettings
)
{
UMovieScene* MovieScene = InSequence->GetMovieScene();
UMovieScene3DTransformTrack* TransformTrack = MovieScene->FindTrack<UMovieScene3DTransformTrack>(ObjectBinding);
if (!TransformTrack)
{
MovieScene->Modify();
TransformTrack = MovieScene->AddTrack<UMovieScene3DTransformTrack>(ObjectBinding);
}
TransformTrack->Modify();
bool bSectionAdded = false;
UMovieScene3DTransformSection* TransformSection = Cast<UMovieScene3DTransformSection>(TransformTrack->FindOrAddSection(0, bSectionAdded));
if (!TransformSection)
{
return false;
}
TransformSection->Modify();
if (bSectionAdded)
{
TransformSection->SetRange(TRange<FFrameNumber>::All());
}
FMovieSceneDoubleChannel* LocationXChannel = TransformSection->GetChannelProxy().GetChannel<FMovieSceneDoubleChannel>(0);
const FFrameRate FrameRate = TransformSection->GetTypedOuter<UMovieScene>()->GetTickResolution();
TMovieSceneChannelData<FMovieSceneDoubleValue> ChannelData = LocationXChannel->GetData();
for (auto Key : Datas)
{
FMovieSceneDoubleValue MovieSceneValue;
{
MovieSceneValue.Value = Key.Value;
MovieSceneValue.InterpMode = Key.InterpMode;
MovieSceneValue.TangentMode = RCTM_Break;
MovieSceneValue.Tangent = Tangent;
}
ChannelData.AddKey(Key.Time, MovieSceneValue);
}
return true;
}
It’s a code that excludes the part that reads and converts external data from my code. I don’t know what’s wrong with this code.
I will attach the original code below.