Slate.InvalidationList.NumberElementLeftBeforeSplitting

Slate.InvalidationList.NumberElementLeftBeforeSplitting

#Overview

name: Slate.InvalidationList.NumberElementLeftBeforeSplitting

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 Slate.InvalidationList.NumberElementLeftBeforeSplitting is to control the behavior of the Slate invalidation system when splitting arrays of widgets. It determines the threshold for when to split an array during the invalidation process.

This setting variable is used within the Slate subsystem of Unreal Engine, specifically in the invalidation system for UI widgets. It’s part of the SlateCore module, which is responsible for the core functionality of the Slate UI framework.

The value of this variable is set through the console variable system in Unreal Engine. It’s initialized with a default value of 40 and can be modified at runtime using console commands or through configuration files.

The associated variable GSlateInvalidationWidgetListNumberElementLeftBeforeSplitting directly interacts with this setting. They share the same value, with the console variable acting as an interface to modify the global variable.

Developers should be aware that this variable affects the performance and memory usage of the Slate invalidation system. A lower value will cause more frequent splitting of arrays, which can lead to more memory allocations but potentially faster invalidation in some cases. A higher value will result in fewer splits but may lead to larger contiguous arrays.

Best practices when using this variable include:

  1. Monitor performance metrics related to Slate invalidation when adjusting this value.
  2. Consider the typical size and complexity of your UI when setting this value.
  3. Test different values to find the optimal balance between memory usage and invalidation performance for your specific use case.

Regarding the associated variable GSlateInvalidationWidgetListNumberElementLeftBeforeSplitting:

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/SlateCore/Private/FastUpdate/SlateInvalidationRoot.cpp:153

Scope: file

Source code excerpt:

int32 GSlateInvalidationWidgetListNumberElementLeftBeforeSplitting = 40;
FAutoConsoleVariableRef CVarSlateInvalidationWidgetListNumElementLeftBeforeSplitting(
	TEXT("Slate.InvalidationList.NumberElementLeftBeforeSplitting"),
	GSlateInvalidationWidgetListNumberElementLeftBeforeSplitting,
	TEXT("With the invalidation system, when splitting, only split the array when the number of element left is under X."));

bool GSlateInvalidationEnableReindexLayerId = false;
FAutoConsoleVariableRef CVarSlateInvalidationEnableReindexLayerId(
	TEXT("Slate.InvalidationList.EnableReindexLayerId"),

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/SlateCore/Private/FastUpdate/SlateInvalidationRoot.cpp:151

Scope: file

Source code excerpt:

	TEXT("With the invalidation system, the preferred size of the elements array."));

int32 GSlateInvalidationWidgetListNumberElementLeftBeforeSplitting = 40;
FAutoConsoleVariableRef CVarSlateInvalidationWidgetListNumElementLeftBeforeSplitting(
	TEXT("Slate.InvalidationList.NumberElementLeftBeforeSplitting"),
	GSlateInvalidationWidgetListNumberElementLeftBeforeSplitting,
	TEXT("With the invalidation system, when splitting, only split the array when the number of element left is under X."));

bool GSlateInvalidationEnableReindexLayerId = false;
FAutoConsoleVariableRef CVarSlateInvalidationEnableReindexLayerId(
	TEXT("Slate.InvalidationList.EnableReindexLayerId"),
	GSlateInvalidationEnableReindexLayerId,

#Loc: <Workspace>/Engine/Source/Runtime/SlateCore/Private/FastUpdate/SlateInvalidationRoot.cpp:216

Scope (from outer to inner):

file
function     FSlateInvalidationRoot::FSlateInvalidationRoot

Source code excerpt:

	FSlateApplicationBase::Get().OnInvalidateAllWidgets().AddRaw(this, &FSlateInvalidationRoot::HandleInvalidateAllWidgets);

	const FSlateInvalidationWidgetList::FArguments Arg = { GSlateInvalidationWidgetListMaxArrayElements, GSlateInvalidationWidgetListNumberElementLeftBeforeSplitting };
	FastWidgetPathList = MakeUnique<FSlateInvalidationWidgetList>(InvalidationRootHandle, Arg);
	WidgetsNeedingPreUpdate = MakeUnique<FSlateInvalidationWidgetPreHeap>(*FastWidgetPathList);
	WidgetsNeedingPrepassUpdate = MakeUnique<FSlateInvalidationWidgetPrepassHeap>(*FastWidgetPathList);
	WidgetsNeedingPostUpdate = MakeUnique<FSlateInvalidationWidgetPostHeap>(*FastWidgetPathList);

#if WITH_SLATE_DEBUGGING