geometry.DynamicMesh.DupeStashTimeout

geometry.DynamicMesh.DupeStashTimeout

#Overview

name: geometry.DynamicMesh.DupeStashTimeout

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 geometry.DynamicMesh.DupeStashTimeout is to control the timeout period for references held by the internal UDynamicMesh duplication helper system. This setting is primarily used in the Geometry Framework module of Unreal Engine 5, specifically for managing the lifecycle of dynamically duplicated meshes.

This setting variable is relied upon by the Geometry Framework module, particularly in the UDynamicMesh class and its associated helper systems.

The value of this variable is set as a console variable (CVar) with a default value of 5*60 seconds (5 minutes). It can be modified at runtime through console commands or programmatically.

The associated variable CVarDynamicMeshDupeHelperTimeout directly interacts with geometry.DynamicMesh.DupeStashTimeout. They share the same value and are used interchangeably in the code.

Developers must be aware that this timeout affects the behavior of the UDynamicMesh duplication system. If a copy operation is performed and a paste is attempted after the timeout period, the mesh might not be found. This could potentially cause issues in scenarios involving large-scale operations or long-running processes.

Best practices when using this variable include:

  1. Adjusting the timeout value for scenarios involving large-scale mesh duplication operations that might exceed the default 5-minute timeout.
  2. Being mindful of the timeout when implementing features that involve copying and pasting UDynamicMesh objects, especially if there might be significant delays between these operations.
  3. Considering the implications of this timeout in multi-threaded or asynchronous operations involving mesh duplication.

Regarding the associated variable CVarDynamicMeshDupeHelperTimeout:

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/GeometryFramework/Private/UDynamicMesh.cpp:24

Scope: file

Source code excerpt:

	TEXT("Triangle count threshold for text-based UDynamicMesh duplication using Base64. Large values are quite slow."));
static TAutoConsoleVariable<int32> CVarDynamicMeshDupeHelperTimeout(
	TEXT("geometry.DynamicMesh.DupeStashTimeout"),
	5*60,
	TEXT("Timeout in seconds for references held by internal UDynamicMesh duplication helper system. See FDynamicMeshCopyHelper."));



UDynamicMesh::UDynamicMesh(const FObjectInitializer& ObjectInitializer)

#Loc: <Workspace>/Engine/Source/Runtime/GeometryFramework/Private/UDynamicMesh.cpp:428

Scope (from outer to inner):

file
function     void UDynamicMesh::ExportCustomProperties

Source code excerpt:

	// result in an correct pasted object, rather than accessing garbage pointers.
	// 
	// FDynamicMeshCopyHelper does attempt to discard "old" references, the CVar geometry.DynamicMesh.DupeStashTimeout 
	// controls the definition of old (currenly 5 minutes). One effect this can have is if one does a
	// copy and then a paste after the timeout, the mesh will not be found. This could also be problematic
	// for large full-scene copies of hundreds of objects that takes longer than the timeout (resolvable via the CVar)
	// 
	// Obviously this does not work between Editor sessions. So we also optionally do a Base64 binary encoding if
	// the mesh triangle count is below a CVar threshold (geometry.DynamicMesh.TextBasedDupeTriThreshold) 

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/GeometryFramework/Private/UDynamicMesh.cpp:23

Scope: file

Source code excerpt:

	1000,
	TEXT("Triangle count threshold for text-based UDynamicMesh duplication using Base64. Large values are quite slow."));
static TAutoConsoleVariable<int32> CVarDynamicMeshDupeHelperTimeout(
	TEXT("geometry.DynamicMesh.DupeStashTimeout"),
	5*60,
	TEXT("Timeout in seconds for references held by internal UDynamicMesh duplication helper system. See FDynamicMeshCopyHelper."));

#Loc: <Workspace>/Engine/Source/Runtime/GeometryFramework/Private/UDynamicMesh.cpp:345

Scope (from outer to inner):

file
namespace    UE
namespace    Local
class        class FDynamicMeshCopyHelper
function     static void DiscardExpiredMeshes

Source code excerpt:

	static void DiscardExpiredMeshes()
	{
		const int32 ExpiryTimeoutInSeconds = CVarDynamicMeshDupeHelperTimeout.GetValueOnGameThread();

		TArray<int32> ToRemove;
		for (TPair<int32, FStashedMesh>& Pair : StashedMeshes)
		{
			if ((FDateTime::Now() - Pair.Value.Timestamp).GetTotalSeconds() > (double)ExpiryTimeoutInSeconds)
			{