Sequencer: Mute tracks at runtime from C++

Hi -

Is there a way to mute, i.e. disable the evaluation, of a track at runtime. Specifically, I want to be able to mute a transform track at runtime without explicitly setting the mute flag on the track in the level sequence.

Thanks,

You’ll need to get the object’s tracks, find the transform track, and then find the sections on the track. Once you have the section, you can toggle the active boolean.

Here’s a snippet of what you can do in an editor utility widget blueprint graph (same can be done in python). If you’re looking for code, take a look at FSequencer::ToggleNodeActive.

3 Likes

Hello, this solution is far from perfect because the SetIsActive() call Modify() , a WITH_EDITORONLY function.
You can compile but the function is not called in build.

If anyone else has another solution or idea that would be great!, thank you :slight_smile:

1 Like

Hello, to disable sequencer tracks at runtime I used

  • UMovieSceneTrack::SetEvalDisabled(bool)
  • ULevelSequence::MarkAsChanged()
  • MovieSceneCompiledDataManager::GetPrecompiledData()->Compile(ULevelSequence*)
// You first have to set the unwanted track as disabled via 
void YourDisableTrackFunction(UMovieSceneTrack* MovieSceneTrack, bool Value)
{
	if (MovieSceneTrack)
	{
		MovieSceneTrack->SetEvalDisabled(Value);
	}
}


// Then notify the sequencer that the tracks have been modified using MarkAsChanged and UMovieSceneCompiledDataManager::GetPrecompiledData()->Compile.
void YourMarkAsChangedFunction(ULevelSequence* Sequence)
{
	if (Sequence)
	{
		Sequence->MarkAsChanged();
		if (UMovieSceneCompiledDataManager::GetPrecompiledData())
		{
			UMovieSceneCompiledDataManager::GetPrecompiledData()->Compile(Sequence);
		}
	}
}

Use this if you want to notify multiple modifications at one time during runtime.

There is another option to set the concerned track as volatile which if I understood well, doesn’t need to markaschanged and compile the sequencer when you modify the tracks at runtime.
I didn’t tried it.

// this needs to be done in the editor on the concerned tracks
void YourSetLevelSequenceAsVolatileFunction(ULevelSequence* Sequence)
{
	if (Sequence)
	{
		Sequence->SetSequenceFlags(Sequence->GetFlags() | EMovieSceneSequenceFlags::Volatile);
		Sequence->MarkAsChanged();
		if (UMovieSceneCompiledDataManager::GetPrecompiledData())
		{		UMovieSceneCompiledDataManager::GetPrecompiledData()->Compile(Sequence);
		}
	}
}

Ps: Do not forget to reenable the tracks if you need them later on .

4 Likes

Is there any way to mute tracks for UUMGSequencePlayer in apk?

Originally I thought I was going crazy with it not working, but it turns out the mistake was with using Get Display Name to compare the Binding Track names. If you’re using this, make sure you’re using Get Name instead and it should work. Thanks to JulienChevallay!