MajorGridColor

MajorGridColor

#Overview

name: MajorGridColor

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 13 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of MajorGridColor is to define the color of major grid lines in various Unreal Engine 5 editor interfaces, particularly in waveform and curve editors. This setting variable is used to control the visual appearance of the editor’s grid system, making it easier for developers to read and interact with waveforms, curves, and other graphical data.

The MajorGridColor variable is primarily used in the following Unreal Engine subsystems and modules:

  1. WaveformEditorWidgets plugin
  2. WaveTable plugin
  3. CurveEditor module

The value of this variable is typically set in the UWaveformEditorWidgetsSettings class, which is derived from UDeveloperSettings. It is initialized with a default value of FLinearColor::Black in the constructor of UWaveformEditorWidgetsSettings.

MajorGridColor often interacts with other variables, such as:

  1. MinorGridColor: Used for less prominent grid lines, usually set to a more transparent version of MajorGridColor.
  2. WaveformLineThickness: Determines the thickness of waveform lines.
  3. ZeroCrossingLineThickness: Sets the thickness of the zero-crossing line in waveform editors.
  4. RulerBackgroundColor, RulerTicksColor, and RulerTextColor: Used for styling the ruler component in editors.

Developers should be aware of the following when using this variable:

  1. Changing MajorGridColor affects the visibility and contrast of the grid lines against the background and other elements in the editor.
  2. The color should be chosen to provide sufficient contrast with the background and other UI elements for better readability.
  3. MajorGridColor is often used in conjunction with MinorGridColor to create a visual hierarchy in the grid system.

Best practices when using this variable include:

  1. Choose a color that provides good contrast with the background and doesn’t interfere with the visibility of other elements in the editor.
  2. Consider accessibility and ensure that the chosen color works well for users with different visual abilities.
  3. Test the chosen color in different lighting conditions and monitor settings to ensure it remains visible and effective.
  4. When customizing the grid color, maintain a consistent visual style across different parts of the editor interface.
  5. Use the UWaveformEditorWidgetsSettings class to modify this variable, as it provides a centralized location for managing editor appearance settings.

#Setting Variables

#References In INI files

Location: <Workspace>/Engine/Plugins/Editor/WaveformEditor/Config/BaseWaveformEditor.ini:5, section: [/Script/WaveformEditorWidgets.WaveformEditorWidgetsSettings]

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Plugins/Editor/WaveformEditor/Source/WaveformEditorWidgets/Private/WaveformEditorStyle.cpp:95

Scope (from outer to inner):

file
function     void FWaveformEditorStyle::OnWidgetSettingsUpdated

