How can I create a LevelSequence from a custom c++ animation

Hey, I created a custom animation in C++ basically loading some data from a JSON file at runtime,
spawning actors and changing their material and transform etc.

How can I render this animation out using a LevelSequence, I tried using the Take Recorder, and it somewhat works, but it misses the camera movement and the properties for the material changes dont seem to be recorded either.

Has anyone done something similar or can guide me in the right direction?

To render a custom animation created in C++ using a LevelSequence, you can follow these steps:

  1. Create a new LevelSequence in your Unreal Engine project.
  2. Add your custom animation to the LevelSequence by dragging it into the Sequence Editor.
  3. In the Sequence Editor, you can add camera movement by adding a new Camera Track node and setting the camera’s position, rotation, and other properties.
  4. To record the material changes made in your custom animation, you can use the Take Recorder. To do this, right-click in the Sequence Editor and select “Take Recorder” from the context menu. This will create a new Take node that you can use to record the material changes.
  5. Once you have added all the necessary nodes to your LevelSequence, you can export it by right-clicking in the Sequence Editor and selecting “Export Sequence” from the context menu. This will open a dialog box where you can specify the output file format and other settings.
  6. After exporting the LevelSequence, you can import it into another Unreal Engine project or use it in other software that supports the LevelSequence format.

Hope it works.

1 Like

Had a rough time figuring this one out, for anyone ever running into a similar problem, heres how I solved it.

record only your camera actor in the take recorder if the camera is part of the custom animation, either using the UI or programmatically using

ISequenceRecorder& SequenceRecorder = FModuleManager::LoadModuleChecked<ISequenceRecorder>("SequenceRecorder");

//check out this class for recording settings 
USequenceRecorderSettings* Settings = GetMutableDefault<USequenceRecorderSettings>();

//adjust recording settings

Settings->SaveConfig();

//to start recording after adding the actors you want to record
SequenceRecorder.StartRecording();

//later 
SequenceRecorder.StopRecording();

then add a custom float animationAlpha; UPROPERTY with the “Interp” flag to expose it to Sequencer,
and use it to control the animation progress instead of a timer etc. then load the sequence in the level with your custom animation and add a binding to the actor controlling the custom animation, and keyframe the animationAlpha property from 0 to the time you want the animation to end, dont forget to set the keyframes to linear or it wont work properly.

now you just have to make sure that the animation auto plays when starting the level, and you can render your custom animation with the Movie Render Pipeline…