Files
UnrealEngineUWP/Engine/Plugins/Runtime/MeshModelingToolset/Source/ModelingComponents/Private/PropertySets/WeightMapSetProperties.cpp
nathan mitchell 559622e6cf ClothEditor: Add new tool derived from the Modeling Mode Group Paint tool for weight painting with dynamic meshes and the brush tool infrastructure
#rb tyson.brochu
#rnx
#preflight 62462ecbb33098a72dd3eb09

[CL 19611005 by nathan mitchell in ue5-main branch]
2022-04-04 12:41:00 -04:00

50 lines
1.1 KiB
C++

// 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;
}
void UWeightMapSetProperties::SetSelectedFromWeightMapIndex(int32 Index)
{
if (Index < 0)
{
WeightMap = FName(WeightMapsList[0]);
}
else
{
WeightMap = FName(WeightMapsList[Index+1]);
}
}