r.Editor.2DSnapFade

r.Editor.2DSnapFade

#Overview

name: r.Editor.2DSnapFade

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.2DSnapFade is to control the fade effect of the snap grid in 2D viewports within the Unreal Engine editor. This setting variable is primarily used for adjusting the visual appearance of the grid system in the editor’s 2D views.

This setting variable is utilized by the Unreal Engine’s editor subsystem, specifically within the UnrealEd module. It’s part of the editor’s rendering system for 2D viewports.

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

The r.Editor.2DSnapFade variable interacts with another variable named CVarEditor2DSnapFade. They share the same value and are used interchangeably in the code.

Developers should be aware that this variable affects the visual feedback of the snap grid in 2D viewports. Adjusting this value will change the opacity of the snap grid lines, which can impact the visibility and usability of the grid system for level designers and artists working in 2D views.

Best practices when using this variable include:

  1. Adjusting the value to find a balance between grid visibility and non-intrusiveness.
  2. Considering the needs of level designers and artists when modifying this value.
  3. Testing different values in various lighting conditions to ensure the grid remains visible but not distracting.

Regarding the associated variable CVarEditor2DSnapFade:

The purpose of CVarEditor2DSnapFade is identical to r.Editor.2DSnapFade, as they share the same value and functionality.

It is defined in the UnrealEd module and is used within the FGridWidget::DrawNewGrid function to set the snap color parameter in the material instance used for grid rendering.

The value of CVarEditor2DSnapFade is retrieved using the GetValueOnGameThread() method, indicating that it’s safe to access from the game thread.

Developers should be aware that modifying CVarEditor2DSnapFade will have the same effect as modifying r.Editor.2DSnapFade. They should use whichever variable name is more appropriate for their context, maintaining consistency in their codebase.

Best practices for CVarEditor2DSnapFade are the same as those for r.Editor.2DSnapFade, focusing on balancing grid visibility and usability in 2D viewports.

#References in C++ code

#Callsites

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

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

Scope: file

Source code excerpt:


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

static TAutoConsoleVariable<float> CVarEditor3DGridFade(
	TEXT("r.Editor.3DGridFade"),

#Associated Variable and Callsites

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

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

Scope: file

Source code excerpt:

	ECVF_RenderThreadSafe);

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

static TAutoConsoleVariable<float> CVarEditor3DGridFade(

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

Scope (from outer to inner):

file
function     void FGridWidget::DrawNewGrid

Source code excerpt:

	{
		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;

	const int Exponent = 10;