Source code excerpt:

		CreateWaveformViewerStyleFromSettings(*Settings);
	}
	else if (PropertyName == GET_MEMBER_NAME_CHECKED(UWaveformEditorWidgetsSettings, MajorGridColor))
	{
		CreateWaveformViewerStyleFromSettings(*Settings);
	}
	else if (PropertyName == GET_MEMBER_NAME_CHECKED(UWaveformEditorWidgetsSettings, MinorGridColor))
	{
		CreateWaveformViewerStyleFromSettings(*Settings);

#Loc: <Workspace>/Engine/Plugins/Editor/WaveformEditor/Source/WaveformEditorWidgets/Private/WaveformEditorStyle.cpp:155

Scope (from outer to inner):

file
function     FSampledSequenceViewerStyle FWaveformEditorStyle::CreateWaveformViewerStyleFromSettings

Source code excerpt:

		.SetSequenceLineThickness(InSettings.WaveformLineThickness)
		.SetSampleMarkersSize(InSettings.SampleMarkersSize)
		.SetMajorGridLineColor(InSettings.MajorGridColor)
		.SetMinorGridLineColor(InSettings.MinorGridColor)
		.SetZeroCrossingLineColor(InSettings.LoudnessGridColor)
		.SetZeroCrossingLineThickness(InSettings.ZeroCrossingLineThickness);

	OnNewWaveformViewerStyle.Broadcast(WaveViewerStyle);

#Loc: <Workspace>/Engine/Plugins/Editor/WaveformEditor/Source/WaveformEditorWidgets/Private/WaveformEditorWidgetsSettings.cpp:10

Scope (from outer to inner):

file
function     UWaveformEditorWidgetsSettings::UWaveformEditorWidgetsSettings

Source code excerpt:

	, WaveformBackgroundColor(FLinearColor(0.02f, 0.02f, 0.02f, 1.f))
	, ZeroCrossingLineThickness(1.f)
	, MajorGridColor(FLinearColor::Black)
	, MinorGridColor(FLinearColor(0.f, 0.f, 0.f, 0.5f))
	, RulerBackgroundColor(FLinearColor::Black)
	, RulerTicksColor(FLinearColor(1.f, 1.f, 1.f, 0.9f))
	, RulerTextColor(FLinearColor(1.f, 1.f, 1.f, 0.9f))
	, RulerFontSize(10.f)
	, ShowLoudnessGrid(true)

#Loc: <Workspace>/Engine/Plugins/Editor/WaveformEditor/Source/WaveformEditorWidgets/Private/WaveformEditorWidgetsSettings.h:51

Scope (from outer to inner):

file
class        class UWaveformEditorWidgetsSettings : public UDeveloperSettings

Source code excerpt:


	UPROPERTY(config, EditAnywhere, Category = "Waveform Viewer")
	FLinearColor MajorGridColor;
	
	UPROPERTY(config, EditAnywhere, Category = "Waveform Viewer")
	FLinearColor MinorGridColor;

	UPROPERTY(config, EditAnywhere, Category = "Ruler")
	FLinearColor RulerBackgroundColor;

#Loc: <Workspace>/Engine/Plugins/Runtime/WaveTable/Source/WaveTableEditor/Private/WaveTableCurveEditorViewStacked.cpp:650

Scope (from outer to inner):

file
namespace    WaveTable
namespace    Editor
function     SViewStacked::FGridDrawInfo::FGridDrawInfo

Source code excerpt:

			LinePoints.Add(FVector2D(0.f, 0.f));

			MajorGridColor = InGridColor;
			MinorGridColor = InGridColor.CopyWithNewOpacity(InGridColor.A * 0.5f);

			PaintGeometry = InAllottedGeometry->ToPaintGeometry();

			LabelFormat.SetMaximumFractionalDigits(2);
		}

#Loc: <Workspace>/Engine/Plugins/Runtime/WaveTable/Source/WaveTableEditor/Private/WaveTableCurveEditorViewStacked.cpp:693

Scope (from outer to inner):

file
namespace    WaveTable
namespace    Editor
function     FLinearColor SViewStacked::FGridDrawInfo::GetMajorGridColor

Source code excerpt:

		FLinearColor SViewStacked::FGridDrawInfo::GetMajorGridColor() const
		{
			return MajorGridColor;
		}

		FLinearColor SViewStacked::FGridDrawInfo::GetMinorGridColor() const
		{
			return MinorGridColor;
		}

#Loc: <Workspace>/Engine/Plugins/Runtime/WaveTable/Source/WaveTableEditor/Public/WaveTableCurveEditorViewStacked.h:117

Scope (from outer to inner):

file
namespace    WaveTable
namespace    Editor
class        class SViewStacked : public SCurveEditorViewStacked

Source code excerpt:


			private:
				FLinearColor MajorGridColor;
				FLinearColor MinorGridColor;

				int32 BaseLayerId = INDEX_NONE;

				const FCurveModel* CurveModel = nullptr;

#Loc: <Workspace>/Engine/Source/Editor/CurveEditor/Private/Views/SCurveEditorViewStacked.cpp:131

Scope (from outer to inner):

file
function     void SCurveEditorViewStacked::DrawViewGrids

