Files
UnrealEngineUWP/Engine/Plugins/Experimental/MeshModelingToolset/Source/MeshModelingTools/Private/Properties/MeshStatisticsProperties.cpp
Ryan Schmidt f45388ffbe Rename USimpleDynamicMeshComponent to UDynamicMeshComponent. Move ModelingComponents Components and SceneProxys to /Components subdirectory.
#rb none
#rnx
#jira none
#preflight 60c4451f5c10070001ae0537

[CL 16652187 by Ryan Schmidt in ue5-main branch]
2021-06-12 14:28:52 -04:00

45 lines
1.1 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#include "Properties/MeshStatisticsProperties.h"
#include "DynamicMesh3.h"
#include "DynamicMeshAttributeSet.h"
#include "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