#include "PawnEditor/Customization/PwnInteractableActorCustomization.h" #include "PropertyCustomizationHelpers.h" #include "PropertyHandle.h" #include "Interaction/PwnInteractable.h" TSharedRef UPwnInteractableActorCustomization::MakeInstance() { return MakeShareable(new UPwnInteractableActorCustomization()); } void UPwnInteractableActorCustomization::CustomizeHeader(TSharedRef StructPropertyHandle, FDetailWidgetRow& HeaderRow, IPropertyTypeCustomizationUtils& StructCustomizationUtils) { const TSharedPtr ActorReferenceProperty = StructPropertyHandle->GetChildHandle(TEXT("ActorReference")); HeaderRow .NameContent() [ StructPropertyHandle->CreatePropertyNameWidget() ] .ValueContent() [ SNew(SObjectPropertyEntryBox) .PropertyHandle(ActorReferenceProperty) .OnShouldFilterActor(FOnShouldFilterActor::CreateStatic(OnShouldFilterActor)) .AllowedClass(AActor::StaticClass()) .AllowClear(true) ]; } void UPwnInteractableActorCustomization::CustomizeChildren(TSharedRef StructPropertyHandle, IDetailChildrenBuilder& StructBuilder, IPropertyTypeCustomizationUtils& StructCustomizationUtils) { // Do nothing } bool UPwnInteractableActorCustomization::OnShouldFilterActor(const AActor* Actor) { return Actor->GetClass()->ImplementsInterface(UPwnInteractable::StaticClass()); }