Sequencer.AutoScrub

Sequencer.AutoScrub

#Overview

name: Sequencer.AutoScrub

This variable is created as a Console Variable (cvar).

It is referenced in 3 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of Sequencer.AutoScrub is to enable or disable auto-scrubbing functionality in the Unreal Engine’s Sequencer tool. This setting is primarily used in the Sequencer module, which is part of the Editor subsystem.

The Sequencer module in Unreal Engine relies on this setting variable. It is used to control the behavior of the timeline scrubbing in the Sequencer editor, which is crucial for previewing and editing cinematic sequences and animations.

The value of this variable is set as a console variable (CVar) in the Sequencer.cpp file. It is initialized with a default value of false, meaning auto-scrubbing is disabled by default.

This variable interacts with another variable called CVarAutoScrubSpeed, which determines the speed of auto-scrubbing when it’s enabled. Together, these variables control the auto-scrubbing feature in the Sequencer.

Developers must be aware that this variable is a boolean flag. When enabled (set to true), it allows auto-scrubbing functionality in the Sequencer. This feature is particularly useful when the Shift key is held down, as seen in the OnScrubPositionChanged function.

Best practices when using this variable include:

  1. Use it in conjunction with CVarAutoScrubSpeed to fine-tune the auto-scrubbing behavior.
  2. Be cautious when enabling it in performance-critical scenarios, as auto-scrubbing might impact performance.
  3. Consider exposing this setting in the user interface for easy toggling by content creators.

Regarding the associated variable CVarAutoScrub:

The purpose of CVarAutoScrub is to serve as the actual console variable that controls the auto-scrubbing feature. It is defined using the TAutoConsoleVariable template, which allows it to be easily accessed and modified at runtime.

This variable is used directly in the Sequencer module, specifically in the FSequencer class’s OnScrubPositionChanged function. It determines whether auto-scrubbing should be performed when the scrub position changes.

The value of CVarAutoScrub is set when it’s defined, with an initial value of false. It can be changed at runtime through console commands or programmatically.

CVarAutoScrub interacts closely with the Sequencer.AutoScrub setting, effectively implementing its functionality. It also works in conjunction with CVarAutoScrubSpeed to control the auto-scrubbing behavior.

Developers should be aware that changing CVarAutoScrub directly will affect the auto-scrubbing behavior in the Sequencer. They should also note that its effect is conditional on the Shift key being pressed, as seen in the code.

Best practices for using CVarAutoScrub include:

  1. Use console commands to toggle it for debugging purposes.
  2. Consider creating a user-friendly interface to allow content creators to enable/disable this feature easily.
  3. Document its usage and effects clearly for other developers working on the Sequencer module.

#References in C++ code

#Callsites

This variable is referenced in the following C++ source code:

#Loc: <Workspace>/Engine/Source/Editor/Sequencer/Private/Sequencer.cpp:170

Scope: file

Source code excerpt:


static TAutoConsoleVariable<bool> CVarAutoScrub(
	TEXT("Sequencer.AutoScrub"),
	false,
	TEXT("Enable/disable auto-scrubbing"));

static TAutoConsoleVariable<float> CVarAutoScrubSpeed(
	TEXT("Sequencer.AutoScrubSpeed"),
	6.0f,

#Associated Variable and Callsites

This variable is associated with another variable named CVarAutoScrub. They share the same value. See the following C++ source code.

#Loc: <Workspace>/Engine/Source/Editor/Sequencer/Private/Sequencer.cpp:169

Scope: file

Source code excerpt:

DEFINE_LOG_CATEGORY(LogSequencer);

static TAutoConsoleVariable<bool> CVarAutoScrub(
	TEXT("Sequencer.AutoScrub"),
	false,
	TEXT("Enable/disable auto-scrubbing"));

static TAutoConsoleVariable<float> CVarAutoScrubSpeed(
	TEXT("Sequencer.AutoScrubSpeed"),

#Loc: <Workspace>/Engine/Source/Editor/Sequencer/Private/Sequencer.cpp:5361

Scope (from outer to inner):

file
function     void FSequencer::OnScrubPositionChanged

Source code excerpt:

	}

	if (!bScrubbing && CVarAutoScrub->GetBool() && FSlateApplication::Get().GetModifierKeys().IsShiftDown())
	{
		AutoScrubToTime(NewScrubPosition);
	}
	else
	{
		SetLocalTimeDirectly(NewScrubPosition, bEvaluate);