LayoutUV.TracePackingForInputHash

LayoutUV.TracePackingForInputHash

#Overview

name: LayoutUV.TracePackingForInputHash

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 LayoutUV.TracePackingForInputHash is to enable tracing for a specific input hash during the UV layout process in Unreal Engine’s mesh utilities system. This setting is primarily used for debugging and development purposes.

This setting variable is used in the MeshUtilitiesCommon module, specifically in the LayoutUV functionality. It’s part of the mesh processing and UV unwrapping system in Unreal Engine.

The value of this variable is set through a console variable (CVar) system. It can be modified at runtime or set in configuration files.

The associated variable CVarLayoutUVTracePackingForInputHash directly interacts with LayoutUV.TracePackingForInputHash. They share the same value and purpose.

Developers must be aware that:

  1. This variable is only available in editor builds and in development or debug configurations.
  2. It’s designed for tracing specific input hashes, which can be useful for debugging UV layout issues.
  3. The variable expects a string value representing the input hash to trace.

Best practices when using this variable include:

  1. Use it sparingly and only when debugging specific UV layout issues.
  2. Ensure that the input hash provided is correct and matches the expected format.
  3. Remember to disable tracing when it’s no longer needed to avoid performance impacts.

Regarding the associated variable CVarLayoutUVTracePackingForInputHash:

Its purpose is to store and provide access to the LayoutUV.TracePackingForInputHash value within the C++ code.

It’s defined as a TAutoConsoleVariable, which means it’s a console variable that can be modified at runtime.

The value is set to an empty string by default, and it can be accessed using the GetValueOnAnyThread() method.

Developers should be aware that this variable is only defined in editor builds and in development or debug configurations, similar to LayoutUV.TracePackingForInputHash.

When using this variable, best practices include:

  1. Access the value using GetValueOnAnyThread() to ensure thread-safe access.
  2. Use the TrimStartAndEnd() function on the retrieved value to remove any leading or trailing whitespace.
  3. Check the length of the retrieved value to determine if tracing is enabled.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/MeshUtilitiesCommon/Private/LayoutUV.cpp:677

Scope: file

Source code excerpt:

#if UE_EDITOR && (UE_BUILD_DEVELOPMENT || UE_BUILD_DEBUG)
static TAutoConsoleVariable<FString> CVarLayoutUVTracePackingForInputHash(
	TEXT("LayoutUV.TracePackingForInputHash"),
	TEXT(""),
	TEXT("Activate tracing for the input hash specified in the value.\n"),
	ECVF_Default);
#endif

bool FLayoutUV::FChartPacker::FindBestPacking(const TArray< FVector2f >& TexCoords, const TArray< uint32 >& SortedTris, TArray< FMeshChart >& Charts)

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/MeshUtilitiesCommon/Private/LayoutUV.cpp:676

Scope: file

Source code excerpt:


#if UE_EDITOR && (UE_BUILD_DEVELOPMENT || UE_BUILD_DEBUG)
static TAutoConsoleVariable<FString> CVarLayoutUVTracePackingForInputHash(
	TEXT("LayoutUV.TracePackingForInputHash"),
	TEXT(""),
	TEXT("Activate tracing for the input hash specified in the value.\n"),
	ECVF_Default);
#endif

#Loc: <Workspace>/Engine/Source/Runtime/MeshUtilitiesCommon/Private/LayoutUV.cpp:720

Scope (from outer to inner):

file
function     bool FLayoutUV::FChartPacker::FindBestPacking

Source code excerpt:

	// after changing the algorithm. You can set this CVar to activate tracing for a particular
	// input hash.
	FString InputHashTrace = CVarLayoutUVTracePackingForInputHash.GetValueOnAnyThread().TrimStartAndEnd();
	const bool bTrace = InputHashTrace.Len() > 0 && InputHash.StartsWith(InputHashTrace);
#else
	const bool bTrace = false;
#endif

	// Those might require tuning, changing them won't affect the outcome and will maintain backward compatibility