Files
UnrealEngineUWP/Engine/Source/Editor/DetailCustomizations/Private/RotatorStructCustomization.cpp
bryan sefcik 8cc129f2b6 IWYU Pass 1 - Engine/Source/Editor/...
#jira
#preflight 6306736ac85b7fef22be7751

[CL 21558583 by bryan sefcik in ue5-main branch]
2022-08-24 22:45:13 -04:00

56 lines
1.5 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#include "RotatorStructCustomization.h"
#include "HAL/Platform.h"
#include "HAL/PlatformCrt.h"
#include "Misc/AssertionMacros.h"
#include "PropertyHandle.h"
#include "UObject/NameTypes.h"
#include "UObject/UnrealType.h"
class IPropertyTypeCustomization;
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());
}