p.EnableMeshClean
p.EnableMeshClean
#Overview
name: p.EnableMeshClean
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Enable/Disable mesh cleanup during cook.
It is referenced in 6
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of p.EnableMeshClean is to control mesh cleanup during the cooking process in Unreal Engine’s Chaos physics system. This setting variable is primarily used in the physics engine, specifically in the Chaos cooking subsystem.
The Unreal Engine subsystem that relies on this setting variable is the Chaos physics engine, particularly the cooking module. It’s used in the Experimental/ChaosCooking.cpp file, which suggests it’s part of an experimental feature in the physics engine.
The value of this variable is set as a console variable using FAutoConsoleVariableRef. It’s initialized with a default value of 1, meaning mesh cleanup is enabled by default.
The associated variable EnableMeshClean interacts directly with p.EnableMeshClean. They share the same value, with EnableMeshClean being the actual int32 variable used in the code logic.
Developers must be aware that this variable controls whether mesh cleanup occurs during the cooking process. When enabled (set to 1), it triggers the CleanTrimesh function, which can modify the vertex and index data of the mesh being processed.
Best practices when using this variable include:
- Understanding the impact of mesh cleaning on your specific use case.
- Testing performance and results with both enabled and disabled states to determine the optimal setting for your project.
- Being cautious when disabling it, as it might affect the quality or performance of physics simulations.
Regarding the associated variable EnableMeshClean:
The purpose of EnableMeshClean is to provide a direct, code-level access to the mesh cleaning setting. It’s used in conditional statements to determine whether mesh cleaning should be performed during the cooking process.
This variable is used within the Chaos::Cooking namespace, specifically in functions like BuildSingleTrimesh and BuildTriangleMeshes. These functions are part of the mesh processing pipeline in the Chaos physics system.
The value of EnableMeshClean is set by the console variable p.EnableMeshClean. Any changes to the console variable will be reflected in EnableMeshClean.
EnableMeshClean interacts with various parts of the mesh cooking process, including vertex and index data manipulation, and material index processing.
Developers should be aware that this variable directly affects the mesh processing pipeline. When it’s true (non-zero), additional cleaning and remapping operations are performed on the mesh data.
Best practices for using EnableMeshClean include:
- Ensuring consistency between this variable and the p.EnableMeshClean console variable.
- Considering the performance implications of enabling or disabling mesh cleaning in your specific use case.
- Testing the impact of this setting on your physics simulations and adjusting as necessary for optimal results.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/PhysicsEngine/Experimental/ChaosCooking.cpp:7
Scope: file
Source code excerpt:
int32 EnableMeshClean = 1;
FAutoConsoleVariableRef CVarEnableMeshClean(TEXT("p.EnableMeshClean"), EnableMeshClean, TEXT("Enable/Disable mesh cleanup during cook."));
namespace Chaos
{
namespace Cooking
{
static void CopyUpdatedFaceRemapFromTriangleMesh(const Chaos::FTriangleMeshImplicitObject& TriangleMesh, TArray<int32>& OutFaceRemap)
#Associated Variable and Callsites
This variable is associated with another variable named EnableMeshClean
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/PhysicsEngine/Experimental/ChaosCooking.cpp:6
Scope: file
Source code excerpt:
#include "Chaos/TriangleMeshImplicitObject.h"
int32 EnableMeshClean = 1;
FAutoConsoleVariableRef CVarEnableMeshClean(TEXT("p.EnableMeshClean"), EnableMeshClean, TEXT("Enable/Disable mesh cleanup during cook."));
namespace Chaos
{
namespace Cooking
{
static void CopyUpdatedFaceRemapFromTriangleMesh(const Chaos::FTriangleMeshImplicitObject& TriangleMesh, TArray<int32>& OutFaceRemap)
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/PhysicsEngine/Experimental/ChaosCooking.cpp:43
Scope (from outer to inner):
file
namespace Chaos
namespace Cooking
function Chaos::FTriangleMeshImplicitObjectPtr BuildSingleTrimesh
Source code excerpt:
}
if(EnableMeshClean)
{
Chaos::CleanTrimesh(FinalVerts, FinalIndices, &OutFaceRemap, &OutVertexRemap);
}
// Build particle list #BG Maybe allow TParticles to copy vectors?
Chaos::FTriangleMeshImplicitObject::ParticlesType TriMeshParticles;
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/PhysicsEngine/Experimental/ChaosCooking.cpp:96
Scope (from outer to inner):
file
namespace Chaos
namespace Cooking
function Chaos::FTriangleMeshImplicitObjectPtr BuildSingleTrimesh
lambda-function
Source code excerpt:
if(bHasMaterials)
{
if(EnableMeshClean)
{
if(!ensure(OldFaceRemap.IsValidIndex(TriangleIndex)))
{
MaterialIndices.Empty();
bHasMaterials = false;
}
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/PhysicsEngine/Experimental/ChaosCooking.cpp:226
Scope (from outer to inner):
file
namespace Chaos
namespace Cooking
function void BuildTriangleMeshes
Source code excerpt:
}
if(EnableMeshClean)
{
Chaos::CleanTrimesh(FinalVerts, FinalIndices, &OutFaceRemap, &OutVertexRemap);
}
// Build particle list #BG Maybe allow TParticles to copy vectors?
Chaos::FTriangleMeshImplicitObject::ParticlesType TriMeshParticles;
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/PhysicsEngine/Experimental/ChaosCooking.cpp:279
Scope (from outer to inner):
file
namespace Chaos
namespace Cooking
function void BuildTriangleMeshes
lambda-function
Source code excerpt:
if(bHasMaterials)
{
if(EnableMeshClean)
{
if(!ensure(OldFaceRemap.IsValidIndex(TriangleIndex)))
{
MaterialIndices.Empty();
bHasMaterials = false;
}