Files
Brandyn / Techy fcc1b09210 init
2026-04-04 15:40:51 -05:00

67 lines
2.2 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#if WITH_EDITOR
#include "AudioDrivenAnimationCustomizations.h"
#include "AudioDrivenAnimationConfig.h"
#include "DetailWidgetRow.h"
#include "IDetailChildrenBuilder.h"
namespace UE::MetaHuman::Private
{
TSharedRef<IPropertyTypeCustomization> FAudioSolveOverridesPropertyTypeCustomization::MakeInstance()
{
return MakeShared<FAudioSolveOverridesPropertyTypeCustomization>();
}
void FAudioSolveOverridesPropertyTypeCustomization::CustomizeHeader(TSharedRef<IPropertyHandle> StructPropertyHandle, FDetailWidgetRow& HeaderRow, IPropertyTypeCustomizationUtils& StructCustomizationUtils)
{
HeaderRow
.NameContent()[StructPropertyHandle->CreatePropertyNameWidget()]
.ValueContent()[StructPropertyHandle->CreatePropertyValueWidget()];
}
void FAudioSolveOverridesPropertyTypeCustomization::CustomizeChildren(TSharedRef<IPropertyHandle> StructPropertyHandle, IDetailChildrenBuilder& StructBuilder, IPropertyTypeCustomizationUtils& StructCustomizationUtils)
{
TSharedRef<IPropertyHandle> MoodPropertyHandle = StructPropertyHandle->GetChildHandle(
GET_MEMBER_NAME_CHECKED(FAudioDrivenAnimationSolveOverrides, Mood)
).ToSharedRef();
StructBuilder.AddProperty(MoodPropertyHandle)
.CustomWidget()
.NameContent()[MoodPropertyHandle->CreatePropertyNameWidget()]
.ValueContent()
[
SNew(SAudioDrivenAnimationMood, true, MoodPropertyHandle)
];
TSharedRef<IPropertyHandle> MoodIntensityPropertyHandle = StructPropertyHandle->GetChildHandle(
GET_MEMBER_NAME_CHECKED(FAudioDrivenAnimationSolveOverrides, MoodIntensity)
).ToSharedRef();
StructBuilder
.AddProperty(MoodIntensityPropertyHandle)
.IsEnabled(
MakeAttributeLambda(
[MoodPropertyHandle]()
{
uint8 MoodPropertyValue;
const FPropertyAccess::Result Result = MoodPropertyHandle->GetValue(MoodPropertyValue);
if (Result == FPropertyAccess::Success)
{
EAudioDrivenAnimationMood Mood = static_cast<EAudioDrivenAnimationMood>(MoodPropertyValue);
// We disable the mood intensity property for the neutral mood, it has no meaning there.
return Mood != EAudioDrivenAnimationMood::Neutral;
}
return false;
}
)
);
}
} // namespace UE::MetaHuman::Private
#endif // WITH_EDITOR