in unreal engine 5.2 using editor utility widget there is a function called set start…
- User
in unreal engine 5.2 using editor utility widget there is a function called set start frame for sequencer. I want the same function but using sequencer timecode than using frames
- Assistant
To set the start frame using sequencer timecode in Unreal Engine, instead of using frames, you can convert the desired timecode to frames, and then use the Set Start Frame function. Here's a simple way to do this using an Editor Utility Widget:
- Open your Editor Utility Widget Blueprint.
- Add a new function called "SetStartFrameWithTimecode".
- Add two input parameters for this function: "TargetSequencer" of type Level Sequence Actor and "StartTimecode" of type FFrameTime.
- Inside the function, you can convert your "StartTimecode" to an integer frame number using the "Conv_FFrameTimeToInt" node. Here's a snippet to help you set this up.
// Assuming you have a valid LevelSequenceActor* TargetSequencer and FFrameTime StartTimecode ULevelSequence* LevelSequence = TargetSequencer->GetSequence(); UMovieScene* MovieScene = LevelSequence->GetMovieScene(); FFrameRate FrameRate = MovieScene->GetDisplayRate(); // The frame rate of your sequence int32 StartFrame = FFrameTime::FromDecimal(StartTimecode.AsDecimal(FrameRate)).RoundToFrame().Value; - User
how to use this with the get current level sequence
- Assistant
To use the "SetStartFrameWithTimecode" function with the current level sequence, you can follow these steps:
-
Create a new function called "GetCurrentLevelSequenceActor" in your Editor Utility Widget Blueprint. This function will return the current Level Sequence Actor in the level.
-
Add a new output parameter for this function called "FoundSequenceActor" of type Level Sequence Actor.
-
Inside the "GetCurrentLevelSequenceActor" function, add a "Get All Actors of Class" node with the Actor Class set to "LevelSequenceActor".
-
Add a "For Each Loop" node connected to the "Get All Actors of Class" node. Inside the loop body, check each Level Sequence Actor if it's currently playing.
for (ALevelSequenceActor* SequenceActor : FoundSequenceActors) { if (SequenceActor->IsPlaying()) { FoundSequenceActor = SequenceActor; break; } } -