// Copyright Epic Games, Inc. All Rights Reserved. #pragma once #include "Containers/Array.h" #include "Containers/ArrayView.h" #include "Internationalization/Text.h" #include "Misc/Attribute.h" #include "PropertyCustomizationHelpers.h" #include "Templates/SharedPointer.h" #include "Types/SlateEnums.h" #include "UObject/WeakObjectPtrTemplates.h" #include "Widgets/DeclarativeSyntaxSupport.h" #include "Widgets/SCompoundWidget.h" class FAssetThumbnail; class FAssetThumbnailPool; class FDragDropEvent; class IPropertyHandle; class SComboButton; class SErrorHint; class SWidget; class UClass; class UDialogueVoice; class UObject; struct FAssetData; struct FGeometry; class SDialogueVoicePropertyEditor : public SCompoundWidget { public: SLATE_BEGIN_ARGS( SDialogueVoicePropertyEditor ) : _IsEditable(true) , _ShouldCenterThumbnail(false) {} SLATE_ARGUMENT( bool, IsEditable ) SLATE_ARGUMENT( bool, ShouldCenterThumbnail ) SLATE_EVENT( FOnShouldFilterAsset, OnShouldFilterAsset ) SLATE_END_ARGS() void Construct( const FArguments& InArgs, const TSharedRef& InPropertyHandle, const TSharedRef& InAssetThumbnailPool ); virtual void Tick( const FGeometry& AllottedGeometry, const double InCurrentTime, const float InDeltaTime ) override; FText GetDialogueVoiceDescription() const; private: FText OnGetToolTip() const; TSharedRef OnGetMenuContent(); void CloseMenu(); /** * Called when an asset is being dragged over this item * * @param InObject The asset being dragged over */ bool OnIsAssetAcceptableForDrop( TArrayView InAssets ) const; /** * Called when an asset dropped onto the list item * * @param InObject The asset being dropped */ void OnAssetDropped( const FDragDropEvent&, TArrayView InAssets ); bool CanUseSelectedAsset(); void OnUseSelectedDialogueVoice(); void ReplaceDialogueVoice( const UDialogueVoice* const NewDialogueVoice ); bool CanBrowseToAsset(); void OnBrowseToDialogueVoice(); void OnGetAllowedClassesForAssetPicker( TArray& OutClasses ); void OnAssetSelectedFromPicker( const FAssetData& InAssetData ); /** * Called to get the dialogue voice path that should be displayed */ FText GetDialogueVoicePath() const; /** * Called when the dialogue voice path is changed by a user */ void OnDialogueVoicePathChanged( const FText& NewText, ETextCommit::Type TextCommitType ); /** * Finds the asset in the content browser */ void GoToAssetInContentBrowser( TWeakObjectPtr Object ); protected: TSharedPtr DialogueVoicePropertyHandle; bool IsEditable; TSharedPtr AssetThumbnail; TSharedPtr AssetThumbnailPool; TSharedPtr ComboButton; FOnShouldFilterAsset OnShouldFilterAsset; }; class STargetsSummaryWidget : public SCompoundWidget { public: SLATE_BEGIN_ARGS( STargetsSummaryWidget ) : _IsEditable(true) , _WrapWidth(0.0f) {} SLATE_ARGUMENT( bool, IsEditable ) SLATE_ATTRIBUTE( float, WrapWidth ) SLATE_END_ARGS() void Construct( const FArguments& InArgs, const TSharedRef& InPropertyHandle, const TSharedRef& InAssetThumbnailPool ); virtual void Tick( const FGeometry& AllottedGeometry, const double InCurrentTime, const float InDeltaTime ) override; FText GetDialogueVoiceDescription() const; private: float GetPreferredWidthForWrapping() const; bool FilterTargets( const struct FAssetData& InAssetData ); void GenerateContent(); private: TSharedPtr TargetsPropertyHandle; bool IsEditable; TAttribute WrapWidth; TSharedPtr AssetThumbnailPool; TArray DisplayedTargets; float AllottedWidth; }; class SDialogueContextHeaderWidget : public SCompoundWidget { public: SLATE_BEGIN_ARGS( SDialogueContextHeaderWidget ) {} SLATE_END_ARGS() void Construct( const FArguments& InArgs, const TSharedRef& InPropertyHandle, const TSharedRef& InAssetThumbnailPool ); virtual void Tick( const FGeometry& AllottedGeometry, const double InCurrentTime, const float InDeltaTime ) override; private: bool IsSpeakerValid() const; bool IsTargetSetValid() const; void AddTargetButton_OnClick(); void RemoveTargetButton_OnClick(); void EmptyTargetsButton_OnClick(); private: TSharedPtr ContextPropertyHandle; TSharedPtr SpeakerErrorHint; TSharedPtr TargetsErrorHint; };