p.animdynamics.showdebug

p.animdynamics.showdebug

#Overview

name: p.animdynamics.showdebug

This variable is created as a Console Variable (cvar).

It is referenced in 4 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of p.animdynamics.showdebug is to enable or disable the drawing of animation dynamics data for debugging purposes in Unreal Engine 5. This setting variable is primarily used for the animation system, specifically for the AnimDynamics feature.

The Unreal Engine subsystem that relies on this setting variable is the AnimGraphRuntime module, which is part of the animation system. This can be seen from the file path where the variable is defined and used: Engine/Source/Runtime/AnimGraphRuntime/.

The value of this variable is set through a console command. It is defined as a TAutoConsoleVariable with an initial value of 0, which means the debug drawing is disabled by default.

There is an associated variable named CVarShowDebug that directly interacts with p.animdynamics.showdebug. They share the same value and are used interchangeably in the code.

Developers must be aware that this variable is only effective when the ENABLE_ANIM_DRAW_DEBUG macro is defined. This suggests that the debug drawing functionality might be conditionally compiled, possibly only available in development or debug builds.

Best practices when using this variable include:

  1. Use it only for debugging purposes, as it may impact performance.
  2. Be aware that it works in conjunction with another console variable, p.animdynamics.debugbone, which filters the debug drawing to a specific bone.
  3. Remember to disable it (set to 0) when not needed to avoid unnecessary performance overhead.

Regarding the associated variable CVarShowDebug:

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/AnimGraphRuntime/Private/BoneControllers/AnimNode_AnimDynamics.cpp:63

Scope: file

Source code excerpt:

#if ENABLE_ANIM_DRAW_DEBUG

TAutoConsoleVariable<int32> CVarShowDebug(TEXT("p.animdynamics.showdebug"), 0, TEXT("Enable/disable the drawing of animdynamics data."));
TAutoConsoleVariable<FString> CVarDebugBone(TEXT("p.animdynamics.debugbone"), FString(), TEXT("Filters p.animdynamics.showdebug to a specific bone by name."));

void FAnimNode_AnimDynamics::DrawBodies(FComponentSpacePoseContext& InContext, const TArray<FAnimPhysRigidBody*>& InBodies)
{
	if(CVarShowDebug.GetValueOnAnyThread() == 0)
	{

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/AnimGraphRuntime/Private/BoneControllers/AnimNode_AnimDynamics.cpp:63

Scope: file

Source code excerpt:

#if ENABLE_ANIM_DRAW_DEBUG

TAutoConsoleVariable<int32> CVarShowDebug(TEXT("p.animdynamics.showdebug"), 0, TEXT("Enable/disable the drawing of animdynamics data."));
TAutoConsoleVariable<FString> CVarDebugBone(TEXT("p.animdynamics.debugbone"), FString(), TEXT("Filters p.animdynamics.showdebug to a specific bone by name."));

void FAnimNode_AnimDynamics::DrawBodies(FComponentSpacePoseContext& InContext, const TArray<FAnimPhysRigidBody*>& InBodies)
{
	if(CVarShowDebug.GetValueOnAnyThread() == 0)
	{
		return;
	}

	auto ToWorldV = [this](FComponentSpacePoseContext& InPoseContext, const FVector& SimLocation)
	{

#Loc: <Workspace>/Engine/Source/Runtime/AnimGraphRuntime/Private/BoneControllers/AnimNode_AnimDynamics.cpp:1035

Scope (from outer to inner):

file
function     bool FAnimNode_AnimDynamics::HasPreUpdate

Source code excerpt:

		return (CVarEnableWind.GetValueOnAnyThread() == 1 && (bEnableWind || bWindWasEnabled))
#if ENABLE_ANIM_DRAW_DEBUG
				|| (CVarShowDebug.GetValueOnAnyThread() == 1 && !CVarDebugBone.GetValueOnAnyThread().IsEmpty())
#endif
				;
	}

	return false;
}

#Loc: <Workspace>/Engine/Source/Runtime/AnimGraphRuntime/Public/BoneControllers/AnimNode_AnimDynamics.h:22

Scope: file

Source code excerpt:

#if ENABLE_ANIM_DRAW_DEBUG

extern TAutoConsoleVariable<int32> CVarShowDebug;
extern TAutoConsoleVariable<FString> CVarDebugBone;

#endif

DECLARE_CYCLE_STAT_EXTERN(TEXT("Anim Dynamics Overall"), STAT_AnimDynamicsOverall, STATGROUP_Physics, ANIMGRAPHRUNTIME_API);
DECLARE_CYCLE_STAT_EXTERN(TEXT("Anim Dynamics Wind Data Update"), STAT_AnimDynamicsWindData, STATGROUP_Physics, ANIMGRAPHRUNTIME_API);