Files
UnrealEngineUWP/Engine/Source/Editor/DetailCustomizations/Private/SlateSoundCustomization.cpp
Ben Marsh 149375b14b Update copyright notices to 2015.
[CL 2379638 by Ben Marsh in Main branch]
2014-12-07 19:09:38 -05:00

53 lines
1.8 KiB
C++

// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
#include "DetailCustomizationsPrivatePCH.h"
#include "SlateSoundCustomization.h"
#include "Sound/SoundBase.h"
TSharedRef<IPropertyTypeCustomization> FSlateSoundStructCustomization::MakeInstance()
{
return MakeShareable(new FSlateSoundStructCustomization());
}
void FSlateSoundStructCustomization::CustomizeHeader(TSharedRef<IPropertyHandle> StructPropertyHandle, FDetailWidgetRow& HeaderRow, IPropertyTypeCustomizationUtils& StructCustomizationUtils)
{
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)
];
}
void FSlateSoundStructCustomization::CustomizeChildren(TSharedRef<IPropertyHandle> StructPropertyHandle, IDetailChildrenBuilder& StructBuilder, IPropertyTypeCustomizationUtils& StructCustomizationUtils)
{
}
void FSlateSoundStructCustomization::OnObjectChanged(const FAssetData&)
{
// 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();
}
}