Files
UnrealEngineUWP/Engine/Source/Editor/DetailCustomizations/Private/LevelSequenceBurnInOptionsCustomization.cpp
Ben Marsh 20bf0eb6a1 Updating copyright notices to 2017 (copying from //Tasks/UE4/Dev-Copyright-2017).
#rb none
#lockdown Nick.Penwarden

[CL 3226823 by Ben Marsh in Main branch]
2016-12-08 08:52:44 -05:00

81 lines
2.9 KiB
C++

// Copyright 1998-2017 Epic Games, Inc. All Rights Reserved.
#include "LevelSequenceBurnInOptionsCustomization.h"
#include "Misc/Attribute.h"
#include "Layout/Visibility.h"
#include "PropertyHandle.h"
#include "IDetailChildrenBuilder.h"
#include "DetailWidgetRow.h"
#include "IPropertyUtilities.h"
#include "LevelSequenceActor.h"
void AddPropertiesRecursive(TSharedRef<IPropertyHandle> Property, IDetailChildrenBuilder& ChildBuilder)
{
uint32 NumChildren = 0;
Property->GetNumChildren(NumChildren);
for (uint32 Index = 0; Index < NumChildren; ++Index)
{
TSharedRef<IPropertyHandle> Child = Property->GetChildHandle(Index).ToSharedRef();
if (Child->GetProperty())
{
ChildBuilder.AddChildProperty(Child);
}
else
{
AddPropertiesRecursive(Child, ChildBuilder);
}
}
}
void FLevelSequenceBurnInOptionsCustomization::CustomizeHeader(TSharedRef<IPropertyHandle> PropertyHandle, FDetailWidgetRow& HeaderRow, IPropertyTypeCustomizationUtils& CustomizationUtils)
{
HeaderRow.NameContent()
[
PropertyHandle->CreatePropertyNameWidget()
];
}
void FLevelSequenceBurnInOptionsCustomization::CustomizeChildren(TSharedRef<IPropertyHandle> StructPropertyHandle, class IDetailChildrenBuilder& ChildBuilder, IPropertyTypeCustomizationUtils& StructCustomizationUtils)
{
TSharedPtr<IPropertyUtilities> Utils = StructCustomizationUtils.GetPropertyUtilities();
FSimpleDelegate Refresh = FSimpleDelegate::CreateRaw(Utils.Get(), &IPropertyUtilities::RequestRefresh);
{
TSharedRef<IPropertyHandle> Property = StructPropertyHandle->GetChildHandle(GET_MEMBER_NAME_CHECKED(ULevelSequenceBurnInOptions, bUseBurnIn)).ToSharedRef();
Property->SetOnPropertyValueChanged(Refresh);
Property->SetOnChildPropertyValueChanged(Refresh);
}
{
TSharedRef<IPropertyHandle> Property = StructPropertyHandle->GetChildHandle(GET_MEMBER_NAME_CHECKED(ULevelSequenceBurnInOptions, BurnInClass)).ToSharedRef();
Property->SetOnPropertyValueChanged(Refresh);
Property->SetOnChildPropertyValueChanged(Refresh);
}
AddPropertiesRecursive(StructPropertyHandle, ChildBuilder);
}
void FLevelSequenceBurnInInitSettingsCustomization::CustomizeHeader(TSharedRef<IPropertyHandle> PropertyHandle, FDetailWidgetRow& HeaderRow, IPropertyTypeCustomizationUtils& CustomizationUtils)
{
HeaderRow.Visibility(TAttribute<EVisibility>::Create(TAttribute<EVisibility>::FGetter::CreateLambda(
[PropertyHandle]
{
UObject* ObjectValue = nullptr;
PropertyHandle->GetValue(ObjectValue);
return ObjectValue ? EVisibility::Visible : EVisibility::Collapsed;
}
)));
HeaderRow.NameContent()
[
PropertyHandle->CreatePropertyNameWidget()
];
}
void FLevelSequenceBurnInInitSettingsCustomization::CustomizeChildren(TSharedRef<IPropertyHandle> StructPropertyHandle, IDetailChildrenBuilder& ChildBuilder, IPropertyTypeCustomizationUtils& StructCustomizationUtils)
{
AddPropertiesRecursive(StructPropertyHandle, ChildBuilder);
}