Files
UnrealEngineUWP/Engine/Source/Editor/DetailCustomizations/Private/RotatorStructCustomization.cpp
Ryan Vance 7c51ff94af Merging //UE4/Dev-Main to Dev-VR (//UE4/Dev-VR)
CL 1 of 8
#rb integration

[CL 4748712 by Ryan Vance in Dev-VR branch]
2019-01-17 18:54:05 -05:00

48 lines
1.3 KiB
C++

// Copyright 1998-2019 Epic Games, Inc. All Rights Reserved.
#include "RotatorStructCustomization.h"
#include "UObject/UnrealType.h"
TSharedRef<IPropertyTypeCustomization> FRotatorStructCustomization::MakeInstance()
{
return MakeShareable(new FRotatorStructCustomization);
}
void FRotatorStructCustomization::GetSortedChildren(TSharedRef<IPropertyHandle> StructPropertyHandle, TArray< TSharedRef<IPropertyHandle> >& OutChildren)
{
static const FName Roll("Roll");
static const FName Pitch("Pitch");
static const FName Yaw("Yaw");
TSharedPtr< IPropertyHandle > RotatorChildren[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 == Roll)
{
RotatorChildren[0] = ChildHandle;
}
else if (PropertyName == Pitch)
{
RotatorChildren[1] = ChildHandle;
}
else
{
check(PropertyName == Yaw);
RotatorChildren[2] = ChildHandle;
}
}
OutChildren.Add(RotatorChildren[0].ToSharedRef());
OutChildren.Add(RotatorChildren[1].ToSharedRef());
OutChildren.Add(RotatorChildren[2].ToSharedRef());
}