RigVM.EnablePostLoadHashing

RigVM.EnablePostLoadHashing

#Overview

name: RigVM.EnablePostLoadHashing

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 RigVM.EnablePostLoadHashing is to optimize the loading process of RigVM graphs by enabling a hashing mechanism that can skip unnecessary refreshing of RigVMGraphs.

This setting variable is primarily used in the RigVM plugin, which is part of Unreal Engine’s animation and rigging system. Specifically, it’s used in the RigVMDeveloper module.

The value of this variable is set through a console variable (CVarRigVMEnablePostLoadHashing) in the RigVMBlueprint.cpp file. It’s initialized with a default value of true.

The associated variable CVarRigVMEnablePostLoadHashing directly interacts with RigVM.EnablePostLoadHashing. They share the same value and purpose.

Developers must be aware that:

  1. This variable affects the post-load behavior of RigVM graphs.
  2. When enabled (default), it can significantly improve load times by avoiding unnecessary refreshing of RigVMGraphs.
  3. It works by comparing the current structure hash with the serialized structure hash.

Best practices when using this variable:

  1. Keep it enabled (default) for better performance, especially in projects with complex or numerous RigVM graphs.
  2. If experiencing unexpected behavior in RigVM graphs after loading, consider disabling this feature temporarily for debugging purposes.
  3. Be cautious when modifying RigVM graphs, as changes might not be immediately reflected if the hashes match.

Regarding the associated variable CVarRigVMEnablePostLoadHashing:

The purpose of CVarRigVMEnablePostLoadHashing is to provide runtime control over the RigVM.EnablePostLoadHashing feature.

It’s used in the RigVMDeveloper module of the RigVM plugin, specifically in the URigVMBlueprint class.

The value is set using the TAutoConsoleVariable template, which allows it to be changed at runtime through console commands.

This variable directly controls the behavior described for RigVM.EnablePostLoadHashing. It’s checked in the RefreshAllModels function of URigVMBlueprint to determine whether to skip refreshing RigVMGraphs.

Developers should be aware that:

  1. This variable can be changed at runtime, allowing for dynamic optimization adjustments.
  2. It affects the performance and behavior of RigVM graph loading and refreshing.

Best practices for using CVarRigVMEnablePostLoadHashing:

  1. Use console commands to toggle this feature on/off for performance testing.
  2. Monitor its impact on load times and graph behavior in different scenarios.
  3. Consider exposing this setting in debug menus for easier toggling during development.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Plugins/Runtime/RigVM/Source/RigVMDeveloper/Private/RigVMBlueprint.cpp:46

Scope: file

Source code excerpt:


TAutoConsoleVariable<bool> CVarRigVMEnablePostLoadHashing(
	TEXT("RigVM.EnablePostLoadHashing"),
	true,
	TEXT("When true refreshing the RigVMGraphs will be skipped if the hash matches the serialized hash."));

static TArray<UClass*> GetClassObjectsInPackage(UPackage* InPackage)
{
	TArray<UObject*> Objects;

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Plugins/Runtime/RigVM/Source/RigVMDeveloper/Private/RigVMBlueprint.cpp:45

Scope: file

Source code excerpt:

	TEXT("When true the RigVMGraphs will be skipped during preload to speed up load times."));

TAutoConsoleVariable<bool> CVarRigVMEnablePostLoadHashing(
	TEXT("RigVM.EnablePostLoadHashing"),
	true,
	TEXT("When true refreshing the RigVMGraphs will be skipped if the hash matches the serialized hash."));

static TArray<UClass*> GetClassObjectsInPackage(UPackage* InPackage)
{

#Loc: <Workspace>/Engine/Plugins/Runtime/RigVM/Source/RigVMDeveloper/Private/RigVMBlueprint.cpp:1360

Scope (from outer to inner):

file
function     void URigVMBlueprint::RefreshAllModels

Source code excerpt:


	// avoid any compute if the current structure hashes match with the serialized ones
	if(CVarRigVMEnablePostLoadHashing->GetBool() && RigVMClient.GetStructureHash() == RigVMClient.GetSerializedStructureHash())
	{
		if(bIsPostLoad)
		{
			TArray<URigVMGraph*> ModelGraphs = RigVMClient.GetAllModels(true, true);
			Algo::Reverse(ModelGraphs);
			for (URigVMGraph* ModelGraph : ModelGraphs)