Files
bryan sefcik 50d4fac9e0 Updated ../Engine/Plugins/... to inline gen.cpp files
Before:
3548 unity files
Total CPU Time: 47343.578125 s
Total time in Parallel executor: 494.60 seconds

After:
3445 unity files
Total CPU Time: 46044.671875 s
Total time in Parallel executor: 468.51 seconds

#jira
#preflight 63336159b20e73a098b7f24f

[CL 22218213 by bryan sefcik in ue5-main branch]
2022-09-28 01:06:15 -04:00

72 lines
1.9 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#include "Properties/MeshUVChannelProperties.h"
#include "DynamicMesh/DynamicMesh3.h"
#include "DynamicMesh/DynamicMeshAttributeSet.h"
#include "MeshDescription.h"
#include "StaticMeshAttributes.h"
#include UE_INLINE_GENERATED_CPP_BY_NAME(MeshUVChannelProperties)
void UMeshUVChannelProperties::Initialize(int32 NumUVChannels, bool bInitializeSelection)
{
UVChannelNamesList.Reset();
for (int32 k = 0; k < NumUVChannels; ++k)
{
UVChannelNamesList.Add(FString::Printf(TEXT("UV %d"), k));
}
if (bInitializeSelection)
{
UVChannel = (NumUVChannels > 0) ? UVChannelNamesList[0] : TEXT("");
}
}
const TArray<FString>& UMeshUVChannelProperties::GetUVChannelNamesFunc() const
{
return UVChannelNamesList;
}
void UMeshUVChannelProperties::Initialize(const FMeshDescription* MeshDescription, bool bInitializeSelection)
{
TVertexInstanceAttributesConstRef<FVector2f> InstanceUVs =
MeshDescription->VertexInstanceAttributes().GetAttributesRef<FVector2f>(MeshAttribute::VertexInstance::TextureCoordinate);
Initialize(InstanceUVs.GetNumChannels(), bInitializeSelection);
}
void UMeshUVChannelProperties::Initialize(const FDynamicMesh3* Mesh, bool bInitializeSelection)
{
int32 NumUVChannels = Mesh->HasAttributes() ? Mesh->Attributes()->NumUVLayers() : 0;
Initialize(NumUVChannels, bInitializeSelection);
}
bool UMeshUVChannelProperties::ValidateSelection(bool bUpdateIfInvalid)
{
int32 FoundIndex = UVChannelNamesList.IndexOfByKey(UVChannel);
if (FoundIndex == INDEX_NONE)
{
if (bUpdateIfInvalid)
{
UVChannel = (UVChannelNamesList.Num() > 0) ? UVChannelNamesList[0] : TEXT("");
}
return false;
}
return true;
}
int32 UMeshUVChannelProperties::GetSelectedChannelIndex(bool bForceToZeroOnFailure)
{
int32 FoundIndex = UVChannelNamesList.IndexOfByKey(UVChannel);
if (FoundIndex == INDEX_NONE)
{
return (bForceToZeroOnFailure ) ? 0 : -1;
}
return FoundIndex;
}