2014-12-07 19:09:38 -05:00
|
|
|
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
|
2014-03-14 14:13:41 -04:00
|
|
|
|
|
|
|
|
#include "DetailCustomizationsPrivatePCH.h"
|
|
|
|
|
#include "SlateSoundCustomization.h"
|
2014-11-12 04:58:53 -05:00
|
|
|
#include "Sound/SoundBase.h"
|
2014-03-14 14:13:41 -04:00
|
|
|
|
2014-06-04 10:16:14 -04:00
|
|
|
TSharedRef<IPropertyTypeCustomization> FSlateSoundStructCustomization::MakeInstance()
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
|
|
|
|
return MakeShareable(new FSlateSoundStructCustomization());
|
|
|
|
|
}
|
|
|
|
|
|
2014-06-04 11:16:24 -04:00
|
|
|
void FSlateSoundStructCustomization::CustomizeHeader(TSharedRef<IPropertyHandle> StructPropertyHandle, FDetailWidgetRow& HeaderRow, IPropertyTypeCustomizationUtils& StructCustomizationUtils)
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
|
|
|
|
TSharedPtr<IPropertyHandle> ResourceObjectProperty = StructPropertyHandle->GetChildHandle(TEXT("ResourceObject"));
|
|
|
|
|
check(ResourceObjectProperty.IsValid());
|
|
|
|
|
|
|
|
|
|
TArray<void*> StructPtrs;
|
|
|
|
|
StructPropertyHandle->AccessRawData(StructPtrs);
|
|
|
|
|
for(auto It = StructPtrs.CreateConstIterator(); It; ++It)
|
|
|
|
|
{
|
|
|
|
|
FSlateSound* const SlateSound = reinterpret_cast<FSlateSound*>(*It);
|
|
|
|
|
SlateSoundStructs.Add(SlateSound);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
HeaderRow
|
|
|
|
|
.NameContent()
|
|
|
|
|
[
|
|
|
|
|
StructPropertyHandle->CreatePropertyNameWidget()
|
|
|
|
|
]
|
|
|
|
|
.ValueContent()
|
|
|
|
|
.MinDesiredWidth(250.0f)
|
|
|
|
|
[
|
|
|
|
|
SNew(SObjectPropertyEntryBox)
|
|
|
|
|
.PropertyHandle(ResourceObjectProperty)
|
|
|
|
|
.AllowedClass(USoundBase::StaticClass())
|
|
|
|
|
.OnObjectChanged(this, &FSlateSoundStructCustomization::OnObjectChanged)
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
|
2014-06-04 11:16:24 -04:00
|
|
|
void FSlateSoundStructCustomization::CustomizeChildren(TSharedRef<IPropertyHandle> StructPropertyHandle, IDetailChildrenBuilder& StructBuilder, IPropertyTypeCustomizationUtils& StructCustomizationUtils)
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2014-07-14 19:41:38 -04:00
|
|
|
void FSlateSoundStructCustomization::OnObjectChanged(const FAssetData&)
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
|
|
|
|
// The object has been updated in the editor, so strip out the legacy data now so that the two don't conflict
|
|
|
|
|
for(auto It = SlateSoundStructs.CreateConstIterator(); It; ++It)
|
|
|
|
|
{
|
|
|
|
|
FSlateSound* const SlateSound = *It;
|
|
|
|
|
SlateSound->StripLegacyData_DEPRECATED();
|
|
|
|
|
}
|
|
|
|
|
}
|