CurveEditor.DrawCurveKeys

CurveEditor.DrawCurveKeys

#Overview

name: CurveEditor.DrawCurveKeys

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 CurveEditor.DrawCurveKeys is to control the visibility of curve keys in the Curve Editor of Unreal Engine 5. This setting variable is used to determine whether curve keys should be drawn or not in the editor’s visual representation of curves.

This setting variable is primarily used in the Curve Editor module of Unreal Engine 5. Based on the callsites provided, it’s specifically utilized in the interactive curve editor view implementation.

The value of this variable is set as a console variable (CVar) with a default value of true. It can be modified at runtime through the console or programmatically.

CurveEditor.DrawCurveKeys interacts closely with another variable, CurveEditor.DrawCurveLines. These two variables work together to control the visual representation of curves in the editor.

Developers should be aware that this variable directly affects the visibility of curve keys in the Curve Editor. When set to false, curve keys will not be rendered, which might impact the user’s ability to edit curves visually.

Best practices when using this variable include:

  1. Considering the impact on user experience when modifying its value.
  2. Ensuring that disabling curve key rendering doesn’t negatively affect curve editing workflows.
  3. Using it in conjunction with CurveEditor.DrawCurveLines to provide a consistent visual experience.

Regarding the associated variable CVarDrawCurveKeys:

The purpose of CVarDrawCurveKeys is to serve as the internal representation of the CurveEditor.DrawCurveKeys console variable within the C++ code of Unreal Engine 5.

This variable is used in the same Curve Editor module, specifically within the SInteractiveCurveEditorView class.

The value of CVarDrawCurveKeys is set by the engine based on the CurveEditor.DrawCurveKeys console variable. It’s typically accessed using the GetValueOnGameThread() method.

CVarDrawCurveKeys interacts directly with the CurveEditor.DrawCurveKeys console variable and is used in conjunction with CVarDrawCurveLines to control curve rendering.

Developers should be aware that this is the actual variable used in the C++ code to determine whether to draw curve keys. Any changes to the console variable will be reflected in this variable.

Best practices for using CVarDrawCurveKeys include:

  1. Accessing its value using GetValueOnGameThread() to ensure thread-safe operations.
  2. Considering performance implications when frequently checking this variable’s value.
  3. Using it in tandem with CVarDrawCurveLines for consistent curve rendering behavior.

#References in C++ code

#Callsites

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

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

Scope: file

Source code excerpt:


TAutoConsoleVariable<bool> CVarDrawCurveLines(TEXT("CurveEditor.DrawCurveLines"), true, TEXT("When true we draw curve lines, when false we do not."));
TAutoConsoleVariable<bool> CVarDrawCurveKeys(TEXT("CurveEditor.DrawCurveKeys"), true, TEXT("When true we draw curve keys, when false we do not."));

namespace CurveViewConstants
{
	/** The number of pixels to offset Labels from the Left/Right size. */
	constexpr float LabelOffsetPixels = 2.f;

#Associated Variable and Callsites

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

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

Scope: file

Source code excerpt:


TAutoConsoleVariable<bool> CVarDrawCurveLines(TEXT("CurveEditor.DrawCurveLines"), true, TEXT("When true we draw curve lines, when false we do not."));
TAutoConsoleVariable<bool> CVarDrawCurveKeys(TEXT("CurveEditor.DrawCurveKeys"), true, TEXT("When true we draw curve keys, when false we do not."));

namespace CurveViewConstants
{
	/** The number of pixels to offset Labels from the Left/Right size. */
	constexpr float LabelOffsetPixels = 2.f;

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

Scope (from outer to inner):

file
function     void SInteractiveCurveEditorView::DrawCurves

Source code excerpt:


	const bool bDrawLines = CVarDrawCurveLines.GetValueOnGameThread();
	const bool bDrawKeys = CVarDrawCurveKeys.GetValueOnGameThread();

	TOptional<FCurveModelID> HoveredCurve = GetHoveredCurve();
	for (const FCurveDrawParams& Params : CachedDrawParams)
	{
		const bool bIsCurveHovered = HoveredCurve.IsSet() && HoveredCurve.GetValue() == Params.GetID();
		const float Thickness = bIsCurveHovered ? HoveredCurveThickness : UnHoveredCurveThickness;