LevelSequence.DefaultClockSource
LevelSequence.DefaultClockSource
#Overview
name: LevelSequence.DefaultClockSource
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Specifies the default clock source for newly created level sequences. 0: Tick, 1: Platform, 2: Audio, 3: RelativeTimecode, 4: Timecode, 5: Custom
It is referenced in 8
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of LevelSequence.DefaultClockSource is to specify the default clock source for newly created level sequences in Unreal Engine 5. This setting variable is primarily used in the Level Sequence module, which is part of the cinematic and animation system in Unreal Engine.
The LevelSequence module relies on this setting variable to determine how time should be measured and updated for level sequences. It affects the timing and synchronization of animations, events, and other time-based elements within a level sequence.
The value of this variable is set in multiple places:
- It’s initially defined as a console variable with a default value of 0 (Tick).
- It can be configured in the project settings through the ULevelSequenceProjectSettings class.
- It can be modified at runtime through the console variable system.
This variable interacts closely with the associated variable CVarDefaultClockSource, which is the actual console variable implementation. They share the same value and purpose.
Developers should be aware that:
- The variable accepts integer values from 0 to 5, each representing a different clock source (0: Tick, 1: Platform, 2: Audio, 3: RelativeTimecode, 4: Timecode, 5: Custom).
- Changing this value will only affect newly created level sequences, not existing ones.
- The setting can significantly impact the behavior and performance of level sequences, especially in different runtime environments.
Best practices when using this variable include:
- Choose the most appropriate clock source for your project’s needs, considering factors like platform compatibility and synchronization requirements.
- Be consistent in your use of clock sources across related sequences for better predictability and easier management.
- Test your sequences with different clock sources to ensure they behave correctly across various platforms and scenarios.
Regarding the associated variable CVarDefaultClockSource:
The purpose of CVarDefaultClockSource is to provide a console-accessible way to control the default clock source for level sequences. It’s implemented as a TAutoConsoleVariable
This variable is used directly in the LevelSequence module to set the clock source when initializing new level sequences. It’s also synchronized with the ULevelSequenceProjectSettings::DefaultClockSource property to ensure consistency between the console variable and the project settings.
Developers should be aware that changes to CVarDefaultClockSource will take effect immediately for any new level sequences created after the change. However, existing sequences will not be affected unless they are manually updated.
Best practices for CVarDefaultClockSource include:
- Use it for quick testing and debugging of different clock sources without changing project settings.
- Remember that changes made through the console variable are not persistent and will revert to the project settings on engine restart.
- Consider using this variable in conjunction with other console commands for comprehensive debugging of level sequence timing issues.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/LevelSequence/Private/LevelSequence.cpp:80
Scope: file
Source code excerpt:
static TAutoConsoleVariable<int32> CVarDefaultClockSource(
TEXT("LevelSequence.DefaultClockSource"),
0,
TEXT("Specifies the default clock source for newly created level sequences. 0: Tick, 1: Platform, 2: Audio, 3: RelativeTimecode, 4: Timecode, 5: Custom"),
ECVF_Default);
ULevelSequence::ULevelSequence(const FObjectInitializer& ObjectInitializer)
: Super(ObjectInitializer)
#Loc: <Workspace>/Engine/Source/Runtime/LevelSequence/Private/LevelSequenceProjectSettings.h:27
Scope (from outer to inner):
file
class class ULevelSequenceProjectSettings : public UDeveloperSettings
Source code excerpt:
FString DefaultTickResolution;
UPROPERTY(config, EditAnywhere, Category=Timeline, meta=(ConsoleVariable="LevelSequence.DefaultClockSource", Tooltip="Specifies default clock source for newly created level sequences. Examples: 0: Tick, 1: Platform, 2: Audio, 3: RelativeTimecode, 4: Timecode, 5: Custom"))
EUpdateClockSource DefaultClockSource;
virtual void PostInitProperties() override;
#if WITH_EDITOR
virtual void PostEditChangeProperty(struct FPropertyChangedEvent& PropertyChangedEvent) override;
#endif
#Loc: <Workspace>/Engine/Source/Runtime/LevelSequence/Private/LevelSequenceProjectSettings.cpp:42
Scope (from outer to inner):
file
function void ULevelSequenceProjectSettings::PostInitProperties
Source code excerpt:
}
if (IConsoleVariable* ConsoleVariable = IConsoleManager::Get().FindConsoleVariable(TEXT("LevelSequence.DefaultClockSource")))
{
ConsoleVariable->Set((int32)DefaultClockSource, ECVF_SetByProjectSetting);
}
}
#endif
}
#Associated Variable and Callsites
This variable is associated with another variable named CVarDefaultClockSource
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/LevelSequence/Private/LevelSequence.cpp:79
Scope: file
Source code excerpt:
ECVF_Default);
static TAutoConsoleVariable<int32> CVarDefaultClockSource(
TEXT("LevelSequence.DefaultClockSource"),
0,
TEXT("Specifies the default clock source for newly created level sequences. 0: Tick, 1: Platform, 2: Audio, 3: RelativeTimecode, 4: Timecode, 5: Custom"),
ECVF_Default);
ULevelSequence::ULevelSequence(const FObjectInitializer& ObjectInitializer)
#Loc: <Workspace>/Engine/Source/Runtime/LevelSequence/Private/LevelSequence.cpp:108
Scope (from outer to inner):
file
function void ULevelSequence::Initialize
Source code excerpt:
MovieScene->SetDisplayRate(DisplayRate);
int32 ClockSource = CVarDefaultClockSource.GetValueOnGameThread();
MovieScene->SetClockSource((EUpdateClockSource)ClockSource);
#if WITH_EDITOR
UMovieSceneMetaData* MetaData = FindOrAddMetaData<UMovieSceneMetaData>();
MetaData->SetCreated(FDateTime::UtcNow());
MetaData->SetAuthor(FApp::GetSessionOwner());
#Loc: <Workspace>/Engine/Source/Runtime/LevelSequence/Private/LevelSequenceProjectSettings.cpp:10
Scope (from outer to inner):
file
function ULevelSequenceProjectSettings::ULevelSequenceProjectSettings
Source code excerpt:
, DefaultDisplayRate("30fps")
, DefaultTickResolution("24000fps")
, DefaultClockSource(EUpdateClockSource::Tick)
{ }
void ULevelSequenceProjectSettings::PostInitProperties()
{
Super::PostInitProperties();
#Loc: <Workspace>/Engine/Source/Runtime/LevelSequence/Private/LevelSequenceProjectSettings.cpp:44
Scope (from outer to inner):
file
function void ULevelSequenceProjectSettings::PostInitProperties
Source code excerpt:
if (IConsoleVariable* ConsoleVariable = IConsoleManager::Get().FindConsoleVariable(TEXT("LevelSequence.DefaultClockSource")))
{
ConsoleVariable->Set((int32)DefaultClockSource, ECVF_SetByProjectSetting);
}
}
#endif
}
#if WITH_EDITOR
#Loc: <Workspace>/Engine/Source/Runtime/LevelSequence/Private/LevelSequenceProjectSettings.h:28
Scope (from outer to inner):
file
class class ULevelSequenceProjectSettings : public UDeveloperSettings
Source code excerpt:
UPROPERTY(config, EditAnywhere, Category=Timeline, meta=(ConsoleVariable="LevelSequence.DefaultClockSource", Tooltip="Specifies default clock source for newly created level sequences. Examples: 0: Tick, 1: Platform, 2: Audio, 3: RelativeTimecode, 4: Timecode, 5: Custom"))
EUpdateClockSource DefaultClockSource;
virtual void PostInitProperties() override;
#if WITH_EDITOR
virtual void PostEditChangeProperty(struct FPropertyChangedEvent& PropertyChangedEvent) override;
#endif
};