a.AnimNode.FootPlacement.Debug.DrawHistory

a.AnimNode.FootPlacement.Debug.DrawHistory

#Overview

name: a.AnimNode.FootPlacement.Debug.DrawHistory

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 a.AnimNode.FootPlacement.Debug.DrawHistory is to enable and control the visualization debugging for the foot placement history in Unreal Engine’s animation system. This setting variable is specifically designed for debugging the foot placement animation node.

This setting variable is primarily used by the Animation Warping plugin, specifically within the Foot Placement animation node implementation. It’s part of the animation system’s debugging toolkit.

The value of this variable is set through the console variable system in Unreal Engine. It’s defined as a TAutoConsoleVariable with a default value of 0, which means the debugging feature is disabled by default.

The associated variable CVarAnimNodeFootPlacementDebugDrawHistory directly interacts with this setting. They share the same value and are used interchangeably in the code.

Developers must be aware of the following when using this variable:

  1. The variable accepts integer values with specific meanings:

    • 0: Disabled (default)
    • -1: Debug visualization for the pelvis
    • 1: Debug visualization for the specified foot index

  2. The debug lines can be cleared using the FlushPersistentDebugLines command.

  3. This debugging feature is only available in non-shipping builds, as indicated by the #if !UE_BUILD_SHIPPING preprocessor directive.

Best practices when using this variable include:

  1. Use it judiciously, as debug visualization can impact performance.
  2. Remember to disable it (set to 0) when not actively debugging to avoid unnecessary overhead.
  3. Use in conjunction with other foot placement debugging variables (like a.AnimNode.FootPlacement.Debug and a.AnimNode.FootPlacement.Debug.Traces) for comprehensive debugging.
  4. Clear debug lines when necessary to avoid cluttering the view.

Regarding the associated variable CVarAnimNodeFootPlacementDebugDrawHistory: This is the actual console variable object that controls the debug history drawing. It’s used in the FAnimNode_FootPlacement::EvaluateSkeletalControl_AnyThread function to determine whether and how to draw debug lines for the foot placement history. The variable is checked on any thread, which means it can be accessed from multiple threads safely. When enabled, it draws debug lines showing the movement of the pelvis or specific foot, depending on the value set.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Plugins/Animation/AnimationWarping/Source/Runtime/Private/BoneControllers/AnimNode_FootPlacement.cpp:19

Scope: file

Source code excerpt:

static TAutoConsoleVariable<bool> CVarAnimNodeFootPlacementDebug(TEXT("a.AnimNode.FootPlacement.Debug"), false, TEXT("Turn on visualization debugging for Foot Placement"));
static TAutoConsoleVariable<bool> CVarAnimNodeFootPlacementDebugTraces(TEXT("a.AnimNode.FootPlacement.Debug.Traces"), false, TEXT("Turn on visualization debugging for foot ground traces"));
static TAutoConsoleVariable<int> CVarAnimNodeFootPlacementDebugDrawHistory(TEXT("a.AnimNode.FootPlacement.Debug.DrawHistory"), 0,
	TEXT("Turn on history visualization debugging 0 = Disabled, -1 = Pelvis, >1 = Foot Index. Clear with FlushPersistentDebugLines"));
#endif

namespace UE::Anim::FootPlacement
{
	////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Plugins/Animation/AnimationWarping/Source/Runtime/Private/BoneControllers/AnimNode_FootPlacement.cpp:19

Scope: file

Source code excerpt:

static TAutoConsoleVariable<bool> CVarAnimNodeFootPlacementDebug(TEXT("a.AnimNode.FootPlacement.Debug"), false, TEXT("Turn on visualization debugging for Foot Placement"));
static TAutoConsoleVariable<bool> CVarAnimNodeFootPlacementDebugTraces(TEXT("a.AnimNode.FootPlacement.Debug.Traces"), false, TEXT("Turn on visualization debugging for foot ground traces"));
static TAutoConsoleVariable<int> CVarAnimNodeFootPlacementDebugDrawHistory(TEXT("a.AnimNode.FootPlacement.Debug.DrawHistory"), 0,
	TEXT("Turn on history visualization debugging 0 = Disabled, -1 = Pelvis, >1 = Foot Index. Clear with FlushPersistentDebugLines"));
#endif

namespace UE::Anim::FootPlacement
{
	////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

#Loc: <Workspace>/Engine/Plugins/Animation/AnimationWarping/Source/Runtime/Private/BoneControllers/AnimNode_FootPlacement.cpp:1278

Scope (from outer to inner):

file
function     void FAnimNode_FootPlacement::EvaluateSkeletalControl_AnyThread

Source code excerpt:

		if (CVarAnimNodeFootPlacementDebug.GetValueOnAnyThread())
		{
			const int32 DrawIndex = CVarAnimNodeFootPlacementDebugDrawHistory.GetValueOnAnyThread();
			if ((DrawIndex != 0) && !bIsFirstUpdate)
			{
				if (DrawIndex == -1)
				{
					AnimInstanceProxy->AnimDrawDebugLine(LastDebugData.OutputPelvisLocationWS, DebugData.OutputPelvisLocationWS, FColor::Magenta, true, -1.0f, 0.5f);
					AnimInstanceProxy->AnimDrawDebugLine(LastDebugData.InputPelvisLocationWS, DebugData.InputPelvisLocationWS, FColor::Blue, true, -1.0f, 0.5f);