Slate.HitTestGridDebugging
Slate.HitTestGridDebugging
#Overview
name: Slate.HitTestGridDebugging
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Whether to show a visualization of everything in the hit teest grid
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:
-
Subsystem: This variable is part of the Slate UI framework, which is a core component of Unreal Engine’s user interface system.
-
Value Setting: The value is set through a console variable (CVarHitTestGridDebugging) in the SlateCore module.
-
Associated Variable: It’s directly associated with GSlateHitTestGridDebugging, a boolean variable that controls the actual functionality.
-
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.
-
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.
-
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:
- Purpose: It’s the actual boolean flag that controls the hit test grid debugging functionality.
- Usage: It’s checked in various places to determine whether to display debug information or modify behavior.
- Setting: Its value is controlled by the Slate.HitTestGridDebugging console variable.
- Developer Awareness:
- This variable is only defined when WITH_SLATE_DEBUGGING is enabled.
- It’s used to gate certain debugging features, so developers should be aware of its impact on performance and visual output.
- Best Practices:
- Use preprocessor directives (WITH_SLATE_DEBUGGING) when referencing this variable to ensure it’s only used in appropriate builds.
- Reset this variable to false after debugging to ensure normal operation of the Slate UI system.
#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;