p.RigidBodyNode.InitializeBoneReferencesRangeCheckEnabled
p.RigidBodyNode.InitializeBoneReferencesRangeCheckEnabled
#Overview
name: p.RigidBodyNode.InitializeBoneReferencesRangeCheckEnabled
This variable is created as a Console Variable (cvar).
- type:
Var
- help: ``
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of p.RigidBodyNode.InitializeBoneReferencesRangeCheckEnabled is to provide a temporary solution to avoid out-of-bounds access issues in the RigidBody animation node system, specifically during the initialization of bone references.
This setting variable is primarily used in the animation system, specifically within the AnimGraphRuntime module. It’s part of the bone controller system, focusing on the RigidBody animation node.
The value of this variable is set through a console variable (CVar) system. It’s initialized to true and can be modified at runtime through console commands.
The associated variable bRBAN_InitializeBoneReferencesRangeCheckEnabled directly interacts with it. They share the same value, with the console variable acting as an interface to modify the actual boolean used in the code.
Developers must be aware that this is a temporary solution, as indicated by the comment “Temporary to avoid out of bounds access issue”. It’s likely that a more permanent fix is planned or should be implemented.
Best practices when using this variable include:
- Understand that it’s a temporary solution and not rely on it for long-term code stability.
- Monitor its usage and the scenarios where it prevents out-of-bounds access.
- Consider investigating and addressing the root cause of the out-of-bounds access issues instead of relying solely on this check.
- Be cautious when disabling this check, as it may lead to out-of-bounds access and potential crashes.
Regarding the associated variable bRBAN_InitializeBoneReferencesRangeCheckEnabled:
Its purpose is to actually perform the range check within the InitializeBoneReferences function of the FAnimNode_RigidBody class.
It’s used directly in the AnimGraphRuntime module, specifically in the RigidBody animation node implementation.
The value is set by the console variable p.RigidBodyNode.InitializeBoneReferencesRangeCheckEnabled.
When this variable is true, it enables additional error checking and logging for out-of-bounds access to the BodyAnimData array.
Developers should be aware that this check might impact performance, albeit likely minimally. It’s important to balance the need for error checking with performance considerations.
Best practices include:
- Use this variable for debugging and development builds.
- Consider disabling it in release builds if performance is critical and the out-of-bounds issues have been resolved.
- Use the logging information provided when the check fails to identify and fix the root causes of out-of-bounds access.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/AnimGraphRuntime/Private/BoneControllers/AnimNode_RigidBody.cpp:105
Scope: file
Source code excerpt:
// Temporary to avoid out of bounds access issue
bool bRBAN_InitializeBoneReferencesRangeCheckEnabled = true;
FAutoConsoleVariableRef CVarRigidBodyNodeInitializeBoneReferencesRangeCheckEnabled(TEXT("p.RigidBodyNode.InitializeBoneReferencesRangeCheckEnabled"), bRBAN_InitializeBoneReferencesRangeCheckEnabled, TEXT(""), ECVF_Default);
// Array of priorities that can be indexed into with CVars, since task priorities cannot be set from scalability .ini
static UE::Tasks::ETaskPriority GRigidBodyNodeTaskPriorities[] =
{
UE::Tasks::ETaskPriority::High,
#Associated Variable and Callsites
This variable is associated with another variable named bRBAN_InitializeBoneReferencesRangeCheckEnabled
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/AnimGraphRuntime/Private/BoneControllers/AnimNode_RigidBody.cpp:104
Scope: file
Source code excerpt:
// Temporary to avoid out of bounds access issue
bool bRBAN_InitializeBoneReferencesRangeCheckEnabled = true;
FAutoConsoleVariableRef CVarRigidBodyNodeInitializeBoneReferencesRangeCheckEnabled(TEXT("p.RigidBodyNode.InitializeBoneReferencesRangeCheckEnabled"), bRBAN_InitializeBoneReferencesRangeCheckEnabled, TEXT(""), ECVF_Default);
// Array of priorities that can be indexed into with CVars, since task priorities cannot be set from scalability .ini
static UE::Tasks::ETaskPriority GRigidBodyNodeTaskPriorities[] =
{
UE::Tasks::ETaskPriority::High,
#Loc: <Workspace>/Engine/Source/Runtime/AnimGraphRuntime/Private/BoneControllers/AnimNode_RigidBody.cpp:1827
Scope (from outer to inner):
file
function void FAnimNode_RigidBody::InitializeBoneReferences
Source code excerpt:
{
// Avoid and track down issues with out-of-bounds access of BodyAnimData
if (bRBAN_InitializeBoneReferencesRangeCheckEnabled)
{
if (!ensure(BodyAnimData.IsValidIndex(BodyIndex)))
{
UE_LOG(LogRBAN, Warning, TEXT("FAnimNode_RigidBody::InitializeBoneReferences: BodyIndex out of range. BodyIndex=%d/%d, SkeletonBoneIndex=%d/%d, CompactPoseBoneIndex=%d, RequiredBoneIndex=%d"),
BodyIndex, BodyAnimData.Num(), SkeletonBoneIndex, SkeletonBoneIndexToBodyIndex.Num(), CompactPoseBoneIndex.GetInt(), Index);