GridTextColor
GridTextColor
#Overview
name: GridTextColor
The value of this variable can be defined or overridden in .ini config files. 1
.ini config file referencing this setting variable.
It is referenced in 10
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of GridTextColor is to define the color of text used for grid labels in various graph and curve editor interfaces within Unreal Engine 5. This variable is primarily used for visual representation and customization of the user interface elements in debugging and profiling tools.
GridTextColor is utilized by several Unreal Engine subsystems and modules, including:
- Profiler module (SDataGraph and SHistogram widgets)
- DistCurveEditor module (CurveEditorViewportClient)
- UnrealEd module (SCurveEditor and CurveEdOptions)
The value of this variable is typically set in different ways depending on the context:
- In some cases, it’s defined as a static constant within specific functions (e.g., in SDataGraph and SHistogram).
- In the CurveEditorViewportClient, it’s set from SharedData->EditorOptions->GridTextColor.
- In the CurveEdOptions class, it’s defined as an UPROPERTY, which means it can be configured through the editor’s preferences.
GridTextColor often interacts with other color variables such as GridColor, SelectedLabelColor, and LabelBlockBkgColor to create a cohesive visual style for graph and curve editors.
Developers should be aware that:
- The alpha value of GridTextColor is often set to less than 1.0 to make the text semi-transparent.
- Changes to this color may affect the readability of grid labels, so it should be chosen carefully to contrast with the background.
Best practices when using this variable include:
- Ensuring sufficient contrast between GridTextColor and the background color for readability.
- Maintaining consistency across different graph and curve editor interfaces for a unified look and feel.
- Considering accessibility guidelines when choosing colors, to accommodate users with color vision deficiencies.
- Using the configurable UPROPERTY in CurveEdOptions to allow users to customize the color if needed.
#Setting Variables
#References In INI files
Location: <Workspace>/Engine/Config/BaseEditorPerProjectUserSettings.ini:534, section: [/Script/UnrealEd.CurveEdOptions]
- INI Section:
/Script/UnrealEd.CurveEdOptions
- Raw value:
(R=0.78431373,G=0.78431373,B=0.78431373,A=1.0)
- Is Array:
False
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Developer/Profiler/Private/Widgets/SDataGraph.cpp:495
Scope (from outer to inner):
file
function int32 SDataGraph::OnPaint
Source code excerpt:
static const FLinearColor GridColor = FLinearColor(0.0f,0.0f,0.0f, 0.25f);
static const FLinearColor GridTextColor = FLinearColor(1.0f,1.0f,1.0f, 0.25f);
TArray<FVector2D> LinePoints;
const float LabelSize = MaxFontCharHeight * 7.0f;
const TSharedPtr<FTrackedStat> FirstTrackedStat = GetFirstGraph();
if( FirstTrackedStat.IsValid() )
{
#Loc: <Workspace>/Engine/Source/Developer/Profiler/Private/Widgets/SHistogram.cpp:62
Scope (from outer to inner):
file
function int32 SHistogram::OnPaint
Source code excerpt:
float StartX = LabelBuffer;
static const FLinearColor GridColor = FLinearColor(0.0f,0.0f,0.0f, 0.25f);
static const FLinearColor GridTextColor = FLinearColor(1.0f,1.0f,1.0f, 0.25f);
static const FLinearColor BorderColor = FLinearColor(0.0f,0.0f,0.0f,1.0f);
FSlateFontInfo SummaryFont = FCoreStyle::GetDefaultFontStyle("Regular", 8);
const float MaxFontCharHeight = static_cast<float>(FontMeasureService->Measure( TEXT("!"), SummaryFont ).Y);
TArray<FVector2D> LinePoints;
// draw the histogram box
#Loc: <Workspace>/Engine/Source/Editor/DistCurveEditor/Private/CurveEditorViewportClient.cpp:82
Scope (from outer to inner):
file
function FCurveEditorViewportClient::FCurveEditorViewportClient
Source code excerpt:
SelectedLabelColor = SharedData->EditorOptions->SelectedLabelColor;
GridColor = SharedData->EditorOptions->GridColor;
GridTextColor = SharedData->EditorOptions->GridTextColor;
LabelBlockBkgColor = SharedData->EditorOptions->LabelBlockBkgColor;
SelectedKeyColor = SharedData->EditorOptions->SelectedKeyColor;
MouseOverCurveIndex = INDEX_NONE;
MouseOverSubIndex = INDEX_NONE;
MouseOverKeyIndex = INDEX_NONE;
#Loc: <Workspace>/Engine/Source/Editor/DistCurveEditor/Private/CurveEditorViewportClient.cpp:1210
Scope (from outer to inner):
file
function void FCurveEditorViewportClient::DrawEntry
Source code excerpt:
}
FCanvasTextItem TextItem( FVector2D(NewKeyPos.X + 5, NewKeyPos.Y - 5), FText::FromString(KeyComment), GEditor->GetSmallFont(), GridTextColor );
Canvas->DrawItem( TextItem );
}
}
}
}
#Loc: <Workspace>/Engine/Source/Editor/DistCurveEditor/Private/CurveEditorViewportClient.cpp:1365
Scope (from outer to inner):
file
function void FCurveEditorViewportClient::DrawGrid
Source code excerpt:
// Draw input labels
FCanvasTextItem TextItem( FVector2D::ZeroVector, FText::GetEmpty(), GEditor->GetSmallFont(), GridTextColor );
InNum = FMath::FloorToInt(SharedData->StartIn/InGridSpacing);
while(InNum*InGridSpacing < SharedData->EndIn)
{
// Draw value label
FIntPoint GridPos = CalcScreenPos(FVector2D(InNum*InGridSpacing, 0.f));
#Loc: <Workspace>/Engine/Source/Editor/DistCurveEditor/Private/CurveEditorViewportClient.h:153
Scope (from outer to inner):
file
class class FCurveEditorViewportClient : public FCommonViewportClient
Source code excerpt:
FLinearColor SelectedLabelColor;
FLinearColor GridColor;
FLinearColor GridTextColor;
FLinearColor LabelBlockBkgColor;
FLinearColor SelectedKeyColor;
int32 MouseOverCurveIndex;
int32 MouseOverSubIndex;
int32 MouseOverKeyIndex;
#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Classes/Preferences/CurveEdOptions.h:38
Scope (from outer to inner):
file
class class UCurveEdOptions : public UObject
Source code excerpt:
UPROPERTY(EditAnywhere, config, Category=Options)
FLinearColor GridTextColor;
UPROPERTY(EditAnywhere, config, Category=Options)
FLinearColor LabelBlockBkgColor;
UPROPERTY(EditAnywhere, config, Category=Options)
FLinearColor SelectedKeyColor;
#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/SCurveEditor.cpp:1130
Scope (from outer to inner):
file
function void SCurveEditor::PaintGridLines
Source code excerpt:
const float GridPixelSpacing = FMath::Min(ScaleInfo.WidgetSize.GetMin()/1.5f, MaxGridPixelSpacing);
const FLinearColor GridTextColor = FLinearColor(1.0f,1.0f,1.0f, 0.75f) ;
//Vertical grid(time)
{
float TimeStep = GetTimeStep(ScaleInfo);
float ScreenStepTime = ScaleInfo.InputToLocalX(TimeStep) - ScaleInfo.InputToLocalX(0.0f);
#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/SCurveEditor.cpp:1166
Scope (from outer to inner):
file
function void SCurveEditor::PaintGridLines
Source code excerpt:
FString TimeStr = FString::Printf(TEXT("%.2f"), Time);
FSlateDrawElement::MakeText(OutDrawElements,LayerId,AllottedGeometry.MakeChild(FVector2D(1.0f, ScaleX ), FSlateLayoutTransform(FVector2D(X, 0.0))).ToPaintGeometry(),TimeStr,
FAppStyle::GetFontStyle("CurveEd.InfoFont"), DrawEffects, GridTextColor );
}
LinePoints.Empty();
}
}
}
#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/SCurveEditor.cpp:1217
Scope (from outer to inner):
file
function void SCurveEditor::PaintGridLines
Source code excerpt:
// draw at the start
FSlateDrawElement::MakeText(OutDrawElements,LayerId,AllottedGeometry.MakeChild(FVector2D(ScaleY, 1.0f ), FSlateLayoutTransform(FVector2D(0.0f, Y))).ToPaintGeometry(),
ValueStr, Font, DrawEffects, GridTextColor );
// draw at the last since sometimes start can be hidden
FSlateDrawElement::MakeText(OutDrawElements,LayerId,AllottedGeometry.MakeChild(FVector2D(ScaleY, 1.0f ), FSlateLayoutTransform(FVector2D(AllottedGeometry.GetLocalSize().X-DrawSize.X, Y))).ToPaintGeometry(),
ValueStr, Font, DrawEffects, GridTextColor );
}
LinePoints.Empty();
}
}
}