Files
UnrealEngineUWP/Engine/Plugins/Experimental/MeshModelingToolsetExp/Source/MeshModelingToolsExp/Private/Properties/MeshStatisticsProperties.cpp
michael balzer 1e3a3267f4 MeshModelingToolset: Split plugin into non-experimental and experimental
#jira UETOOL-3823
#rb ryan.schmidt
#preflight 6101fb4b2b002800014f7007

[CL 17003092 by michael balzer in ue5-main branch]
2021-07-29 20:04:58 -04:00

45 lines
1.1 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#include "Properties/MeshStatisticsProperties.h"
#include "DynamicMesh/DynamicMesh3.h"
#include "DynamicMesh/DynamicMeshAttributeSet.h"
#include "DynamicMesh/MeshNormals.h"
#include "Components/DynamicMeshComponent.h"
using namespace UE::Geometry;
#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