a.AnimNode.ControlRig.Debug

a.AnimNode.ControlRig.Debug

#Overview

name: a.AnimNode.ControlRig.Debug

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.ControlRig.Debug is to enable debug drawing for AnimNode_ControlRigBase in the Control Rig animation system. This setting variable is part of Unreal Engine’s animation debugging functionality.

This setting variable is primarily used in the Control Rig plugin, which is part of Unreal Engine’s animation system. Specifically, it’s used in the AnimNode_ControlRigBase class, which is a core component of the Control Rig system.

The value of this variable is set through the console variable system in Unreal Engine. It’s initialized with a default value of 0, which means debug drawing is disabled by default.

The associated variable CVarAnimNodeControlRigDebug directly interacts with a.AnimNode.ControlRig.Debug. They share the same value and purpose.

Developers must be aware that this debug feature is only available when the ENABLE_ANIM_DEBUG macro is defined. This is likely controlled by build configurations, so it may not be available in all build types (e.g., shipping builds).

Best practices when using this variable include:

  1. Only enable it when necessary for debugging, as it may impact performance.
  2. Be aware that it won’t work when the Control Rig is in editing mode (in the Control Rig editor).
  3. Use it in conjunction with other animation debugging tools for a comprehensive view of the animation system’s behavior.

Regarding the associated variable CVarAnimNodeControlRigDebug:

This is the actual console variable object that controls the debug drawing. It’s an instance of TAutoConsoleVariable<int32>, which means it’s an integer value that can be changed at runtime through the console.

The purpose of CVarAnimNodeControlRigDebug is the same as a.AnimNode.ControlRig.Debug - to enable debug drawing for AnimNode_ControlRigBase.

It’s used in the ExecuteControlRig function of FAnimNode_ControlRigBase to determine whether to queue draw instructions for the Control Rig.

Developers should be aware that this variable’s value is checked on any thread (GetValueOnAnyThread()), which means it’s designed for multi-threaded access.

Best practices for using CVarAnimNodeControlRigDebug include:

  1. Use console commands to toggle it on/off during runtime for immediate feedback.
  2. Be cautious about enabling it in performance-critical scenarios, as it may introduce overhead.
  3. Remember that setting it to 1 enables debug drawing, while 0 disables it.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Plugins/Animation/ControlRig/Source/ControlRig/Private/AnimNode_ControlRigBase.cpp:22

Scope: file

Source code excerpt:


#if ENABLE_ANIM_DEBUG
TAutoConsoleVariable<int32> CVarAnimNodeControlRigDebug(TEXT("a.AnimNode.ControlRig.Debug"), 0, TEXT("Set to 1 to turn on debug drawing for AnimNode_ControlRigBase"));
#endif

// CVar to disable control rig execution within an anim node
static TAutoConsoleVariable<int32> CVarControlRigDisableExecutionAnimNode(TEXT("ControlRig.DisableExecutionInAnimNode"), 0, TEXT("if nonzero we disable the execution of Control Rigs inside an anim node."));

FAnimNode_ControlRigBase::FAnimNode_ControlRigBase()

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Plugins/Animation/ControlRig/Source/ControlRig/Private/AnimNode_ControlRigBase.cpp:22

Scope: file

Source code excerpt:


#if ENABLE_ANIM_DEBUG
TAutoConsoleVariable<int32> CVarAnimNodeControlRigDebug(TEXT("a.AnimNode.ControlRig.Debug"), 0, TEXT("Set to 1 to turn on debug drawing for AnimNode_ControlRigBase"));
#endif

// CVar to disable control rig execution within an anim node
static TAutoConsoleVariable<int32> CVarControlRigDisableExecutionAnimNode(TEXT("ControlRig.DisableExecutionInAnimNode"), 0, TEXT("if nonzero we disable the execution of Control Rigs inside an anim node."));

FAnimNode_ControlRigBase::FAnimNode_ControlRigBase()

#Loc: <Workspace>/Engine/Plugins/Animation/ControlRig/Source/ControlRig/Private/AnimNode_ControlRigBase.cpp:498

Scope (from outer to inner):

file
function     void FAnimNode_ControlRigBase::ExecuteControlRig

Source code excerpt:

#if ENABLE_ANIM_DEBUG 
			// When Control Rig is at editing time (in CR editor), draw instructions are consumed by ControlRigEditMode, so we need to skip drawing here.
			bool bShowDebug = (CVarAnimNodeControlRigDebug.GetValueOnAnyThread() == 1 && ControlRig->ExecutionType != ERigExecutionType::Editing);

			if (bShowDebug)
			{ 
				QueueControlRigDrawInstructions(ControlRig, InOutput.AnimInstanceProxy);
			}
#endif