Source code excerpt:

	const float          Width = AllottedGeometry.GetLocalSize().X;
	const float          Height = AllottedGeometry.GetLocalSize().Y;
	const FLinearColor   MajorGridColor = CurveEditor->GetPanel()->GetGridLineTint();
	const FLinearColor   MinorGridColor = MajorGridColor.CopyWithNewOpacity(MajorGridColor.A * .5f);
	const FPaintGeometry PaintGeometry = AllottedGeometry.ToPaintGeometry();
	const FSlateBrush*   WhiteBrush = FAppStyle::GetBrush("WhiteBrush");

	TArray<float> MajorGridLines, MinorGridLines;
	TArray<FText> MajorGridLabels;

#Loc: <Workspace>/Engine/Source/Editor/CurveEditor/Private/Views/SCurveEditorViewStacked.cpp:193

Scope (from outer to inner):

file
function     void SCurveEditorViewStacked::DrawViewGrids

Source code excerpt:

			{
				LinePoints[0].Y = LinePoints[1].Y = GridLineVal;
				FSlateDrawElement::MakeLines(OutDrawElements, GridLineLayerId, PaintGeometry, LinePoints, DrawEffects, MajorGridColor, false);
			}

			// draw minor lines
			for (float GridLineVal : MinorGridLinesH)
			{
				LinePoints[0].Y = LinePoints[1].Y = GridLineVal;

#Loc: <Workspace>/Engine/Source/Editor/CurveEditor/Private/Views/SCurveEditorViewStacked.cpp:218

Scope (from outer to inner):

file
function     void SCurveEditorViewStacked::DrawViewGrids

Source code excerpt:

				{
					LinePoints[0].X = LinePoints[1].X = VerticalLine;
					FSlateDrawElement::MakeLines(OutDrawElements, GridLineLayerId, PaintGeometry, LinePoints, DrawEffects, MajorGridColor, false);
				}
			}

			// Now draw the minor vertical lines which are drawn with a lighter color.
			for (float VerticalLine : MinorGridLines)
			{

#Loc: <Workspace>/Engine/Source/Editor/CurveEditor/Private/Views/SInteractiveCurveEditorView.cpp:288

Scope (from outer to inner):

file
function     void SInteractiveCurveEditorView::DrawGridLines

Source code excerpt:

	const float          RoundedWidth = FMath::RoundToFloat(Width);
	const float          RoundedHeight = FMath::RoundToFloat(Height);
	const FLinearColor   MajorGridColor = CurveEditor->GetPanel()->GetGridLineTint();
	const FLinearColor   MinorGridColor = MajorGridColor.CopyWithNewOpacity(MajorGridColor.A * .5f);
	const FPaintGeometry PaintGeometry = AllottedGeometry.ToPaintGeometry();
	const FLinearColor	 LabelColor = FLinearColor::White.CopyWithNewOpacity(0.65f);
	const FSlateFontInfo FontInfo = FCoreStyle::Get().GetFontStyle("ToolTip.LargerFont");

	// Get our viewing range bounds. We go through the GetBounds() interface on the curve editor because it's more aware of what our range is than the original widget is.
	double InputValueMin, InputValueMax;

#Loc: <Workspace>/Engine/Source/Editor/CurveEditor/Private/Views/SInteractiveCurveEditorView.cpp:353

Scope (from outer to inner):

file
function     void SInteractiveCurveEditorView::DrawGridLines

Source code excerpt:

			LinePoints,
			DrawEffects,
			MajorGridColor,
			false
		);
	}

	LinePoints[0].Y = 0.f;

#Loc: <Workspace>/Engine/Source/Editor/CurveEditor/Private/Views/SInteractiveCurveEditorView.cpp:432

Scope (from outer to inner):

file
function     void SInteractiveCurveEditorView::DrawGridLines

Source code excerpt:

			LinePoints,
			DrawEffects,
			MajorGridColor,
			false
		);
	}

	LinePoints[0].X = 0.f;