CurveEditor.UseCurveCache
CurveEditor.UseCurveCache
#Overview
name: CurveEditor.UseCurveCache
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
When true we cache curve values, when false we always regenerate.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of CurveEditor.UseCurveCache is to control the caching behavior of curve values in the Curve Editor. It is a console variable that determines whether curve values should be cached or regenerated each time they are needed.
This setting variable is primarily used in the Curve Editor module of Unreal Engine, specifically within the SCurveEditorView class. It affects the performance and behavior of curve editing and rendering in the editor.
The value of this variable is set using a TAutoConsoleVariable, which allows it to be changed at runtime through console commands. By default, it is set to true, meaning curve caching is enabled.
The associated variable CVarUseCurveCache directly interacts with CurveEditor.UseCurveCache. It is the C++ representation of the console variable and is used to access its value within the code.
Developers must be aware that:
- Enabling curve caching (default behavior) can improve performance by avoiding unnecessary regeneration of curve values.
- Disabling curve caching will always regenerate curve values, which might be useful for debugging or ensuring up-to-date values at the cost of performance.
Best practices when using this variable include:
- Leave it enabled (true) for normal development to benefit from improved performance.
- Consider disabling it temporarily if you suspect caching-related issues or need to ensure curve values are always freshly generated.
- Use the console command to toggle this setting during runtime for testing purposes.
Regarding the associated variable CVarUseCurveCache:
- It is a TAutoConsoleVariable
that directly represents CurveEditor.UseCurveCache in C++ code. - Its value is accessed using the GetValueOnGameThread() method, as seen in the CheckCacheAndInvalidateIfNeeded function.
- Developers should use this variable when they need to programmatically check the current state of curve caching within the Curve Editor.
- It’s important to note that changes to this variable will immediately affect the caching behavior of the Curve Editor, potentially impacting performance and curve value accuracy.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Editor/CurveEditor/Private/SCurveEditorView.cpp:23
Scope: file
Source code excerpt:
#include "Templates/UnrealTemplate.h"
TAutoConsoleVariable<bool> CVarUseCurveCache(TEXT("CurveEditor.UseCurveCache"), true, TEXT("When true we cache curve values, when false we always regenerate."));
SCurveEditorView::SCurveEditorView()
: bPinned(0)
, bInteractive(1)
, bFixedOutputBounds(0)
, bAutoSize(1)
#Associated Variable and Callsites
This variable is associated with another variable named CVarUseCurveCache
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Editor/CurveEditor/Private/SCurveEditorView.cpp:23
Scope: file
Source code excerpt:
#include "Templates/UnrealTemplate.h"
TAutoConsoleVariable<bool> CVarUseCurveCache(TEXT("CurveEditor.UseCurveCache"), true, TEXT("When true we cache curve values, when false we always regenerate."));
SCurveEditorView::SCurveEditorView()
: bPinned(0)
, bInteractive(1)
, bFixedOutputBounds(0)
, bAutoSize(1)
#Loc: <Workspace>/Engine/Source/Editor/CurveEditor/Private/SCurveEditorView.cpp:345
Scope (from outer to inner):
file
function void SCurveEditorView::CheckCacheAndInvalidateIfNeeded
Source code excerpt:
return;
}
const bool bUseCurveCache = CVarUseCurveCache.GetValueOnGameThread();
if (bUseCurveCache)
{
//if number of curves have changed, just redo all
if (CurveEditor->GetActiveCurvesSerialNumber() != CachedValues.CachedActiveCurvesSerialNumber)
{