Slate.EnableDesignerRetainedRendering

Slate.EnableDesignerRetainedRendering

#Overview

name: Slate.EnableDesignerRetainedRendering

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 Slate.EnableDesignerRetainedRendering is to control whether retained rendering is enabled in the Unreal Engine designer environment for retainer widgets. This setting is primarily used in the Slate UI system, specifically for optimizing rendering performance in the editor.

This setting variable is mainly used in the UMG (Unreal Motion Graphics) module, which is part of Unreal Engine’s UI framework. It’s specifically referenced in the SRetainerWidget class, which is responsible for caching and efficiently rendering UI elements.

The value of this variable is set through a console variable, which means it can be changed at runtime. It’s initialized to true by default, allowing retained rendering in the designer.

The associated variable GEnableDesignerRetainedRendering directly interacts with Slate.EnableDesignerRetainedRendering. They share the same value and are used interchangeably in the code.

Developers must be aware that this setting affects the rendering behavior of retainer widgets in the Unreal Engine designer. When enabled (set to 1), it allows retainer widgets to use their specified properties for rendering in the designer. When disabled (set to 0), it forces retainer widgets to render normally in the designer, potentially affecting performance but ensuring accurate representation.

Best practices when using this variable include:

  1. Keep it enabled by default to benefit from the performance improvements of retained rendering.
  2. Disable it temporarily if you need to debug issues related to retainer widget rendering in the designer.
  3. Be aware that changing this setting may affect the visual representation of your UI in the designer, so test thoroughly after making changes.

Regarding the associated variable GEnableDesignerRetainedRendering:

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/UMG/Private/Slate/SRetainerWidget.cpp:27

Scope: file

Source code excerpt:

bool GEnableDesignerRetainedRendering = true;
FAutoConsoleVariableRef EnableDesignerRetainedRendering(
	TEXT("Slate.EnableDesignerRetainedRendering"),
	GEnableDesignerRetainedRendering,
	TEXT("Controls if retainer renders in designer; 0 - Never; 1 - Per Widget Properties"),
	FConsoleVariableDelegate::CreateStatic(&HandleDesignerRetainedRenderingToggled)
);

/** True if we should allow widgets to be cached in the UI at all. */

#Loc: <Workspace>/Engine/Source/Developer/SlateReflector/Private/Widgets/SSlateOptions.cpp:84

Scope (from outer to inner):

file
function     void SSlateOptions::Construct
function     static TSharedRef<SWidget> FillToolbar

Source code excerpt:

			AddMenuEntry(MenuBuilder, Icon, LOCTEXT("DebugCulling", "Debug Culling"), TEXT("Slate.DebugCulling"));
			AddMenuEntry(MenuBuilder, Icon, LOCTEXT("ShowHitTestGrid", "Show HitTestGrid"), TEXT("Slate.HitTestGridDebugging"));
			AddMenuEntry(MenuBuilder, Icon, LOCTEXT("DesignerRetainedRendering", "Designer Retained Rendering"), TEXT("Slate.EnableDesignerRetainedRendering"));
#endif // WITH_SLATE_DEBUGGING
			AddMenuEntry(MenuBuilder, Icon, LOCTEXT("ShowBatching", "Show Batching"), TEXT("Slate.ShowBatching"));
			AddMenuEntry(MenuBuilder, Icon, LOCTEXT("ShowOverdraw", "Show Overdraw"), TEXT("Slate.ShowOverdraw"));
			
			return MenuBuilder.MakeWidget();
		}

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/UMG/Private/Slate/SRetainerWidget.cpp:25

Scope: file

Source code excerpt:


/** True if we should do retained rendering in designer. */
bool GEnableDesignerRetainedRendering = true;
FAutoConsoleVariableRef EnableDesignerRetainedRendering(
	TEXT("Slate.EnableDesignerRetainedRendering"),
	GEnableDesignerRetainedRendering,
	TEXT("Controls if retainer renders in designer; 0 - Never; 1 - Per Widget Properties"),
	FConsoleVariableDelegate::CreateStatic(&HandleDesignerRetainedRenderingToggled)
);

/** True if we should allow widgets to be cached in the UI at all. */
int32 GEnableRetainedRendering = 1;

#Loc: <Workspace>/Engine/Source/Runtime/UMG/Private/Slate/SRetainerWidget.cpp:598

Scope (from outer to inner):

file
function     int32 SRetainerWidget::OnPaint

Source code excerpt:


#if WITH_EDITOR
	bool bShouldSkipDesignerRendering = bIsDesignTime && (!bShowEffectsInDesigner || !GEnableDesignerRetainedRendering);
	bShouldRetainRendering = bEnableRetainedRendering && !bShouldSkipDesignerRendering;
#endif // WITH_EDITOR

	if (bShouldRetainRendering && IsAnythingVisibleToRender())
	{
		SCOPE_CYCLE_COUNTER(STAT_SlateRetainerWidgetPaint);