2019-12-27 09:26:59 -05:00
|
|
|
// Copyright Epic Games, Inc. All Rights Reserved.
|
2019-10-01 20:41:42 -04:00
|
|
|
|
|
|
|
|
#include "Properties/MeshStatisticsProperties.h"
|
|
|
|
|
|
2021-06-13 00:35:22 -04:00
|
|
|
#include "DynamicMesh/DynamicMesh3.h"
|
|
|
|
|
#include "DynamicMesh/DynamicMeshAttributeSet.h"
|
|
|
|
|
#include "DynamicMesh/MeshNormals.h"
|
2019-10-01 20:41:42 -04:00
|
|
|
|
2021-06-12 14:28:52 -04:00
|
|
|
#include "Components/DynamicMeshComponent.h"
|
2019-10-01 20:41:42 -04:00
|
|
|
|
2021-03-09 19:33:56 -04:00
|
|
|
using namespace UE::Geometry;
|
|
|
|
|
|
2019-10-01 20:41:42 -04:00
|
|
|
#define LOCTEXT_NAMESPACE "UMeshStatisticsProperites"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void UMeshStatisticsProperties::Update(const FDynamicMesh3& MeshIn)
|
|
|
|
|
{
|
|
|
|
|
this->Mesh = FString::Printf(TEXT("T: %d V: %d E: %d"), MeshIn.TriangleCount(), MeshIn.VertexCount(), MeshIn.EdgeCount());
|
|
|
|
|
|
|
|
|
|
if (MeshIn.HasAttributes())
|
|
|
|
|
{
|
|
|
|
|
const FDynamicMeshAttributeSet* Attribs = MeshIn.Attributes();
|
|
|
|
|
|
|
|
|
|
FString UVString;
|
|
|
|
|
for ( int k = 0; k < Attribs->NumUVLayers(); k++)
|
|
|
|
|
{
|
|
|
|
|
const FDynamicMeshUVOverlay* UVLayer = Attribs->GetUVLayer(k);
|
|
|
|
|
UVString += FString::Printf(TEXT("UV%d: %d"), k, UVLayer->ElementCount());
|
|
|
|
|
}
|
|
|
|
|
this->UV = UVString;
|
|
|
|
|
|
|
|
|
|
this->Attributes = FString::Printf(TEXT("Normals: %d"), Attribs->GetNormalLayer(0)->ElementCount());
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
this->UV = FString(TEXT("none"));
|
|
|
|
|
this->Attributes = FString(TEXT("none"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#undef LOCTEXT_NAMESPACE
|