Slate.EnableInvalidationPanels
Slate.EnableInvalidationPanels
#Overview
name: Slate.EnableInvalidationPanels
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Whether to attempt to cache any widgets through invalidation panels.
It is referenced in 5
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of Slate.EnableInvalidationPanels is to control whether widget caching through invalidation panels is attempted in the Slate UI system of Unreal Engine.
This setting variable is primarily used by the Slate subsystem, which is responsible for the user interface framework in Unreal Engine. It specifically affects the behavior of the SInvalidationPanel widget, which is part of the UI rendering optimization system.
The value of this variable is set through a console variable (CVar) system. It’s initialized as true by default, and can be changed at runtime using the console command “Slate.EnableInvalidationPanels”.
The main variable that interacts with Slate.EnableInvalidationPanels is bInvalidationPanelsEnabled. This is a static boolean variable that directly reflects the state of the console variable. It’s used in various parts of the SInvalidationPanel implementation to determine whether caching should be performed.
Developers should be aware that:
- Changing this variable affects the performance and behavior of the UI system.
- It’s a global setting that impacts all invalidation panels in the application.
- Disabling this might lead to more frequent UI updates, potentially impacting performance.
Best practices when using this variable include:
- Generally, leave it enabled for optimal performance.
- Use it for debugging purposes when investigating UI-related issues.
- Be cautious when disabling it in production builds, as it may impact performance.
Regarding the associated variable bInvalidationPanelsEnabled:
The purpose of bInvalidationPanelsEnabled is to serve as the runtime representation of the Slate.EnableInvalidationPanels console variable.
This variable is used directly in the Slate subsystem, specifically within the SInvalidationPanel implementation.
Its value is set by the console variable system when Slate.EnableInvalidationPanels is changed.
It interacts closely with other variables in the SInvalidationPanel class, such as bCanCache and GSlateEnableGlobalInvalidation.
Developers should be aware that this variable directly controls the caching behavior of invalidation panels and can significantly impact UI performance.
Best practices for this variable include:
- Avoid modifying it directly; instead, use the console variable to change its value.
- Consider its state when debugging UI performance issues.
- Be aware of its impact on the GetCanCache() method of SInvalidationPanel, which determines whether caching occurs.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Slate/Private/Widgets/SInvalidationPanel.cpp:20
Scope: file
Source code excerpt:
static bool bInvalidationPanelsEnabled = true;
FAutoConsoleVariableRef CVarEnableInvalidationPanels(
TEXT("Slate.EnableInvalidationPanels"),
bInvalidationPanelsEnabled,
TEXT("Whether to attempt to cache any widgets through invalidation panels."),
FConsoleVariableDelegate::CreateStatic(ConsoleVariableEnableInvalidationPanelsChanged));
#if WITH_SLATE_DEBUGGING
#Loc: <Workspace>/Engine/Source/Developer/SlateReflector/Private/Widgets/SSlateOptions.cpp:76
Scope (from outer to inner):
file
function void SSlateOptions::Construct
function static TSharedRef<SWidget> FillToolbar
Source code excerpt:
FSlateIcon Icon(FWidgetReflectorStyle::GetStyleSetName(), "Icon.Empty");
#if WITH_SLATE_DEBUGGING
AddMenuEntry(MenuBuilder, Icon, LOCTEXT("EnableInvalidationPanels", "Enable InvalidationBox"), TEXT("Slate.EnableInvalidationPanels"));
AddMenuEntry(MenuBuilder, Icon, LOCTEXT("InvalidationDebugging", "Show Invalidation"), TEXT("SlateDebugger.Invalidate.Enable"));
AddMenuEntry(MenuBuilder, Icon, LOCTEXT("InvalidationRootDebugging", "Show Root Invalidation"), TEXT("SlateDebugger.InvalidationRoot.Enable"));
AddMenuEntry(MenuBuilder, Icon, LOCTEXT("UpdateDebugging", "Show Update"), TEXT("SlateDebugger.Update.Enable"));
AddMenuEntry(MenuBuilder, Icon, LOCTEXT("PaintDebugging", "Show Paint"), TEXT("SlateDebugger.Paint.Enable"));
AddMenuEntry(MenuBuilder, Icon, LOCTEXT("ShowClipping", "Show Clipping"), TEXT("Slate.ShowClipping"));
AddMenuEntry(MenuBuilder, Icon, LOCTEXT("DebugCulling", "Debug Culling"), TEXT("Slate.DebugCulling"));
#Associated Variable and Callsites
This variable is associated with another variable named bInvalidationPanelsEnabled
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Slate/Private/Widgets/SInvalidationPanel.cpp:18
Scope: file
Source code excerpt:
/** True if we should allow widgets to be cached in the UI at all. */
static bool bInvalidationPanelsEnabled = true;
FAutoConsoleVariableRef CVarEnableInvalidationPanels(
TEXT("Slate.EnableInvalidationPanels"),
bInvalidationPanelsEnabled,
TEXT("Whether to attempt to cache any widgets through invalidation panels."),
FConsoleVariableDelegate::CreateStatic(ConsoleVariableEnableInvalidationPanelsChanged));
#if WITH_SLATE_DEBUGGING
static bool bAlwaysInvalidate = false;
#Loc: <Workspace>/Engine/Source/Runtime/Slate/Private/Widgets/SInvalidationPanel.cpp:91
Scope (from outer to inner):
file
function bool SInvalidationPanel::AreInvalidationPanelsEnabled
Source code excerpt:
bool SInvalidationPanel::AreInvalidationPanelsEnabled()
{
return bInvalidationPanelsEnabled;
}
void SInvalidationPanel::EnableInvalidationPanels(bool bEnable)
{
if (bInvalidationPanelsEnabled != bEnable)
{
bInvalidationPanelsEnabled = bEnable;
// If the cache changed, the parent's InvalidationRoot need to rebuild its list
//since InvalidationPanel cannot be nested in regular mode.
if (!GSlateEnableGlobalInvalidation)
{
FSlateApplicationBase::Get().OnGlobalInvalidationToggled().Broadcast(GSlateEnableGlobalInvalidation);
#Loc: <Workspace>/Engine/Source/Runtime/Slate/Private/Widgets/SInvalidationPanel.cpp:112
Scope (from outer to inner):
file
function bool SInvalidationPanel::GetCanCache
Source code excerpt:
bool SInvalidationPanel::GetCanCache() const
{
return bCanCache && !GSlateEnableGlobalInvalidation && bInvalidationPanelsEnabled;
}
void SInvalidationPanel::OnGlobalInvalidationToggled(bool bGlobalInvalidationEnabled)
{
InvalidateRootChildOrder();
ClearAllFastPathData(true);