r.Editor.2DGridFade

r.Editor.2DGridFade

#Overview

name: r.Editor.2DGridFade

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

It is referenced in 3 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of r.Editor.2DGridFade is to control the opacity of the grid rendering in 2D viewports within the Unreal Engine editor. This setting variable is primarily used for the editor’s rendering system, specifically for 2D viewport grid visualization.

This setting variable is utilized by the UnrealEd module, which is part of the Unreal Engine editor subsystem. It’s specifically used in the FGridWidget class, which is responsible for rendering the grid in 2D viewports.

The value of this variable is set as a console variable with an initial value of 0.15f. It can be modified at runtime through the console or programmatically.

The r.Editor.2DGridFade variable interacts with another variable called CVarEditor2DGridFade. They share the same value and are used interchangeably in the code.

Developers should be aware that this variable affects the visual appearance of the 2D viewport grid. Changes to this value will impact the grid’s visibility, which could affect the user experience in the editor.

Best practices when using this variable include:

  1. Adjusting it carefully to maintain a balance between grid visibility and clarity of other elements in the viewport.
  2. Consider the impact on different monitor settings and lighting conditions when modifying this value.
  3. Use it in conjunction with other grid-related settings for a cohesive editing experience.

Regarding the associated variable CVarEditor2DGridFade:

The purpose of CVarEditor2DGridFade is the same as r.Editor.2DGridFade - it controls the opacity of the grid rendering in 2D viewports.

This variable is also part of the UnrealEd module and is used in the same contexts as r.Editor.2DGridFade.

The value of CVarEditor2DGridFade is set through the TAutoConsoleVariable template, with an initial value of 0.15f.

CVarEditor2DGridFade interacts directly with r.Editor.2DGridFade, as they share the same value. It’s also used in conjunction with CVarEditor2DSnapFade for grid rendering.

Developers should be aware that modifying CVarEditor2DGridFade will have the same effect as modifying r.Editor.2DGridFade. It’s important to understand that these variables are essentially two ways to access the same setting.

Best practices for CVarEditor2DGridFade are the same as those for r.Editor.2DGridFade. Additionally, developers should be consistent in which variable they use throughout their codebase to avoid confusion.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/EditorComponents.cpp:25

Scope: file

Source code excerpt:


static TAutoConsoleVariable<float> CVarEditor2DGridFade(
	TEXT("r.Editor.2DGridFade"),
	0.15f,
	TEXT("Tweak to define the grid rendering in 2D viewports."),
	ECVF_RenderThreadSafe);

static TAutoConsoleVariable<float> CVarEditor2DSnapFade(
	TEXT("r.Editor.2DSnapFade"),

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/EditorComponents.cpp:24

Scope: file

Source code excerpt:

	ECVF_RenderThreadSafe);

static TAutoConsoleVariable<float> CVarEditor2DGridFade(
	TEXT("r.Editor.2DGridFade"),
	0.15f,
	TEXT("Tweak to define the grid rendering in 2D viewports."),
	ECVF_RenderThreadSafe);

static TAutoConsoleVariable<float> CVarEditor2DSnapFade(

#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/EditorComponents.cpp:192

Scope (from outer to inner):

file
function     void FGridWidget::DrawNewGrid

Source code excerpt:

	else
	{
		MaterialInst->SetVectorParameterValue(GridColorName, FLinearColor(0.6f * Darken, 0.6f * Darken, 0.6f * Darken, CVarEditor2DGridFade.GetValueOnGameThread()));
		MaterialInst->SetVectorParameterValue(SnapColorName, FLinearColor(0.5f, 0.0f, 0.0f, SnapAlphaMultiplier * CVarEditor2DSnapFade.GetValueOnGameThread()));
	}

	// true:1m, false:1dm ios smallest grid size
	bool bLarger1mGrid = true;