modeling.PolyEdit.EdgeLimit
modeling.PolyEdit.EdgeLimit
#Overview
name: modeling.PolyEdit.EdgeLimit
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Maximal number of edges that PolyEd and TriEd support. Meshes that would require more than this number of edges to be rendered in PolyEd or TriEd force the tools to be disabled to avoid hanging the editor.
It is referenced in 5
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of modeling.PolyEdit.EdgeLimit is to set a maximum limit on the number of edges that can be processed by the PolyEd and TriEd tools in Unreal Engine 5’s mesh modeling system. This setting is designed to prevent the editor from hanging when rendering complex meshes with a high number of edges.
This setting variable is primarily used by the Mesh Modeling Toolset plugin, specifically within the EditMeshPolygonsTool. It’s part of the mesh editing and polygon manipulation subsystem of Unreal Engine 5.
The value of this variable is set through a console variable (CVarEdgeLimit) with a default value of 60,000 edges. It can be modified at runtime through the console or configuration files.
The associated variable CVarEdgeLimit directly interacts with modeling.PolyEdit.EdgeLimit. They share the same value and purpose.
Developers must be aware that:
- This limit applies to both PolyEd and TriEd tools.
- Exceeding this limit will disable the tool to prevent potential editor crashes.
- The limit can be changed, but increasing it may risk hanging the editor when working with very dense meshes.
Best practices when using this variable include:
- Be cautious when increasing the limit, as it may impact editor performance.
- Save work before attempting to edit meshes that are close to or exceed the current limit.
- Consider optimizing meshes to reduce edge count when possible, rather than constantly increasing the limit.
- Use this setting as a guide for mesh complexity in your project, aiming to keep meshes below this threshold for better tool performance.
Regarding the associated variable CVarEdgeLimit:
- It’s an auto console variable that directly controls the modeling.PolyEdit.EdgeLimit setting.
- It’s defined in the EditMeshPolygonsTool.cpp file within the EditMeshPolygonsToolLocals namespace.
- The variable is used to retrieve the current edge limit value in the UEditMeshPolygonsTool::Setup() function.
- Developers can modify this value through console commands or configuration files to adjust the edge limit as needed.
When working with CVarEdgeLimit, developers should follow the same best practices and awareness points as with modeling.PolyEdit.EdgeLimit, as they are essentially the same setting exposed through different interfaces.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Plugins/Runtime/MeshModelingToolset/Source/MeshModelingTools/Private/EditMeshPolygonsTool.cpp:79
Scope (from outer to inner):
file
namespace EditMeshPolygonsToolLocals
Source code excerpt:
TAutoConsoleVariable<int32> CVarEdgeLimit(
TEXT("modeling.PolyEdit.EdgeLimit"),
60000,
TEXT("Maximal number of edges that PolyEd and TriEd support. Meshes that would require "
"more than this number of edges to be rendered in PolyEd or TriEd force the tools to "
"be disabled to avoid hanging the editor."));
// Allows undo/redo of addition of extra corners in the group topology based on user angle thresholds.
#Loc: <Workspace>/Engine/Plugins/Runtime/MeshModelingToolset/Source/MeshModelingTools/Private/EditMeshPolygonsTool.cpp:370
Scope (from outer to inner):
file
function void UEditMeshPolygonsTool::Setup
Source code excerpt:
LOCTEXT("TriEditTooManyEdges",
"This tool is currently disallowed from operating on a mesh of this resolution. "
"Current limit set by \"modeling.PolyEdit.EdgeLimit\" is {0} edges, and mesh has "
"{1}. Limit can be changed but exists to avoid hanging the editor when trying to "
"render too many edges using the current system, so make sure to save your work "
"if you change the upper limit and try to edit a very dense mesh."),
MaxEdges, CurrentMesh->EdgeCount()), EToolMessageLevel::UserError);
return;
}
#Loc: <Workspace>/Engine/Plugins/Runtime/MeshModelingToolset/Source/MeshModelingTools/Private/EditMeshPolygonsTool.cpp:424
Scope (from outer to inner):
file
function void UEditMeshPolygonsTool::Setup
Source code excerpt:
LOCTEXT("PolyEditTooManyEdges",
"This tool is currently disallowed from operating on a group topology of this resolution. "
"Current limit set by \"modeling.PolyEdit.EdgeLimit\" is {0} displayed edges, and topology has "
"{1} edge segments to display. Limit can be changed, but it exists to avoid hanging the editor "
"when trying to render too many edges using the current system, so make sure to save your work "
"if you change the upper limit and try to edit a very complicated topology."),
MaxEdges, NumEdgesToRender), EToolMessageLevel::UserError);
return;
}
#Associated Variable and Callsites
This variable is associated with another variable named CVarEdgeLimit
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Plugins/Runtime/MeshModelingToolset/Source/MeshModelingTools/Private/EditMeshPolygonsTool.cpp:78
Scope (from outer to inner):
file
namespace EditMeshPolygonsToolLocals
Source code excerpt:
}
TAutoConsoleVariable<int32> CVarEdgeLimit(
TEXT("modeling.PolyEdit.EdgeLimit"),
60000,
TEXT("Maximal number of edges that PolyEd and TriEd support. Meshes that would require "
"more than this number of edges to be rendered in PolyEd or TriEd force the tools to "
"be disabled to avoid hanging the editor."));
#Loc: <Workspace>/Engine/Plugins/Runtime/MeshModelingToolset/Source/MeshModelingTools/Private/EditMeshPolygonsTool.cpp:353
Scope (from outer to inner):
file
function void UEditMeshPolygonsTool::Setup
Source code excerpt:
// As a hack, disable everything if the number of edges is too high, so that user doesn't lose work accidentally
// if they start the tool on the wrong thing.
int32 MaxEdges = CVarEdgeLimit.GetValueOnGameThread();
CurrentMesh = MakeShared<FDynamicMesh3>(UE::ToolTarget::GetDynamicMeshCopy(Target));
WorldTransform = UE::ToolTarget::GetLocalToWorldTransform(Target);
FVector ScaleToBake = WorldTransform.GetScale();
BakedTransform = FTransformSRT3d(FQuaterniond::Identity(), FVector::Zero(), ScaleToBake);
WorldTransform.SetScale(FVector::One());