Creating Custom Sequencer Tracks In Unreal Engine

To create custom sequencer tracks in UE5 you need to create a custom UMovieSceneTrack and UMovieSceneSection.

 

To make sure our custom tracks and sections show up in the Sequencer editor where they can be added, we need a custom FMovieSceneTrackEditor class and a custom ISequencerSection class.

The ISequencerSection class is responsible for visualizing our UMovieSceneSection to the user. It controls how our section looks, how it’s drawn, and what’s drawn on it. 

The FMovieSceneTrackEditor class is responsible for the buttons and menus that will manage our UMovieSceneTrack in the editor. For example, add or remove track buttons.

  1. Create A UMovieSceneSection

We start with UMovieSceneSection because sections go inside UMovieSceneTracks. 

We have to override UMovieSceneTrack::CreateNewSection() when we create a UMovieSceneTrack, and that function requires that we create our custom section and return it. 

So, we need to create a child class of UMovieSceneSection before we proceed. You can have whatever variables you like in this class, we will get to that later. Right now our main goal is to have a track show up in the sequencer editor.

				
					UCLASS()
class MYPLUGINAPI UCustomMovieSceneSection : public UMovieSceneSection
{
	GENERATED_BODY()
public:
	
	UPROPERTY(EditAnywhere)
	FString SomeUsefulVariable;
};
				
			
  1. Create A Custom UMovieSceneTrack

Now that we have our custom section that will go inside the track, we can create our UMovieSceneTrack child class.

We need to override the following virtual functions. Most of them will be called by sequencer when editing your Track so they MUST be overridden. With an exception of few.

				
					UCLASS()
class MYPLUGIN_API UCustomSceneTrack : public UMovieSceneTrack
{
	GENERATED_BODY()

public:

	//begin UMovieSceneTrack interface

	virtual FText GetDisplayName() const override;

	virtual FName GetTrackName() const override;

	virtual bool IsEmpty() const override;

    //INTENTIONALLY NOT OVERRIDEN
	//virtual UMovieSceneSection* CreateNewSection() override;

	virtual void AddSection(UMovieSceneSection& Section) override;

	virtual void RemoveSection(UMovieSceneSection& Section) override;

	virtual const TArray<UMovieSceneSection*>& GetAllSections() const override;

	//END UMovieSceneTrack Interface

	UPROPERTY()
	TArray<UMovieSceneSection*>  CustomSceneSections;
	
};
				
			

Notice we intentionally did not override the CreateNewSection() function.

This is because we have found this function is never called automatically anywhere. We could be wrong since it’s a pure virtual function.

We end up having to create a custom CreateNewSection(arg1,arg2) function that takes in more arguments. So you can either override this function or create your own. We are going to manually call it later in our  FMovieSceneTrackEditor child class.

We hope implementing these will be straight forward but if in doubt we cover them in our Plugin Development Course for Unreal Engine. 

They are mostly self-explanatory, for example, the IsEmpty() function will be called whenever the engine wants to check if your custom track is empty or not. You can run custom logic here.

 

The CustomSceneSections UPROPERTY() TArray is made up of UCustomMovieSceneSection we created in step 1.

The reason we use UMovieSceneSection is so that we don’t have to cast back and forth when working the UMovieSceneTrack interface (overridden virtual functions). This is one of the areas where Polymorphism shines.

  1. Create A ISequencerSection

We’ve created our Custom tracks and custom sections where our backend logic goes. Now, we will cover the graphics side of things. What people see in the editor in the Sequencer window when a section is drawn/shown.

The ISequencerSection is responsible for how our custom USceneSection is drawn to the user. We will start with creating a child class and overriding the necessary virtual functions.

To Be Continued….