You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
#rnx #rb none #ROBOMERGE-OWNER: ryan.durand #ROBOMERGE-AUTHOR: ryan.durand #ROBOMERGE-SOURCE: CL 10869210 via CL 10869511 via CL 10869900 #ROBOMERGE-BOT: (v613-10869866) [CL 10870549 by ryan durand in Main branch]
97 lines
2.1 KiB
C++
97 lines
2.1 KiB
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
#include "SelectionSet.h"
|
|
|
|
|
|
UMeshSelectionSet::UMeshSelectionSet()
|
|
{
|
|
//SetFlags(RF_Transactional);
|
|
}
|
|
|
|
|
|
TArray<int>& UMeshSelectionSet::GetElements(EMeshSelectionElementType ElementType)
|
|
{
|
|
switch (ElementType)
|
|
{
|
|
default:
|
|
case EMeshSelectionElementType::Vertex:
|
|
return Vertices;
|
|
case EMeshSelectionElementType::Edge:
|
|
return Edges;
|
|
case EMeshSelectionElementType::Face:
|
|
return Faces;
|
|
case EMeshSelectionElementType::Group:
|
|
return Groups;
|
|
}
|
|
check(false);
|
|
}
|
|
|
|
const TArray<int>& UMeshSelectionSet::GetElements(EMeshSelectionElementType ElementType) const
|
|
{
|
|
switch (ElementType)
|
|
{
|
|
default:
|
|
case EMeshSelectionElementType::Vertex:
|
|
return Vertices;
|
|
case EMeshSelectionElementType::Edge:
|
|
return Edges;
|
|
case EMeshSelectionElementType::Face:
|
|
return Faces;
|
|
case EMeshSelectionElementType::Group:
|
|
return Groups;
|
|
}
|
|
check(false);
|
|
}
|
|
|
|
|
|
|
|
void UMeshSelectionSet::AddIndices(EMeshSelectionElementType ElementType, const TArray<int32>& Indices)
|
|
{
|
|
TArray<int32>& CurElements = GetElements(ElementType);
|
|
|
|
int N = Indices.Num();
|
|
for (int k = 0; k < N; ++k)
|
|
{
|
|
CurElements.Add(Indices[k]);
|
|
}
|
|
NotifySelectionSetModified();
|
|
}
|
|
|
|
void UMeshSelectionSet::AddIndices(EMeshSelectionElementType ElementType, const TSet<int32>& Indices)
|
|
{
|
|
TArray<int>& CurElements = GetElements(ElementType);
|
|
|
|
for ( int32 Index : Indices )
|
|
{
|
|
CurElements.Add(Index);
|
|
}
|
|
NotifySelectionSetModified();
|
|
}
|
|
|
|
|
|
|
|
void UMeshSelectionSet::RemoveIndices(EMeshSelectionElementType ElementType, const TArray<int32>& Indices)
|
|
{
|
|
TArray<int32>& CurElements = GetElements(ElementType);
|
|
|
|
// @todo if we are removing many elements it is maybe cheaper to make a new array...
|
|
int N = Indices.Num();
|
|
for (int32 k = 0; k < N; ++k)
|
|
{
|
|
CurElements.RemoveSwap(Indices[k]);
|
|
}
|
|
NotifySelectionSetModified();
|
|
}
|
|
|
|
|
|
void UMeshSelectionSet::RemoveIndices(EMeshSelectionElementType ElementType, const TSet<int32>& Indices)
|
|
{
|
|
TArray<int32>& CurElements = GetElements(ElementType);
|
|
|
|
// @todo if we are removing many elements it is maybe cheaper to make a new array...
|
|
for (int32 Index : Indices)
|
|
{
|
|
CurElements.RemoveSwap(Index);
|
|
}
|
|
NotifySelectionSetModified();
|
|
} |