// Copyright Epic Games, Inc. All Rights Reserved. #pragma once #include "AdvancedPreviewScene.h" #include "Animation/Skeleton.h" #include "Containers/Array.h" #include "Delegates/IDelegateInstance.h" #include "HAL/Platform.h" #include "IDetailCustomization.h" #include "Input/Reply.h" #include "Internationalization/Text.h" #include "Layout/Visibility.h" #include "Misc/Attribute.h" #include "Templates/SharedPointer.h" #include "Types/SlateEnums.h" #include "UObject/NameTypes.h" #include "UObject/WeakObjectPtr.h" #include "UObject/WeakObjectPtrTemplates.h" #include "Widgets/DeclarativeSyntaxSupport.h" #include "Widgets/SCompoundWidget.h" class FEditorViewportClient; class FString; class IDetailCategoryBuilder; class IDetailChildrenBuilder; class IDetailLayoutBuilder; class IPropertyHandle; class STextBlock; class SViewport; class SWidget; class UAnimSequence; class USceneComponent; struct FGeometry; class FAnimSequenceDetails : public IDetailCustomization { public: /** Makes a new instance of this detail layout class for a specific detail view requesting it */ static TSharedRef MakeInstance(); /** IDetailCustomization interface */ virtual void CustomizeDetails( IDetailLayoutBuilder& DetailBuilder ) override; /** Create an override for the supplide Property */ void CreateOverridenProperty(IDetailLayoutBuilder& DetailBuilder, IDetailCategoryBuilder& AdditiveSettingsCategory, TSharedPtr PropertyHandle, TAttribute VisibilityAttribute); /** Functions to control property visibility */ EVisibility ShouldShowRefPoseType() const; EVisibility ShouldShowRefAnimInfo() const; EVisibility ShouldShowRefFrameIndex() const; virtual ~FAnimSequenceDetails(); private: TWeakObjectPtr TargetSkeleton; // additive setting handler TSharedPtr AdditiveAnimTypeHandle; TSharedPtr RefPoseTypeHandle; TSharedPtr RefPoseSeqHandle; TSharedPtr RefFrameIndexHandle; // retarget source handler TSharedPtr RetargetSourceNameHandler; TSharedPtr RetargetSourceAssetHandle; TSharedPtr RetargetSourceComboBox; TArray< TSharedPtr< FString > > RetargetSourceComboList; TSharedRef MakeRetargetSourceComboWidget( TSharedPtr InItem ); void OnRetargetSourceChanged( TSharedPtr NewSelection, ESelectInfo::Type SelectInfo ); FText GetRetargetSourceComboBoxContent() const; FText GetRetargetSourceComboBoxToolTip() const; void OnRetargetSourceComboOpening(); TSharedPtr GetRetargetSourceString(FName RetargetSourceName) const; EVisibility UpdateRetargetSourceAssetDataVisibility() const; FReply UpdateRetargetSourceAssetData(); USkeleton::FOnRetargetSourceChanged OnDelegateRetargetSourceChanged; FDelegateHandle OnDelegateRetargetSourceChangedDelegateHandle; void RegisterRetargetSourceChanged(); void DelegateRetargetSourceChanged(); // *** Animation Track Names *** TSharedPtr AnimationTrackNamesHandle; TArray AnimationTrackNamesList; void GenerateAnimationTrackNameArrayElementWidget(TSharedRef PropertyHandle, int32 ArrayIndex, IDetailChildrenBuilder& ChildrenBuilder, IDetailLayoutBuilder* DetailLayout); // button handler for Apply Compression // cache all anim sequences that are selected // but I need to know them before compress TArray< TWeakObjectPtr > SelectedAnimSequences; }; /////////////////////////////////////////////////// class SAnimationRefPoseViewport : public SCompoundWidget { public: SLATE_BEGIN_ARGS( SAnimationRefPoseViewport ) {} SLATE_ARGUMENT( USkeleton*, Skeleton ) SLATE_ARGUMENT( TSharedPtr, AnimRefPropertyHandle ) SLATE_ARGUMENT( TSharedPtr, RefPoseTypeHandle ) SLATE_ARGUMENT( TSharedPtr, RefFrameIndexPropertyHandle ) SLATE_END_ARGS() public: SAnimationRefPoseViewport(); virtual ~SAnimationRefPoseViewport(); void Construct(const FArguments& InArgs); virtual void Tick( const FGeometry& AllottedGeometry, const double InCurrentTime, const float InDeltaTime ) override; void RefreshViewport(); private: /** Called to tick the preview during playback */ void OnTickPreview( double InCurrentTime, float InDeltaTime ); void InitSkeleton(); TSharedPtr LevelViewportClient; TSharedPtr AnimRefPropertyHandle; TSharedPtr RefPoseTypeHandle; TSharedPtr RefFrameIndexPropertyHandle; /** Slate viewport for rendering and I/O */ //TSharedPtr Viewport; TSharedPtr ViewportWidget; TSharedPtr SceneViewport; /** Skeleton */ USkeleton* TargetSkeleton; UAnimSequence* PreviewAnimationSequence; FAdvancedPreviewScene PreviewScene; class FFXSystemInterface* FXSystem; TSharedPtr Description; class UDebugSkelMeshComponent* PreviewComponent; void CleanupComponent(USceneComponent* Component); bool IsVisible() const; public: /** Get Min/Max Input of value **/ float GetViewMinInput() const; float GetViewMaxInput() const; class UAnimSingleNodeInstance* GetPreviewInstance() const; /** Optional, additional values to draw on the timeline **/ TArray GetBars() const; void OnBarDrag(int32 index, float newPos); };