You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
77 lines
2.4 KiB
C++
77 lines
2.4 KiB
C++
// Copyright 1998-2014 Epic Games, Inc. All Rights Reserved.
|
|
|
|
#include "DetailCustomizationsPrivatePCH.h"
|
|
#include "NavLinkStructCustomization.h"
|
|
|
|
#define LOCTEXT_NAMESPACE "FNavLinkStructCustomization"
|
|
|
|
TSharedRef<IPropertyTypeCustomization> FNavLinkStructCustomization::MakeInstance( )
|
|
{
|
|
return MakeShareable(new FNavLinkStructCustomization);
|
|
}
|
|
|
|
void FNavLinkStructCustomization::CustomizeHeader( TSharedRef<IPropertyHandle> StructPropertyHandle, class FDetailWidgetRow& HeaderRow, IPropertyTypeCustomizationUtils& StructCustomizationUtils )
|
|
{
|
|
TSharedPtr<IPropertyHandle> CommentHandle = StructPropertyHandle->GetChildHandle(GET_MEMBER_NAME_CHECKED(FNavigationLinkBase,Description));
|
|
FString Desc;
|
|
|
|
if (CommentHandle.IsValid())
|
|
{
|
|
CommentHandle->GetValue(Desc);
|
|
}
|
|
|
|
HeaderRow.NameContent()
|
|
[
|
|
StructPropertyHandle->CreatePropertyNameWidget()
|
|
]
|
|
.ValueContent()
|
|
.MaxDesiredWidth(400.0f)
|
|
[
|
|
SNew(STextBlock)
|
|
.Text(Desc)
|
|
.Font(StructCustomizationUtils.GetRegularFont())
|
|
];
|
|
}
|
|
|
|
void FNavLinkStructCustomization::CustomizeChildren( TSharedRef<class IPropertyHandle> StructPropertyHandle, class IDetailChildrenBuilder& StructBuilder, IPropertyTypeCustomizationUtils& StructCustomizationUtils )
|
|
{
|
|
uint32 NumChildren = 0;
|
|
StructPropertyHandle->GetNumChildren(NumChildren);
|
|
|
|
FString AgentPrefix("bSupportsAgent");
|
|
const UNavigationSystem* DefNavSys = (UNavigationSystem*)(UNavigationSystem::StaticClass()->GetDefaultObject());
|
|
const int32 NumAgents = FMath::Min(DefNavSys->SupportedAgents.Num(), 16);
|
|
|
|
for (uint32 i = 0; i < NumChildren; i++)
|
|
{
|
|
TSharedPtr<IPropertyHandle> PropHandle = StructPropertyHandle->GetChildHandle(i);
|
|
if (PropHandle->GetProperty() && PropHandle->GetProperty()->GetName().StartsWith(AgentPrefix))
|
|
{
|
|
int32 AgentIdx = -1;
|
|
TTypeFromString<int32>::FromString(AgentIdx, *(PropHandle->GetProperty()->GetName().Mid(AgentPrefix.Len()) ));
|
|
|
|
if (AgentIdx >= 0 && AgentIdx < NumAgents)
|
|
{
|
|
FString PropName = LOCTEXT("SupportedAgent", "Supports Agent: ").ToString() + *DefNavSys->SupportedAgents[AgentIdx].Name.ToString();
|
|
StructBuilder.AddChildContent(TEXT("SupportedAgent"))
|
|
.NameContent()
|
|
[
|
|
SNew(STextBlock)
|
|
.Text(PropName)
|
|
.Font(StructCustomizationUtils.GetRegularFont())
|
|
]
|
|
.ValueContent()
|
|
[
|
|
PropHandle->CreatePropertyValueWidget()
|
|
];
|
|
}
|
|
|
|
continue;
|
|
}
|
|
|
|
StructBuilder.AddChildProperty(PropHandle.ToSharedRef());
|
|
}
|
|
}
|
|
|
|
#undef LOCTEXT_NAMESPACE
|