You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
#ROBOMERGE-AUTHOR: michael.balzer #ROBOMERGE-SOURCE: CL 18227685 in //UE5/Release-5.0/... via CL 18229350 #ROBOMERGE-BOT: STARSHIP (Release-Engine-Staging -> Release-Engine-Test) (v895-18170469) #ROBOMERGE[STARSHIP]: UE5-Main [CL 18231457 by michael balzer in ue5-release-engine-test branch]
68 lines
1.7 KiB
C++
68 lines
1.7 KiB
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
#include "Selections/MeshEdgeSelection.h"
|
|
|
|
#include "DynamicMesh/DynamicMesh3.h"
|
|
#include "Containers/Set.h"
|
|
#include "Selections/MeshFaceSelection.h"
|
|
#include "Selections/MeshVertexSelection.h"
|
|
|
|
using namespace UE::Geometry;
|
|
|
|
// convert vertex selection to edge selection. Require at least minCount verts of edge to be selected
|
|
FMeshEdgeSelection::FMeshEdgeSelection(const FDynamicMesh3* mesh, const FMeshVertexSelection& convertV, int minCount) : Mesh(mesh)
|
|
{
|
|
for (int eid : Mesh->EdgeIndicesItr())
|
|
{
|
|
FIndex2i ev = Mesh->GetEdgeV(eid);
|
|
int n = (convertV.IsSelected(ev.A) ? 1 : 0) +
|
|
(convertV.IsSelected(ev.B) ? 1 : 0);
|
|
if (n >= minCount)
|
|
{
|
|
add(eid);
|
|
}
|
|
}
|
|
}
|
|
|
|
// convert face selection to edge selection. Require at least minCount tris of edge to be selected
|
|
FMeshEdgeSelection::FMeshEdgeSelection(const FDynamicMesh3* mesh, const FMeshFaceSelection& convertT, int minCount) : Mesh(mesh)
|
|
{
|
|
minCount = FMathd::Clamp(minCount, 1, 2);
|
|
|
|
if (minCount == 1)
|
|
{
|
|
for (int tid : convertT)
|
|
{
|
|
FIndex3i te = Mesh->GetTriEdges(tid);
|
|
add(te.A); add(te.B); add(te.C);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
for (int eid : Mesh->EdgeIndicesItr())
|
|
{
|
|
FIndex2i et = Mesh->GetEdgeT(eid);
|
|
if (convertT.IsSelected(et.A) && convertT.IsSelected(et.B))
|
|
{
|
|
add(eid);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
void FMeshEdgeSelection::SelectBoundaryTriEdges(const FMeshFaceSelection& Triangles)
|
|
{
|
|
for (int tid : Triangles)
|
|
{
|
|
FIndex3i te = Mesh->GetTriEdges(tid);
|
|
for ( int j = 0; j < 3; ++j )
|
|
{
|
|
FIndex2i et = Mesh->GetEdgeT(te[j]);
|
|
int other_tid = (et.A == tid) ? et.B : et.A;
|
|
if (Triangles.IsSelected(other_tid) == false)
|
|
{
|
|
add(te[j]);
|
|
}
|
|
}
|
|
}
|
|
} |