ControlRig.Sequencer.SelectedSectionSetsSectionToKey

ControlRig.Sequencer.SelectedSectionSetsSectionToKey

#Overview

name: ControlRig.Sequencer.SelectedSectionSetsSectionToKey

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

It is referenced in 4 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of ControlRig.Sequencer.SelectedSectionSetsSectionToKey is to control the behavior of section selection in the Control Rig Sequencer. Specifically, it determines whether selecting a channel in a section automatically sets that section as the “Section To Key” when it’s the only selected section.

This setting variable is primarily used in the Control Rig Editor module, specifically within the Sequencer functionality of the Control Rig plugin. It’s part of the animation system in Unreal Engine 5, focusing on the integration between Control Rig and Sequencer.

The value of this variable is set as a console variable (CVar) with a default value of true. It can be modified at runtime through the console or configuration files.

The associated variable CVarSelectedSectionSetsSectionToKey directly interacts with this setting. They share the same value and purpose.

Developers should be aware that this variable affects the user experience in the Sequencer when working with Control Rig animations. When enabled, it can streamline the workflow by automatically setting the active section for keying based on user selection.

Best practices for using this variable include:

  1. Consider the target user workflow when deciding whether to enable or disable this feature.
  2. Communicate the current state of this setting to users, as it may affect their expectations when interacting with the Sequencer.
  3. Provide documentation or tooltips explaining the behavior this setting enables.

Regarding the associated variable CVarSelectedSectionSetsSectionToKey:

The purpose of CVarSelectedSectionSetsSectionToKey is identical to ControlRig.Sequencer.SelectedSectionSetsSectionToKey. It’s the C++ representation of the console variable in the code.

This variable is used in the ControlRigParameterTrackEditor class to determine the behavior when sections are selected. It’s checked in the OnSelectionChanged and SelectRigsAndControls functions to decide whether to update the “Section To Key” based on the current selection.

The value of this variable is set through the TAutoConsoleVariable template, which allows it to be modified via console commands or configuration files.

As with the original variable, developers should be aware that this setting affects the Sequencer workflow for Control Rig animations. It’s important to consider the implications on user interaction and expectations when modifying this value.

Best practices for using CVarSelectedSectionSetsSectionToKey include:

  1. Use the GetValueOnGameThread() method to access its current value, ensuring thread-safe access.
  2. Consider exposing this setting in user-facing configuration options if it significantly impacts the workflow.
  3. Document the behavior changes associated with enabling or disabling this feature in relevant user guides or tooltips.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Plugins/Animation/ControlRig/Source/ControlRigEditor/Private/Sequencer/ControlRigParameterTrackEditor.cpp:111

Scope: file

Source code excerpt:

TAutoConsoleVariable<bool> CVarSelectedKeysSelectControls(TEXT("ControlRig.Sequencer.SelectedKeysSelectControls"), false, TEXT("When true when we select a key in Sequencer it will select the Control, by default false."));

TAutoConsoleVariable<bool> CVarSelectedSectionSetsSectionToKey(TEXT("ControlRig.Sequencer.SelectedSectionSetsSectionToKey"), true, TEXT("When true when we select a channel in a section, if it's the only section selected we set it as the Section To Key, by default false."));

TAutoConsoleVariable<bool> CVarEnableAdditiveControlRigs(TEXT("ControlRig.Sequencer.EnableAdditiveControlRigs"), true, TEXT("When true it is possible to add an additive control rig to a skeletal mesh component."));

static USkeletalMeshComponent* AcquireSkeletalMeshFromObject(UObject* BoundObject, TSharedPtr<ISequencer> SequencerPtr)
{
	if (AActor* Actor = Cast<AActor>(BoundObject))

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Plugins/Animation/ControlRig/Source/ControlRigEditor/Private/Sequencer/ControlRigParameterTrackEditor.cpp:111

Scope: file

Source code excerpt:

TAutoConsoleVariable<bool> CVarSelectedKeysSelectControls(TEXT("ControlRig.Sequencer.SelectedKeysSelectControls"), false, TEXT("When true when we select a key in Sequencer it will select the Control, by default false."));

TAutoConsoleVariable<bool> CVarSelectedSectionSetsSectionToKey(TEXT("ControlRig.Sequencer.SelectedSectionSetsSectionToKey"), true, TEXT("When true when we select a channel in a section, if it's the only section selected we set it as the Section To Key, by default false."));

TAutoConsoleVariable<bool> CVarEnableAdditiveControlRigs(TEXT("ControlRig.Sequencer.EnableAdditiveControlRigs"), true, TEXT("When true it is possible to add an additive control rig to a skeletal mesh component."));

static USkeletalMeshComponent* AcquireSkeletalMeshFromObject(UObject* BoundObject, TSharedPtr<ISequencer> SequencerPtr)
{
	if (AActor* Actor = Cast<AActor>(BoundObject))

#Loc: <Workspace>/Engine/Plugins/Animation/ControlRig/Source/ControlRigEditor/Private/Sequencer/ControlRigParameterTrackEditor.cpp:2322

Scope (from outer to inner):

file
function     void FControlRigParameterTrackEditor::OnSelectionChanged

Source code excerpt:

			}
		}
		const bool bSelectedSectionSetsSectionToKey = CVarSelectedSectionSetsSectionToKey.GetValueOnGameThread();
		if (bSelectedSectionSetsSectionToKey)
		{
			TMap<UMovieSceneTrack*, TSet<UMovieSceneControlRigParameterSection*>> TracksAndSections;
			using namespace UE::Sequencer;
			for (FViewModelPtr ViewModel : GetSequencer()->GetViewModel()->GetSelection()->Outliner)
			{

#Loc: <Workspace>/Engine/Plugins/Animation/ControlRig/Source/ControlRigEditor/Private/Sequencer/ControlRigParameterTrackEditor.cpp:2371

Scope (from outer to inner):

file
function     void FControlRigParameterTrackEditor::SelectRigsAndControls

Source code excerpt:

	
	//if selection set's section to key we need to keep track of selected sections for each track.
	const bool bSelectedSectionSetsSectionToKey = CVarSelectedSectionSetsSectionToKey.GetValueOnGameThread();
	TMap<UMovieSceneTrack*, TSet<UMovieSceneControlRigParameterSection*>> TracksAndSections;

	TArray<FString> StringArray;
	//we have two sets here one to see if selection has really changed that contains the attirbutes, the other to select just the parent
	TMap<UControlRig*, TSet<FName>> RigsAndControls;
	for (const IKeyArea* KeyArea : KeyAreas)