// Copyright Epic Games, Inc. All Rights Reserved. #pragma once #include "Containers/Array.h" #include "Containers/BitArray.h" #include "Containers/Set.h" #include "Containers/SparseArray.h" #include "CoreTypes.h" #include "Delegates/Delegate.h" #include "EditorUndoClient.h" #include "HAL/PlatformCrt.h" #include "Input/Reply.h" #include "Internationalization/Text.h" #include "Layout/Visibility.h" #include "Misc/Optional.h" #include "Styling/SlateTypes.h" #include "Templates/SharedPointer.h" #include "Templates/TypeHash.h" #include "Templates/UnrealTemplate.h" #include "Types/SlateEnums.h" #include "UObject/WeakObjectPtr.h" #include "UObject/WeakObjectPtrTemplates.h" #include "Widgets/DeclarativeSyntaxSupport.h" #include "Widgets/SCompoundWidget.h" #include "Widgets/Views/SListView.h" class ITableRow; class SButton; class SHorizontalBox; class STableViewBase; class SWidget; class UClothingAssetCommon; class UClothingAssetBase; class USkeletalMesh; struct FAssetData; struct FClothPhysicalMeshData; struct FPointWeightMap; struct FClothingAssetListItem { TWeakObjectPtr ClothingAsset; }; struct FClothingMaskListItem { FClothingMaskListItem() : LodIndex(INDEX_NONE) , MaskIndex(INDEX_NONE) {} FPointWeightMap* GetMask(); FClothPhysicalMeshData* GetMeshData(); USkeletalMesh* GetOwningMesh(); TWeakObjectPtr ClothingAsset; int32 LodIndex; int32 MaskIndex; }; typedef SListView> SAssetList; typedef SListView> SMaskList; DECLARE_DELEGATE_ThreeParams(FOnClothAssetSelectionChanged, TWeakObjectPtr, int32, int32); class SClothAssetSelector : public SCompoundWidget, public FEditorUndoClient { public: SLATE_BEGIN_ARGS(SClothAssetSelector) {} SLATE_EVENT(FOnClothAssetSelectionChanged, OnSelectionChanged) SLATE_END_ARGS() ~SClothAssetSelector(); void Construct(const FArguments& InArgs, USkeletalMesh* InMesh); TWeakObjectPtr GetSelectedAsset() const; int32 GetSelectedLod() const; int32 GetSelectedMask() const; /** FEditorUndoClient interface */ virtual void PostUndo(bool bSuccess) override; virtual void PostRedo(bool bSuccess) override; /** End FEditorUndoClient interface */ protected: /* Copies clothing setup from source SkelMesh */ void OnCopyClothingAssetSelected(const FAssetData& AssetData); // Generate a drop-down for choosing the source skeletal mesh for copying cloth assets TSharedRef OnGenerateSkeletalMeshPickerForClothCopy(); EVisibility GetAssetHeaderButtonTextVisibility() const; EVisibility GetMaskHeaderButtonTextVisibility() const; TSharedRef OnGetLodMenu(); FText GetLodButtonText() const; TSharedRef OnGenerateWidgetForClothingAssetItem(TSharedPtr InItem, const TSharedRef& OwnerTable); void OnAssetListSelectionChanged(TSharedPtr InSelectedItem, ESelectInfo::Type InSelectInfo); TSharedRef OnGenerateWidgetForMaskItem(TSharedPtr InItem, const TSharedRef& OwnerTable); void OnMaskSelectionChanged(TSharedPtr InSelectedItem, ESelectInfo::Type InSelectInfo); // Mask manipulation FReply AddNewMask(); bool CanAddNewMask() const; void OnRefresh(); void RefreshAssetList(); void RefreshMaskList(); TOptional GetCurrentKernelRadius() const; void OnCurrentKernelRadiusChanged(float InValue); void OnCurrentKernelRadiusCommitted(float InValue, ETextCommit::Type CommitType); bool CurrentKernelRadiusIsEnabled() const; ECheckBoxState GetCurrentUseMultipleInfluences() const; void OnCurrentUseMultipleInfluencesChanged(ECheckBoxState InValue); ECheckBoxState GetCurrentSmoothTransition() const; void OnCurrentSmoothTransitionChanged(ECheckBoxState InValue); bool IsValidClothLodSelected() const; void OnClothingLodSelected(int32 InNewLod); // Setters for the list selections so we can handle list selections changing properly void SetSelectedAsset(TWeakObjectPtr InSelectedAsset); void SetSelectedLod(int32 InLodIndex, bool bRefreshMasks = true); void SetSelectedMask(int32 InMaskIndex); USkeletalMesh* Mesh; TSharedPtr NewMaskButton; TSharedPtr AssetList; TSharedPtr MaskList; TSharedPtr AssetHeaderBox; TSharedPtr MaskHeaderBox; TArray> AssetListItems; TArray> MaskListItems; // Currently selected clothing asset, Lod Index and Mask index TWeakObjectPtr SelectedAsset; int32 SelectedLod; int32 SelectedMask; FOnClothAssetSelectionChanged OnSelectionChanged; // Handle for mesh event callback when clothing changes. FDelegateHandle MeshClothingChangedHandle; private: bool CanSelectLod() const; bool CanEditDeformer() const; };