ControlRig.Hierarchy.TracePrecision
ControlRig.Hierarchy.TracePrecision
#Overview
name: ControlRig.Hierarchy.TracePrecision
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
sets the number digits in a float when tracing hierarchies.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of ControlRig.Hierarchy.TracePrecision is to control the number of decimal places (digits) used when tracing floating-point values in the Control Rig hierarchy system. This setting is primarily used for debugging and logging purposes within the Control Rig animation system.
This setting variable is utilized by the Control Rig plugin, which is part of Unreal Engine’s animation system. Specifically, it’s used in the RigHierarchy module of the Control Rig system.
The value of this variable is set as a console variable (CVar) with a default value of 3, meaning it will display 3 decimal places by default. It can be changed at runtime through the console or programmatically.
The associated variable CVarControlRigHierarchyTracePrecision directly interacts with ControlRig.Hierarchy.TracePrecision. They are essentially the same thing, with CVarControlRigHierarchyTracePrecision being the C++ representation of the console variable.
Developers should be aware that changing this value affects the precision of float values displayed in traces. Higher precision (more decimal places) can provide more detailed information but may also increase the amount of data generated during tracing.
Best practices when using this variable include:
- Adjust the precision as needed for debugging, but avoid unnecessarily high values to prevent information overload.
- Remember that changing this value only affects the display precision, not the actual precision of calculations.
- Use in conjunction with other tracing variables like ControlRig.Hierarchy.TraceAlways and ControlRig.Hierarchy.TraceCallstack for comprehensive debugging.
Regarding the associated variable CVarControlRigHierarchyTracePrecision:
The purpose of CVarControlRigHierarchyTracePrecision is to provide programmatic access to the ControlRig.Hierarchy.TracePrecision setting within the C++ code.
It’s used in the Control Rig plugin, specifically in the RigHierarchy module.
The value is set when the console variable is initialized, but can be changed at runtime using console commands or programmatically using the CVarControlRigHierarchyTracePrecision->Set() method.
This variable interacts directly with the CheckTraceFormatIfRequired() function in the URigHierarchy class, which updates the trace format string based on the current precision value.
Developers should be aware that changes to this variable will affect all instances of RigHierarchy tracing in the current session.
Best practices include:
- Use GetInt() to read the current value when needed, rather than caching it, to ensure you always have the most up-to-date setting.
- If changing the value programmatically, consider the impact on other systems that may be relying on a specific precision for their traces.
- Use in conjunction with other Control Rig tracing variables for a complete debugging setup.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Plugins/Animation/ControlRig/Source/ControlRig/Private/Rigs/RigHierarchy.cpp:45
Scope: file
Source code excerpt:
static TAutoConsoleVariable<int32> CVarControlRigHierarchyTraceAlways(TEXT("ControlRig.Hierarchy.TraceAlways"), 0, TEXT("if nonzero we will record all transform changes."));
static TAutoConsoleVariable<int32> CVarControlRigHierarchyTraceCallstack(TEXT("ControlRig.Hierarchy.TraceCallstack"), 0, TEXT("if nonzero we will record the callstack for any trace entry.\nOnly works if(ControlRig.Hierarchy.TraceEnabled != 0)"));
static TAutoConsoleVariable<int32> CVarControlRigHierarchyTracePrecision(TEXT("ControlRig.Hierarchy.TracePrecision"), 3, TEXT("sets the number digits in a float when tracing hierarchies."));
static TAutoConsoleVariable<int32> CVarControlRigHierarchyTraceOnSpawn(TEXT("ControlRig.Hierarchy.TraceOnSpawn"), 0, TEXT("sets the number of frames to trace when a new hierarchy is spawned"));
TAutoConsoleVariable<bool> CVarControlRigHierarchyEnableRotationOrder(TEXT("ControlRig.Hierarchy.EnableRotationOrder"), true, TEXT("enables the rotation order for controls"));
TAutoConsoleVariable<bool> CVarControlRigHierarchyEnableModules(TEXT("ControlRig.Hierarchy.Modules"), true, TEXT("enables the modular rigging functionality"));
static int32 sRigHierarchyLastTrace = INDEX_NONE;
static TCHAR sRigHierarchyTraceFormat[16];
#Associated Variable and Callsites
This variable is associated with another variable named CVarControlRigHierarchyTracePrecision
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Plugins/Animation/ControlRig/Source/ControlRig/Private/Rigs/RigHierarchy.cpp:45
Scope: file
Source code excerpt:
static TAutoConsoleVariable<int32> CVarControlRigHierarchyTraceAlways(TEXT("ControlRig.Hierarchy.TraceAlways"), 0, TEXT("if nonzero we will record all transform changes."));
static TAutoConsoleVariable<int32> CVarControlRigHierarchyTraceCallstack(TEXT("ControlRig.Hierarchy.TraceCallstack"), 0, TEXT("if nonzero we will record the callstack for any trace entry.\nOnly works if(ControlRig.Hierarchy.TraceEnabled != 0)"));
static TAutoConsoleVariable<int32> CVarControlRigHierarchyTracePrecision(TEXT("ControlRig.Hierarchy.TracePrecision"), 3, TEXT("sets the number digits in a float when tracing hierarchies."));
static TAutoConsoleVariable<int32> CVarControlRigHierarchyTraceOnSpawn(TEXT("ControlRig.Hierarchy.TraceOnSpawn"), 0, TEXT("sets the number of frames to trace when a new hierarchy is spawned"));
TAutoConsoleVariable<bool> CVarControlRigHierarchyEnableRotationOrder(TEXT("ControlRig.Hierarchy.EnableRotationOrder"), true, TEXT("enables the rotation order for controls"));
TAutoConsoleVariable<bool> CVarControlRigHierarchyEnableModules(TEXT("ControlRig.Hierarchy.Modules"), true, TEXT("enables the modular rigging functionality"));
static int32 sRigHierarchyLastTrace = INDEX_NONE;
static TCHAR sRigHierarchyTraceFormat[16];
#Loc: <Workspace>/Engine/Plugins/Animation/ControlRig/Source/ControlRig/Private/Rigs/RigHierarchy.cpp:4775
Scope (from outer to inner):
file
function void URigHierarchy::CheckTraceFormatIfRequired
Source code excerpt:
void URigHierarchy::CheckTraceFormatIfRequired()
{
if(sRigHierarchyLastTrace != CVarControlRigHierarchyTracePrecision->GetInt())
{
sRigHierarchyLastTrace = CVarControlRigHierarchyTracePrecision->GetInt();
const FString Format = FString::Printf(TEXT("%%.%df"), sRigHierarchyLastTrace);
check(Format.Len() < 16);
sRigHierarchyTraceFormat[Format.Len()] = '\0';
FMemory::Memcpy(sRigHierarchyTraceFormat, *Format, Format.Len() * sizeof(TCHAR));
}
}