Files
UnrealEngineUWP/Engine/Plugins/Runtime/MeshModelingToolset/Source/ModelingComponents/Public/Selection/DynamicMeshSelection.h
michael balzer a49c74b915 MeshModelingToolset: Move ModelingOperators and ModelingOperatorsEditorOnly modules out of experimental plugin
#jira UETOOL-3823
#rb lonnie.li
#preflight 617b1aea5794a500014f544a

#ROBOMERGE-AUTHOR: michael.balzer
#ROBOMERGE-SOURCE: CL 17972239 in //UE5/Release-5.0/... via CL 17972248
#ROBOMERGE-BOT: STARSHIP (Release-Engine-Staging -> Release-Engine-Test) (v885-17909292)
#ROBOMERGE[STARSHIP]: UE5-Main

[CL 17972256 by michael balzer in ue5-release-engine-test branch]
2021-10-28 19:47:45 -04:00

65 lines
1.4 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
namespace UE {
namespace Geometry {
class FDynamicMesh3;
/**
* Class that represents a selection in a dynamic mesh.
*/
class FDynamicMeshSelection
{
public:
enum class EType
{
Vertex,
Edge,
Triangle,
Group
};
const FDynamicMesh3* Mesh = nullptr;
TSet<int32> SelectedIDs;
EType Type = EType::Vertex;
// Not relevant if the selection type is not Group
int32 GroupLayer = 0;
// Can be used to discard the selection if topology of the mesh
// has changed (to avoid the risk of referencing elements that may
// have been deleted)
int32 TopologyTimestamp = -1;
/** Checks whether the selection's timestamp still matches the meshes topology timestamp. */
bool MatchesTimestamp() const
{
return Mesh && Mesh->GetTopologyChangeStamp() == TopologyTimestamp;
}
bool IsEmpty() const
{
return SelectedIDs.IsEmpty();
}
bool operator==(const FDynamicMeshSelection& Other)
{
return Mesh == Other.Mesh
&& Type == Other.Type
&& TopologyTimestamp == Other.TopologyTimestamp
&& (Type != EType::Group || GroupLayer == Other.GroupLayer)
&& SelectedIDs.Num() == Other.SelectedIDs.Num()
&& SelectedIDs.Includes(Other.SelectedIDs);
}
bool operator!=(const FDynamicMeshSelection& Other)
{
return !(*this == Other);
}
};
}}// end namespace UE::Geometry