p.animdynamics.debugbone
p.animdynamics.debugbone
#Overview
name: p.animdynamics.debugbone
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Filters p.animdynamics.showdebug to a specific bone by name.
It is referenced in 6
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of p.animdynamics.debugbone is to filter the debug drawing of AnimDynamics data to a specific bone by name. This setting variable is part of the debugging and visualization system for the AnimDynamics feature in Unreal Engine 5.
The AnimDynamics system, which is part of the animation runtime module, relies on this setting variable. Specifically, it’s used within the FAnimNode_AnimDynamics class, which is responsible for applying physics-based animation to skeletal meshes.
The value of this variable is set through the console variable system in Unreal Engine. It’s defined as a TAutoConsoleVariable
This variable interacts closely with another console variable, CVarShowDebug (p.animdynamics.showdebug). While CVarShowDebug enables or disables the overall debug drawing for AnimDynamics, p.animdynamics.debugbone filters this debug information to a specific bone.
Developers should be aware that:
- This variable is primarily used for debugging purposes and should not be relied upon for gameplay logic.
- It only has an effect when p.animdynamics.showdebug is set to 1 (enabled).
- The value should be set to the exact name of the bone you want to debug.
Best practices when using this variable include:
- Use it in conjunction with p.animdynamics.showdebug for targeted debugging of AnimDynamics issues.
- Remember to disable it (set to an empty string) when not actively debugging to avoid unnecessary performance overhead.
- Ensure the bone name is spelled correctly and matches the skeleton’s bone naming convention.
Regarding the associated variable CVarDebugBone:
The purpose of CVarDebugBone is to provide a programmatic way to access and modify the p.animdynamics.debugbone setting within the C++ code of Unreal Engine. It’s essentially the internal representation of the console variable.
This variable is used in the AnimGraphRuntime module, specifically within the FAnimNode_AnimDynamics class. It’s used to retrieve the current value of the debug bone filter and apply it in various debug-related functions.
The value of CVarDebugBone is set indirectly through the console variable system when p.animdynamics.debugbone is modified.
CVarDebugBone interacts closely with CVarShowDebug, as mentioned earlier. It’s often used in conjunction with CVarShowDebug to determine whether and what to draw for debug purposes.
Developers should be aware that:
- Changes to CVarDebugBone will affect the behavior of debug drawing in AnimDynamics.
- The value is retrieved using GetValueOnAnyThread() or GetValueOnGameThread(), which may have different thread safety implications.
Best practices when using CVarDebugBone in code include:
- Use it primarily for debug visualization purposes, not for gameplay logic.
- Be mindful of potential performance implications when frequently accessing its value, especially in performance-critical code paths.
- Consider caching the value if it’s accessed frequently within a single frame or update cycle.
#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:64
Scope: file
Source code excerpt:
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;
#Associated Variable and Callsites
This variable is associated with another variable named CVarDebugBone
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/AnimGraphRuntime/Private/BoneControllers/AnimNode_AnimDynamics.cpp:64
Scope: file
Source code excerpt:
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;
#Loc: <Workspace>/Engine/Source/Runtime/AnimGraphRuntime/Private/BoneControllers/AnimNode_AnimDynamics.cpp:84
Scope (from outer to inner):
file
function void FAnimNode_AnimDynamics::DrawBodies
Source code excerpt:
check(Proxy);
const FString FilteredBoneName = CVarDebugBone.GetValueOnAnyThread();
const bool bFilterBone = FilteredBoneName.Len() > 0;
const int32 NumBodies = Bodies.Num();
check(PhysicsBodyDefinitions.Num() >= NumBodies);
#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/Private/BoneControllers/AnimNode_AnimDynamics.cpp:1108
Scope (from outer to inner):
file
function void FAnimNode_AnimDynamics::PreUpdate
Source code excerpt:
if(SkelComp)
{
FString FilteredBoneName = CVarDebugBone.GetValueOnGameThread();
if(FilteredBoneName.Len() > 0)
{
FilteredBoneIndex = SkelComp->GetBoneIndex(FName(*FilteredBoneName));
}
}
#endif
#Loc: <Workspace>/Engine/Source/Runtime/AnimGraphRuntime/Public/BoneControllers/AnimNode_AnimDynamics.h:23
Scope: file
Source code excerpt:
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);
DECLARE_CYCLE_STAT_EXTERN(TEXT("Anim Dynamics Bone Evaluation"), STAT_AnimDynamicsBoneEval, STATGROUP_Physics, ANIMGRAPHRUNTIME_API);