geometry.DynamicMesh.EnableDebugMeshes

geometry.DynamicMesh.EnableDebugMeshes

#Overview

name: geometry.DynamicMesh.EnableDebugMeshes

This variable is created as a Console Variable (cvar).

It is referenced in 5 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of geometry.DynamicMesh.EnableDebugMeshes is to enable or disable the FDynamicMesh3 Global Debug Mesh support in Unreal Engine 5. This setting is specifically for debugging purposes in the geometry system, particularly for dynamic meshes.

This setting variable is primarily used in the GeometryCore module of Unreal Engine 5, specifically within the DynamicMesh subsystem. It’s part of the debugging infrastructure for the geometry system.

The value of this variable is set through a console variable (CVar) system. It’s defined as a TAutoConsoleVariable<bool> with a default value of false, meaning it’s disabled by default.

The associated variable CVarDynamicMeshDebugMeshesEnabled directly interacts with this setting. They share the same value and are used interchangeably in the code.

Developers must be aware of several important points when using this variable:

  1. This debug feature is only available in the Editor, not in runtime builds.
  2. When disabled, attempts to use debug mesh functions will result in warning messages in the log.
  3. Enabling this variable allows for storing, retrieving, and clearing debug meshes.

Best practices for using this variable include:

  1. Only enable it when actively debugging geometry issues, as it may have performance implications.
  2. Use it in conjunction with the geometry.DynamicMesh.ClearDebugMeshes console command to manage debug meshes.
  3. Be aware that this setting affects global behavior, so it should be used cautiously in multi-user development environments.

Regarding the associated variable CVarDynamicMeshDebugMeshesEnabled:

When working with CVarDynamicMeshDebugMeshesEnabled, developers should:

  1. Use it to conditionally execute debug-related code.
  2. Be aware that it affects the behavior of functions like ClearAllDebugMeshes(), StashDebugMesh(), and FetchDebugMesh().
  3. Consider wrapping debug mesh operations in preprocessor conditions (like #if WITH_EDITOR) to ensure they’re not compiled into non-editor builds.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/GeometryCore/Private/DynamicMesh/DynamicMesh3.cpp:1350

Scope: file

Source code excerpt:


static TAutoConsoleVariable<bool> CVarDynamicMeshDebugMeshesEnabled(
	TEXT("geometry.DynamicMesh.EnableDebugMeshes"),
	false,
	TEXT("Enable/Disable FDynamicMesh3 Global Debug Mesh support. Debug Mesh support is only available in the Editor."));

static FAutoConsoleCommand DynamicMeshClearDebugMeshesCmd(
	TEXT("geometry.DynamicMesh.ClearDebugMeshes"),
	TEXT("Discard all debug meshes currently stored in the FDynamicMesh3 Global Debug Mesh set. This command only works in the Editor."),

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/GeometryCore/Private/DynamicMesh/DynamicMesh3.cpp:1349

Scope: file

Source code excerpt:



static TAutoConsoleVariable<bool> CVarDynamicMeshDebugMeshesEnabled(
	TEXT("geometry.DynamicMesh.EnableDebugMeshes"),
	false,
	TEXT("Enable/Disable FDynamicMesh3 Global Debug Mesh support. Debug Mesh support is only available in the Editor."));

static FAutoConsoleCommand DynamicMeshClearDebugMeshesCmd(
	TEXT("geometry.DynamicMesh.ClearDebugMeshes"),

#Loc: <Workspace>/Engine/Source/Runtime/GeometryCore/Private/DynamicMesh/DynamicMesh3.cpp:1370

Scope (from outer to inner):

file
function     void UE::Geometry::Debug::ClearAllDebugMeshes

Source code excerpt:

{
#if WITH_EDITOR
	if (CVarDynamicMeshDebugMeshesEnabled.GetValueOnAnyThread() == false )
	{
		UE_LOG(LogGeometry, Warning, TEXT("ClearAllDebugMeshes() called but geometry.DynamicMesh.EnableDebugMeshes CVar is disabled"));
		return;
	}

	UELocal::GlobalDebugMeshes.Reset();

#Loc: <Workspace>/Engine/Source/Runtime/GeometryCore/Private/DynamicMesh/DynamicMesh3.cpp:1385

Scope (from outer to inner):

file
function     void UE::Geometry::Debug::StashDebugMesh

Source code excerpt:

{
#if WITH_EDITOR
	if (CVarDynamicMeshDebugMeshesEnabled.GetValueOnAnyThread() == false )
	{
		UE_LOG(LogGeometry, Warning, TEXT("StashDebugMesh() called but geometry.DynamicMesh.EnableDebugMeshes CVar is disabled"))
		return;
	}

	UELocal::GlobalDebugMeshes.Add( DebugMeshName, MakeUnique<FDynamicMesh3>(Mesh) );

#Loc: <Workspace>/Engine/Source/Runtime/GeometryCore/Private/DynamicMesh/DynamicMesh3.cpp:1400

Scope (from outer to inner):

file
function     bool UE::Geometry::Debug::FetchDebugMesh

Source code excerpt:

{
#if WITH_EDITOR
	if (CVarDynamicMeshDebugMeshesEnabled.GetValueOnAnyThread() == false )
	{
		UE_LOG(LogGeometry, Warning, TEXT("FetchDebugMesh() called but geometry.DynamicMesh.EnableDebugMeshes CVar is disabled"));
		return false;
	}

	TUniquePtr<FDynamicMesh3>* FoundMesh = UELocal::GlobalDebugMeshes.Find(DebugMeshName);