2020-06-23 18:40:00 -04:00
|
|
|
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
|
|
|
|
|
|
#include "PropertySets/WeightMapSetProperties.h"
|
|
|
|
|
#include "WeightMapUtil.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void UWeightMapSetProperties::InitializeWeightMaps(const TArray<FName>& WeightMapNames)
|
|
|
|
|
{
|
|
|
|
|
// populate weight maps list
|
|
|
|
|
WeightMapsList.Add(TEXT("None"));
|
|
|
|
|
for (FName Name : WeightMapNames)
|
|
|
|
|
{
|
|
|
|
|
WeightMapsList.Add(Name.ToString());
|
|
|
|
|
}
|
|
|
|
|
if (WeightMapNames.Contains(WeightMap) == false) // discard restored value if it doesn't apply
|
|
|
|
|
{
|
|
|
|
|
WeightMap = FName(WeightMapsList[0]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void UWeightMapSetProperties::InitializeFromMesh(const FMeshDescription* Mesh)
|
|
|
|
|
{
|
|
|
|
|
TArray<FName> TargetWeightMaps;
|
|
|
|
|
UE::WeightMaps::FindVertexWeightMaps(Mesh, TargetWeightMaps);
|
|
|
|
|
InitializeWeightMaps(TargetWeightMaps);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool UWeightMapSetProperties::HasSelectedWeightMap() const
|
|
|
|
|
{
|
|
|
|
|
return WeightMap != FName(WeightMapsList[0]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TArray<FString> UWeightMapSetProperties::GetWeightMapsFunc()
|
|
|
|
|
{
|
|
|
|
|
return WeightMapsList;
|
2022-04-04 12:41:00 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void UWeightMapSetProperties::SetSelectedFromWeightMapIndex(int32 Index)
|
|
|
|
|
{
|
|
|
|
|
if (Index < 0)
|
|
|
|
|
{
|
|
|
|
|
WeightMap = FName(WeightMapsList[0]);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
WeightMap = FName(WeightMapsList[Index+1]);
|
|
|
|
|
}
|
2020-06-23 18:40:00 -04:00
|
|
|
}
|