// Copyright 2019-Present LexLiu. All Rights Reserved. #include "CoreMinimal.h" #include "IPropertyTypeCustomization.h" #include "PropertyCustomizationHelpers.h" #include "IPropertyUtilities.h" #include "Widgets/SWidget.h" #pragma once class UActorComponent; class AActor; struct FLGUIComponentReference; /** * */ class FLGUIComponentReferenceCustomization : public IPropertyTypeCustomization { public: static TSharedRef MakeInstance(); /** IDetailCustomization interface */ virtual void CustomizeHeader(TSharedRef PropertyHandle, FDetailWidgetRow& HeaderRow, IPropertyTypeCustomizationUtils& CustomizationUtils) override; virtual void CustomizeChildren(TSharedRef PropertyHandle, IDetailChildrenBuilder& ChildBuilder, IPropertyTypeCustomizationUtils& CustomizationUtils) override; private: void BuildClassFilters(); TSharedPtr PropertyUtilites; TSharedRef OnGetMenu(TSharedPtr CompProperty, TSharedPtr CompNameProperty, TArray Components); void OnSelectComponent(TSharedPtr CompProperty, TSharedPtr CompNameProperty, UActorComponent* Comp); FText GetButtonText(TSharedPtr TargetCompHandle, TArray Components)const; void OnCopy(); void OnPaste(); void OnHelperActorValueChange(); void RegenerateContentWidget(); void OnResetToDefaultClicked(); bool IsAllowedComponentClass(UActorComponent* InComp); TSharedPtr PropertyHandle; /** Classes that can be used with this property */ TArray AllowedComponentClassFilters; /** Classes that can NOT be used with this property */ TArray DisallowedComponentClassFilters; TSharedPtr ContentWidgetBox; bool bIsInWorld = false; TArray ComponentReferenceInstances; static TWeakObjectPtr CopiedHelperActor; static TWeakObjectPtr CopiedTargetComp; static UClass* CopiedHelperClass; };