PlaybackSpeeds
PlaybackSpeeds
#Overview
name: PlaybackSpeeds
The value of this variable can be defined or overridden in .ini config files. 7
.ini config files referencing this setting variable.
It is referenced in 13
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of PlaybackSpeeds is to define a set of playback speed options for animations, visual effects, or sequences in Unreal Engine 5. It is primarily used in the Niagara visual effects system and the Sequencer animation system to control the speed at which animations or effects are played back.
This setting variable is relied upon by the following Unreal Engine subsystems and modules:
- Niagara visual effects system (NiagaraEditor module)
- Sequencer animation system (Sequencer module)
- Persona animation editor (Persona module)
The value of this variable is typically set in configuration files or through the Unreal Engine editor interface. In the Niagara system, it’s defined as a config property in the UNiagaraEditorSettings class.
PlaybackSpeeds interacts with other variables such as:
- CachedPlaybackSpeeds (in Niagara)
- CurrentSpeedIndex (in Sequencer)
- PlaybackSpeed (in Sequencer)
Developers should be aware of the following when using this variable:
- The values in PlaybackSpeeds represent multipliers of the normal playback speed (e.g., 0.5 for half speed, 2.0 for double speed).
- The array should include 1.0 to represent normal playback speed.
- In some systems (like Sequencer), negative values can be used to represent reverse playback.
Best practices when using this variable include:
- Provide a range of speeds that are useful for your specific project needs.
- Always include 1.0 in the array to allow for normal speed playback.
- Sort the array in ascending order for consistent menu presentation and navigation.
- Consider including both slower (< 1.0) and faster (> 1.0) speeds to give users a full range of control.
- When implementing custom playback systems, use similar patterns as seen in the existing code to maintain consistency across the engine.
#Setting Variables
#References In INI files
Location: <Workspace>/Engine/Plugins/FX/Niagara/Config/BaseNiagara.ini:92, section: [/Script/NiagaraEditor.NiagaraEditorSettings]
- INI Section:
/Script/NiagaraEditor.NiagaraEditorSettings
- Raw value:
0.010000
- Is Array:
True
Location: <Workspace>/Engine/Plugins/FX/Niagara/Config/BaseNiagara.ini:93, section: [/Script/NiagaraEditor.NiagaraEditorSettings]
- INI Section:
/Script/NiagaraEditor.NiagaraEditorSettings
- Raw value:
0.100000
- Is Array:
True
Location: <Workspace>/Engine/Plugins/FX/Niagara/Config/BaseNiagara.ini:94, section: [/Script/NiagaraEditor.NiagaraEditorSettings]
- INI Section:
/Script/NiagaraEditor.NiagaraEditorSettings
- Raw value:
0.250000
- Is Array:
True
Location: <Workspace>/Engine/Plugins/FX/Niagara/Config/BaseNiagara.ini:95, section: [/Script/NiagaraEditor.NiagaraEditorSettings]
- INI Section:
/Script/NiagaraEditor.NiagaraEditorSettings
- Raw value:
0.500000
- Is Array:
True
Location: <Workspace>/Engine/Plugins/FX/Niagara/Config/BaseNiagara.ini:96, section: [/Script/NiagaraEditor.NiagaraEditorSettings]
- INI Section:
/Script/NiagaraEditor.NiagaraEditorSettings
- Raw value:
1.000000
- Is Array:
True
Location: <Workspace>/Engine/Plugins/FX/Niagara/Config/BaseNiagara.ini:97, section: [/Script/NiagaraEditor.NiagaraEditorSettings]
- INI Section:
/Script/NiagaraEditor.NiagaraEditorSettings
- Raw value:
1.500000
- Is Array:
True
Location: <Workspace>/Engine/Plugins/FX/Niagara/Config/BaseNiagara.ini:98, section: [/Script/NiagaraEditor.NiagaraEditorSettings]
- INI Section:
/Script/NiagaraEditor.NiagaraEditorSettings
- Raw value:
2.000000
- Is Array:
True
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Plugins/FX/Niagara/Source/NiagaraEditor/Private/NiagaraEditorSettings.cpp:297
Scope (from outer to inner):
file
function void UNiagaraEditorSettings::BuildCachedPlaybackSpeeds
Source code excerpt:
void UNiagaraEditorSettings::BuildCachedPlaybackSpeeds() const
{
CachedPlaybackSpeeds = PlaybackSpeeds;
if (!CachedPlaybackSpeeds.GetValue().Contains(1.f))
{
CachedPlaybackSpeeds.GetValue().Add(1.f);
}
CachedPlaybackSpeeds.GetValue().Sort();
#Loc: <Workspace>/Engine/Plugins/FX/Niagara/Source/NiagaraEditor/Private/Widgets/SNiagaraDebugger.cpp:1266
Scope (from outer to inner):
file
function TSharedRef<SWidget> SNiagaraDebugger::MakePlaybackOptionsMenu
Source code excerpt:
MenuBuilder.BeginSection(NAME_None, LOCTEXT("PlaybackSpeed", "Playback Speed"));
{
static const TTuple<float, FText, FText> PlaybackSpeeds[] =
{
MakeTuple(1.0000f, LOCTEXT("PlaybackSpeed_Normal", "Normal Speed"), LOCTEXT("NormalSpeedTooltip_1", "Set playback speed to normal")),
MakeTuple(0.5000f, LOCTEXT("PlaybackSpeed_Half", "Half Speed"), LOCTEXT("NormalSpeedTooltip_0.5", "Set playback speed to half the normal speed")),
MakeTuple(0.2500f, LOCTEXT("PlaybackSpeed_Quarter", "Quarter Speed "), LOCTEXT("NormalSpeedTooltip_0.25", "Set playback speed to quarter the normal speed")),
MakeTuple(0.1250f, LOCTEXT("PlaybackSpeed_Eighth", "Eighth Speed "), LOCTEXT("NormalSpeedTooltip_0.125", "Set playback speed to eighth the normal speed")),
MakeTuple(0.0625f, LOCTEXT("PlaybackSpeed_Sixteenth", "Sixteenth Speed "), LOCTEXT("NormalSpeedTooltip_0.0625", "Set playback speed to sixteenth the normal speed")),
#Loc: <Workspace>/Engine/Plugins/FX/Niagara/Source/NiagaraEditor/Private/Widgets/SNiagaraDebugger.cpp:1276
Scope (from outer to inner):
file
function TSharedRef<SWidget> SNiagaraDebugger::MakePlaybackOptionsMenu
Source code excerpt:
UNiagaraDebugHUDSettings* Settings = GetMutableDefault<UNiagaraDebugHUDSettings>();
for ( const auto& Speed : PlaybackSpeeds )
{
MenuBuilder.AddMenuEntry(
Speed.Get<1>(),
Speed.Get<2>(),
FSlateIcon(),
FUIAction(
#Loc: <Workspace>/Engine/Plugins/FX/Niagara/Source/NiagaraEditor/Public/NiagaraEditorSettings.h:564
Scope (from outer to inner):
file
class class UNiagaraEditorSettings : public UDeveloperSettings
Source code excerpt:
/** Speeds used for slowing down and speeding up the playback speeds */
UPROPERTY(config, EditAnywhere, Category = Niagara)
TArray<float> PlaybackSpeeds;
UPROPERTY(config, EditAnywhere, Category = "Niagara Colors")
FNiagaraActionColors ActionColors;
/** This is built using PlaybackSpeeds, populated whenever it is accessed using GetPlaybackSpeeds() */
mutable TOptional<TArray<float>> CachedPlaybackSpeeds;
UPROPERTY(config)
TMap<FString, FString> HLSLKeywordReplacements;
UPROPERTY()
#Loc: <Workspace>/Engine/Source/Editor/Persona/Private/SAnimationEditorViewport.cpp:1057
Scope (from outer to inner):
file
function void SAnimationEditorViewportTabBody::BindCommands
Source code excerpt:
const FAnimViewportPlaybackCommands& ViewportPlaybackCommands = FAnimViewportPlaybackCommands::Get();
CommandList.BeginGroup(TEXT("PlaybackSpeeds"));
//Create a menu item for each playback speed in EAnimationPlaybackSpeeds
for(int32 i = 0; i < int(EAnimationPlaybackSpeeds::NumPlaybackSpeeds); ++i)
{
CommandList.MapAction(
ViewportPlaybackCommands.PlaybackSpeedCommands[i],
#Loc: <Workspace>/Engine/Source/Editor/Sequencer/Private/SSequencer.cpp:2297
Scope (from outer to inner):
file
function void SSequencer::FillPlaybackSpeedMenu
Source code excerpt:
void SSequencer::FillPlaybackSpeedMenu(FMenuBuilder& InMenuBarBuilder)
{
TArray<float> PlaybackSpeeds = OnGetPlaybackSpeeds.Execute();
InMenuBarBuilder.BeginSection("PlaybackSpeed");
for( int32 PlaybackSpeedIndex = 0; PlaybackSpeedIndex < PlaybackSpeeds.Num(); ++PlaybackSpeedIndex )
{
float PlaybackSpeed = PlaybackSpeeds[PlaybackSpeedIndex];
const FText MenuStr = FText::Format( LOCTEXT("PlaybackSpeedStr", "{0}"), FText::AsNumber( PlaybackSpeed ) );
InMenuBarBuilder.AddMenuEntry(MenuStr, FText(), FSlateIcon(),
FUIAction(
FExecuteAction::CreateLambda( [this, PlaybackSpeed]
{
SequencerPtr.Pin()->SetPlaybackSpeed(PlaybackSpeed);
#Loc: <Workspace>/Engine/Source/Editor/Sequencer/Private/Sequencer.cpp:9084
Scope (from outer to inner):
file
function void FSequencer::RestorePlaybackSpeed
Source code excerpt:
void FSequencer::RestorePlaybackSpeed()
{
TArray<float> PlaybackSpeeds = GetPlaybackSpeeds.Execute();
CurrentSpeedIndex = PlaybackSpeeds.Find(1.f);
check(CurrentSpeedIndex != INDEX_NONE);
PlaybackSpeed = PlaybackSpeeds[CurrentSpeedIndex];
if (PlaybackState != EMovieScenePlayerStatus::Playing)
{
OnPlayForward(false);
}
}
void FSequencer::ShuttleForward()
{
TArray<float> PlaybackSpeeds = GetPlaybackSpeeds.Execute();
float CurrentSpeed = GetPlaybackSpeed();
int32 Sign = 0;
if(PlaybackState == EMovieScenePlayerStatus::Playing)
{
#Loc: <Workspace>/Engine/Source/Editor/Sequencer/Private/Sequencer.cpp:9108
Scope (from outer to inner):
file
function void FSequencer::ShuttleForward
Source code excerpt:
if (CurrentSpeed > 0)
{
CurrentSpeedIndex = FMath::Min(PlaybackSpeeds.Num() - 1, ++CurrentSpeedIndex);
Sign = 1;
}
else if (CurrentSpeed < 0)
{
// if we are at the negative slowest speed, turn to positive slowest speed
if (CurrentSpeedIndex == 0)
#Loc: <Workspace>/Engine/Source/Editor/Sequencer/Private/Sequencer.cpp:9129
Scope (from outer to inner):
file
function void FSequencer::ShuttleForward
Source code excerpt:
{
Sign = 1;
CurrentSpeedIndex = PlaybackSpeeds.Find(1);
}
PlaybackSpeed = PlaybackSpeeds[CurrentSpeedIndex] * Sign;
if (PlaybackState != EMovieScenePlayerStatus::Playing)
{
OnPlayForward(false);
}
}
#Loc: <Workspace>/Engine/Source/Editor/Sequencer/Private/Sequencer.cpp:9142
Scope (from outer to inner):
file
function void FSequencer::ShuttleBackward
Source code excerpt:
void FSequencer::ShuttleBackward()
{
TArray<float> PlaybackSpeeds = GetPlaybackSpeeds.Execute();
float CurrentSpeed = GetPlaybackSpeed();
int32 Sign = 0;
if(PlaybackState == EMovieScenePlayerStatus::Playing)
{
#Loc: <Workspace>/Engine/Source/Editor/Sequencer/Private/Sequencer.cpp:9166
Scope (from outer to inner):
file
function void FSequencer::ShuttleBackward
Source code excerpt:
else if (CurrentSpeed < 0)
{
CurrentSpeedIndex = FMath::Min(PlaybackSpeeds.Num() - 1, ++CurrentSpeedIndex);
Sign = -1;
}
}
else
{
Sign = -1;
CurrentSpeedIndex = PlaybackSpeeds.Find(1);
}
PlaybackSpeed = PlaybackSpeeds[CurrentSpeedIndex] * Sign;
if (PlaybackState != EMovieScenePlayerStatus::Playing)
{
OnPlayBackward(false);
}
}
#Loc: <Workspace>/Engine/Source/Editor/Sequencer/Private/Sequencer.cpp:9186
Scope (from outer to inner):
file
function int32 FSequencer::FindClosestPlaybackSpeed
Source code excerpt:
int32 FSequencer::FindClosestPlaybackSpeed(float InPlaybackSpeed, bool bExactOnly) const
{
TArray<float> PlaybackSpeeds = GetPlaybackSpeeds.Execute();
int32 NewSpeedIndex = INDEX_NONE;
float Delta = TNumericLimits<float>::Max();
for (int32 Idx = 0; Idx < PlaybackSpeeds.Num(); Idx++)
{
float NewDelta = FMath::Abs(InPlaybackSpeed - PlaybackSpeeds[Idx]);
if (NewDelta < Delta)
{
Delta = NewDelta;
NewSpeedIndex = Idx;
}
}
#Loc: <Workspace>/Engine/Source/Editor/Sequencer/Private/Sequencer.cpp:9216
Scope (from outer to inner):
file
function void FSequencer::SnapToClosestPlaybackSpeed
Source code excerpt:
if (NewSpeedIndex != INDEX_NONE)
{
TArray<float> PlaybackSpeeds = GetPlaybackSpeeds.Execute();
CurrentSpeedIndex = NewSpeedIndex;
PlaybackSpeed = PlaybackSpeeds[NewSpeedIndex];
}
}
void FSequencer::Pause()
{
SetPlaybackStatus(EMovieScenePlayerStatus::Stopped);