Slate.HitTestGridDebugging

Slate.HitTestGridDebugging

#Overview

name: Slate.HitTestGridDebugging

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

It is referenced in 9 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of Slate.HitTestGridDebugging is to enable visualization of the hit test grid in Unreal Engine’s Slate UI framework. This setting is primarily used for debugging and development purposes within the Slate subsystem.

Key points about Slate.HitTestGridDebugging:

  1. Subsystem: This variable is part of the Slate UI framework, which is a core component of Unreal Engine’s user interface system.

  2. Value Setting: The value is set through a console variable (CVarHitTestGridDebugging) in the SlateCore module.

  3. Associated Variable: It’s directly associated with GSlateHitTestGridDebugging, a boolean variable that controls the actual functionality.

  4. Usage: The variable is used in various parts of the SlateCore and SlateReflector modules to control the display of debug information related to the hit test grid.

  5. Developer Awareness:

    • When enabled, it overrides some controls in the Widget Reflector tool.
    • It affects the drawing of debug visuals in SWindow and SWidgetHittestGrid classes.
  6. Best Practices:

    • Use this setting only during development and debugging phases.
    • Disable it for production builds to avoid performance overhead.
    • Be aware that enabling this may interfere with other Slate debugging tools.

Regarding the associated variable GSlateHitTestGridDebugging:

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/SlateCore/Private/SlateCoreClasses.cpp:90

Scope: file

Source code excerpt:

/** True if we should allow widgets to be cached in the UI at all. */
FAutoConsoleVariableRef CVarHitTestGridDebugging(
	TEXT("Slate.HitTestGridDebugging"),
	GSlateHitTestGridDebugging,
	TEXT("Whether to show a visualization of everything in the hit teest grid"));

#endif

FSlateWidgetStyle::FSlateWidgetStyle()

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

Scope (from outer to inner):

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

Source code excerpt:

			AddMenuEntry(MenuBuilder, Icon, LOCTEXT("ShowClipping", "Show Clipping"), TEXT("Slate.ShowClipping"));
			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 GSlateHitTestGridDebugging. They share the same value. See the following C++ source code.

#Loc: <Workspace>/Engine/Source/Developer/SlateReflector/Private/Widgets/SWidgetHittestGrid.cpp:155

Scope (from outer to inner):

file
lambda-function

Source code excerpt:

					.VAlign(VAlign_Center)
					.ContentPadding(FMargin(6.0f, 2.0f))
					.IsEnabled_Lambda([](){return !GSlateHitTestGridDebugging;})
					.OnGetMenuContent(this, &SWidgetHittestGrid::GetDisplayMenuContent)
					.ButtonContent()
					[
						SNew(SBox)
						.Padding(FMargin(4.f, 0.f, 4.f, 0.f))
						[

#Loc: <Workspace>/Engine/Source/Developer/SlateReflector/Private/Widgets/SWidgetHittestGrid.cpp:178

Scope (from outer to inner):

file
lambda-function

Source code excerpt:

					.VAlign(VAlign_Center)
					.ContentPadding(FMargin(6.0f, 2.0f))
					.IsEnabled_Lambda([]() { return !GSlateHitTestGridDebugging; })
					.OnGetMenuContent(this, &SWidgetHittestGrid::GetFlagsMenuContent)
					.ButtonContent()
					[
						SNew(SBox)
						.Padding(FMargin(4.f, 0.f, 4.f, 0.f))
						[

#Loc: <Workspace>/Engine/Source/Developer/SlateReflector/Private/Widgets/SWidgetHittestGrid.cpp:280

Scope (from outer to inner):

file
function     void SWidgetHittestGrid::Construct
lambda-function

Source code excerpt:

			.BorderImage(FAppStyle::GetBrush("SettingsEditor.CheckoutWarningBorder"))
			.BorderBackgroundColor(FColor(166, 137, 0))
			.Visibility_Lambda([](){ return GSlateHitTestGridDebugging ? EVisibility::Visible : EVisibility::Collapsed; })
			[
				SNew(STextBlock)
				.Text(LOCTEXT("GSlateHitTestGridDebuggingEnabled", "The console variable GSlateHitTestGridDebugging is enabled. That will prevent the Widget Reflector to control how the debug information is displayed."))
				.Font(FAppStyle::GetFontStyle("PropertyWindow.NormalFont"))
				.ShadowColorAndOpacity(FLinearColor::Black.CopyWithNewOpacity(0.3f))
				.ShadowOffset(FVector2D::UnitVector)

#Loc: <Workspace>/Engine/Source/Developer/SlateReflector/Private/Widgets/SWidgetHittestGrid.cpp:458

Scope (from outer to inner):

file
function     void SWidgetHittestGrid::HandleDrawDebuggerVisual

Source code excerpt:

void SWidgetHittestGrid::HandleDrawDebuggerVisual(const FPaintArgs& InArgs, const FGeometry& InAllottedGeometry, FSlateWindowElementList& InOutDrawElements, int32& InOutLayerId)
{
	if (GSlateHitTestGridDebugging)
	{
		return;
	}

	TSharedPtr<SWindow> Window = WindowToDisplay.Pin();
	bool bDisplay = bDisplayAllWindows || (Window && Window.Get() == InOutDrawElements.GetPaintWindow());

#Loc: <Workspace>/Engine/Source/Runtime/SlateCore/Private/SlateCoreClasses.cpp:87

Scope: file

Source code excerpt:

	}));

bool GSlateHitTestGridDebugging = false;
/** True if we should allow widgets to be cached in the UI at all. */
FAutoConsoleVariableRef CVarHitTestGridDebugging(
	TEXT("Slate.HitTestGridDebugging"),
	GSlateHitTestGridDebugging,
	TEXT("Whether to show a visualization of everything in the hit teest grid"));

#endif

FSlateWidgetStyle::FSlateWidgetStyle()
{ }

#Loc: <Workspace>/Engine/Source/Runtime/SlateCore/Private/Widgets/SWindow.cpp:2107

Scope (from outer to inner):

file
function     int32 SWindow::PaintWindow

Source code excerpt:


#if WITH_SLATE_DEBUGGING
	if (GSlateHitTestGridDebugging)
	{
		const FGeometry& WindowGeometry = GetWindowGeometryInWindow();
		HittestGrid->DisplayGrid(INT_MAX, WindowGeometry, OutDrawElements);
	}
#endif

#Loc: <Workspace>/Engine/Source/Runtime/SlateCore/Public/SlateGlobals.h:87

Scope: file

Source code excerpt:


#if WITH_SLATE_DEBUGGING
extern SLATECORE_API bool GSlateHitTestGridDebugging;
#endif
/* Forward declarations
*****************************************************************************/
class FActiveTimerHandle;
enum class EActiveTimerReturnType : uint8;