CurveEditor.DrawCurveLines

CurveEditor.DrawCurveLines

#Overview

name: CurveEditor.DrawCurveLines

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.DrawCurveLines is to control the visibility of curve lines in the Unreal Engine’s Curve Editor. This setting variable is used to determine whether curve lines should be drawn or not in the curve editor interface.

This setting variable is primarily used in the Curve Editor module of Unreal Engine. Based on the callsites, it’s clear that this variable is utilized in the interactive curve editor view, which is part of the editor’s curve editing functionality.

The value of this variable is set through a console variable (CVar) system. It’s initialized with a default value of true, meaning curve lines are drawn by default. The value can be changed at runtime through console commands or programmatically.

The associated variable CVarDrawCurveLines directly interacts with CurveEditor.DrawCurveLines. They share the same value and purpose. There’s also another related variable, CVarDrawCurveKeys, which controls the visibility of curve keys.

Developers should be aware that this variable affects the visual representation of curves in the Curve Editor. When set to false, curve lines will not be drawn, which might impact the user’s ability to visualize the curve shape.

Best practices when using this variable include:

  1. Consider the impact on user experience before changing the default value.
  2. If disabling curve lines, ensure that other visual cues (like curve keys) are sufficient for users to understand the curve shape.
  3. Use this in conjunction with CVarDrawCurveKeys to provide the most appropriate visualization for your specific use case.

Regarding the associated variable CVarDrawCurveLines:

The purpose of CVarDrawCurveLines is identical to CurveEditor.DrawCurveLines. It’s the C++ representation of the console variable that controls curve line visibility in the Curve Editor.

This variable is used in the SInteractiveCurveEditorView class, specifically in the DrawCurves function. It determines whether the curve lines should be drawn during the rendering process of the curve editor view.

The value of CVarDrawCurveLines is set when the TAutoConsoleVariable is initialized, but it can be changed at runtime using console commands or through C++ code.

CVarDrawCurveLines interacts closely with CVarDrawCurveKeys, as they both control aspects of curve visualization.

Developers should be aware that changes to CVarDrawCurveLines will immediately affect the curve editor’s visual output. They should also note that the value is retrieved on the game thread (GetValueOnGameThread()), which could have performance implications if called frequently.

Best practices for CVarDrawCurveLines include:

  1. Use it in conjunction with CVarDrawCurveKeys for comprehensive control over curve visualization.
  2. Consider caching the value if it’s accessed frequently to avoid potential performance issues from repeated game thread access.
  3. Provide user-facing options in the editor UI to toggle this setting if curve line visibility is an important feature for your users.

#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:71

Scope: file

Source code excerpt:

class FWidgetStyle;

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 CVarDrawCurveLines. They share the same value. See the following C++ source code.

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

Scope: file

Source code excerpt:

class FWidgetStyle;

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:473

Scope (from outer to inner):

file
function     void SInteractiveCurveEditorView::DrawCurves

Source code excerpt:

	const bool  bAntiAliasCurves = true;

	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();