Files
UnrealEngineUWP/Engine/Source/Editor/DetailCustomizations/Private/VectorStructCustomization.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

48 lines
1.2 KiB
C++

// Copyright 1998-2017 Epic Games, Inc. All Rights Reserved.
#include "VectorStructCustomization.h"
#include "UObject/UnrealType.h"
TSharedRef<IPropertyTypeCustomization> FVectorStructCustomization::MakeInstance()
{
return MakeShareable(new FVectorStructCustomization);
}
void FVectorStructCustomization::GetSortedChildren(TSharedRef<IPropertyHandle> StructPropertyHandle, TArray< TSharedRef<IPropertyHandle> >& OutChildren)
{
static const FName X("X");
static const FName Y("Y");
static const FName Z("Z");
TSharedPtr<IPropertyHandle> VectorChildren[3];
uint32 NumChildren;
StructPropertyHandle->GetNumChildren(NumChildren);
for (uint32 ChildIndex = 0; ChildIndex < NumChildren; ++ChildIndex)
{
TSharedRef<IPropertyHandle> ChildHandle = StructPropertyHandle->GetChildHandle(ChildIndex).ToSharedRef();
const FName PropertyName = ChildHandle->GetProperty()->GetFName();
if (PropertyName == X)
{
VectorChildren[0] = ChildHandle;
}
else if (PropertyName == Y)
{
VectorChildren[1] = ChildHandle;
}
else
{
check(PropertyName == Z);
VectorChildren[2] = ChildHandle;
}
}
OutChildren.Add(VectorChildren[0].ToSharedRef());
OutChildren.Add(VectorChildren[1].ToSharedRef());
OutChildren.Add(VectorChildren[2].ToSharedRef());
}