// Copyright Epic Games, Inc. All Rights Reserved. #pragma once #include "CoreMinimal.h" #include "Widgets/SWidget.h" #include "Modules/ModuleInterface.h" #include "Toolkits/AssetEditorToolkit.h" #include "Animation/AnimSequence.h" #include "Editor.h" #include "PersonaDelegates.h" #include "Factories/FbxImportUI.h" #include "SPersonaToolBox.h" #include "IBlendProfilePickerExtender.h" class IMorphTargetViewer; class FBlueprintEditor; class IDetailsView; class IEditableSkeleton; class IPersonaPreviewScene; class IPersonaToolkit; class UAnimBlueprint; class USkeletalMeshComponent; class UPhysicsAsset; class IPinnedCommandList; class FWorkflowAllowedTabSet; class IAssetFamily; class FWorkflowTabFactory; class UBlendSpace; class IAnimSequenceCurveEditor; class IAnimationEditor; class IDetailLayoutBuilder; class FPreviewSceneDescriptionCustomization; struct FAnimAssetFindReplaceConfig; extern const FName PersonaAppName; // Editor mode constants struct PERSONA_API FPersonaEditModes { /** Selection/manipulation of bones & sockets */ const static FEditorModeID SkeletonSelection; }; DECLARE_DELEGATE_TwoParams(FIsRecordingActive, USkeletalMeshComponent* /*Component*/, bool& /* bIsRecording */); DECLARE_DELEGATE_OneParam(FRecord, USkeletalMeshComponent* /*Component*/); DECLARE_DELEGATE_OneParam(FStopRecording, USkeletalMeshComponent* /*Component*/); DECLARE_DELEGATE_TwoParams(FGetCurrentRecording, USkeletalMeshComponent* /*Component*/, class UAnimSequence*& /* OutRecording */); DECLARE_DELEGATE_TwoParams(FGetCurrentRecordingTime, USkeletalMeshComponent* /*Component*/, float& /* OutTime */); DECLARE_DELEGATE_TwoParams(FTickRecording, USkeletalMeshComponent* /*Component*/, float /* DeltaSeconds */); /** Called back when a viewport is created */ DECLARE_DELEGATE_OneParam(FOnViewportCreated, const TSharedRef&); /** Called back when a details panel is created */ DECLARE_DELEGATE_OneParam(FOnDetailsCreated, const TSharedRef&); /** Called back when an anim sequence browser is created */ DECLARE_DELEGATE_OneParam(FOnAnimationSequenceBrowserCreated, const TSharedRef&); /** Called back when a Persona preview scene is created */ DECLARE_MULTICAST_DELEGATE_OneParam(FOnPreviewSceneCreated, const TSharedRef&); /** Called back when a Persona preview scene settings are customized */ DECLARE_MULTICAST_DELEGATE_OneParam(FOnPreviewSceneSettingsCustomized, IDetailLayoutBuilder& DetailBuilder); /** Called back to register tabs */ DECLARE_MULTICAST_DELEGATE_TwoParams(FOnRegisterTabs, FWorkflowAllowedTabSet&, TSharedPtr); /** Called back to register common layout extensions */ DECLARE_MULTICAST_DELEGATE_OneParam(FOnRegisterLayoutExtensions, FLayoutExtender&); /** Initialization parameters for persona toolkits */ struct FPersonaToolkitArgs { /** * Delegate called when the preview scene is created, used to setup the scene * If this is not set, then a default scene will be set up. */ FOnPreviewSceneCreated::FDelegate OnPreviewSceneCreated; /** Whether to create a preview scene */ bool bCreatePreviewScene = true; /** * Delegate called when the preview scene settings are being customized, supplies the IDetailLayoutBuilder * for the user to customize the layout however they wish. */ FOnPreviewSceneSettingsCustomized::FDelegate OnPreviewSceneSettingsCustomized; /** * Set to true if the preview mesh can be associated with a skeleton different from the one being inspected * by Persona. Used for editors that are mostly skeleton agnostic. */ bool bPreviewMeshCanUseDifferentSkeleton = false; FPersonaToolkitArgs() = default; }; struct FAnimDocumentArgs { FAnimDocumentArgs(const TSharedRef& InPreviewScene, const TSharedRef& InPersonaToolkit, const TSharedRef& InEditableSkeleton, FSimpleMulticastDelegate& InOnSectionsChanged) : PreviewScene(InPreviewScene) , PersonaToolkit(InPersonaToolkit) , EditableSkeleton(InEditableSkeleton) , OnSectionsChanged(InOnSectionsChanged) {} /** Required args */ TWeakPtr PreviewScene; TWeakPtr PersonaToolkit; TWeakPtr EditableSkeleton; FSimpleMulticastDelegate& OnSectionsChanged; /** Optional args */ FOnObjectsSelected OnDespatchObjectsSelected; FOnInvokeTab OnDespatchInvokeTab; FSimpleDelegate OnDespatchSectionsChanged; }; struct FBlendSpaceEditorArgs { // Called when a blendspace sample point is removed FOnBlendSpaceSampleRemoved OnBlendSpaceSampleRemoved; // Called when a blendspace sample point is added FOnBlendSpaceSampleAdded OnBlendSpaceSampleAdded; // Called when a blendspace sample point is replaced FOnBlendSpaceSampleReplaced OnBlendSpaceSampleReplaced; // Called when the blendspace canvas is double clicked FOnBlendSpaceNavigateUp OnBlendSpaceNavigateUp; // Called when the blendspace canvas is double clicked FOnBlendSpaceNavigateDown OnBlendSpaceNavigateDown; // Called when the blendspace canvas is double clicked FOnBlendSpaceCanvasDoubleClicked OnBlendSpaceCanvasDoubleClicked; // Called when a blendspace sample point is double clicked FOnBlendSpaceSampleDoubleClicked OnBlendSpaceSampleDoubleClicked; // Called to get the overridden name of a blend sample FOnGetBlendSpaceSampleName OnGetBlendSpaceSampleName; // Allows the target preview position to be programmatically driven TAttribute PreviewPosition; // Allows the current position to be programmatically driven TAttribute PreviewFilteredPosition; // Allows an external widget to be inserted into a sample's tooltip FOnExtendBlendSpaceSampleTooltip OnExtendSampleTooltip; // Allows preview position to drive external node FOnSetBlendSpacePreviewPosition OnSetPreviewPosition; // Status bar to display hint messages in FName StatusBarName = TEXT("AssetEditor.AnimationEditor.MainMenu"); }; struct FBlendSpacePreviewArgs { TAttribute PreviewBlendSpace; // Allows the target preview position to be programatically driven TAttribute PreviewPosition; // Allows the current preview position to be programatically driven TAttribute PreviewFilteredPosition; // Called to get the overridden name of a blend sample FOnGetBlendSpaceSampleName OnGetBlendSpaceSampleName; }; /** Places that viewport text can be placed */ enum class EViewportCorner : uint8 { TopLeft, TopRight, BottomLeft, BottomRight, }; /** Delegate used to provide custom text for the viewport corners */ DECLARE_DELEGATE_RetVal_OneParam(FText, FOnGetViewportText, EViewportCorner /*InViewportCorner*/); DECLARE_DELEGATE_RetVal(TOptional, FAnimationScrubPanel_IsRecordingActive); DECLARE_DELEGATE_RetVal(TOptional, FAnimationScrubPanel_GetRecordingVisibility); DECLARE_DELEGATE_RetVal(bool, FAnimationScrubPanel_StartRecording) DECLARE_DELEGATE_RetVal(bool, FAnimationScrubPanel_StopRecording); DECLARE_DELEGATE_RetVal(TOptional, FAnimationScrubPanel_GetPlaybackMode); DECLARE_DELEGATE_RetVal_OneParam(bool, FAnimationScrubPanel_SetPlaybackMode, int32 /* playback mode */); DECLARE_DELEGATE_RetVal(TOptional, FAnimationScrubPanel_GetPlaybackTime); DECLARE_DELEGATE_RetVal_TwoParams(bool, FAnimationScrubPanel_SetPlaybackTime, float /* InTime */, bool /* StopPlayback */); DECLARE_DELEGATE_RetVal(bool, FAnimationScrubPanel_StepForward); DECLARE_DELEGATE_RetVal(bool, FAnimationScrubPanel_StepBackward); DECLARE_DELEGATE_RetVal(TOptional, FAnimationScrubPanel_GetIsLooping); DECLARE_DELEGATE_RetVal_OneParam(bool, FAnimationScrubPanel_SetIsLooping, bool /* IsLooping */); DECLARE_DELEGATE_RetVal(TOptional, FAnimationScrubPanel_GetPlaybackTimeRange); DECLARE_DELEGATE_RetVal(TOptional, FAnimationScrubPanel_GetNumberOfKeys); /** Struct to provide delegates to change the timeline behavior for certain clients */ struct FAnimationScrubPanelDelegates { /** Determines if recording is currently active */ FAnimationScrubPanel_IsRecordingActive IsRecordingActiveDelegate; /** Determines if the recording button should be visible */ FAnimationScrubPanel_GetRecordingVisibility GetRecordingVisibilityDelegate; /** Starts the recording */ FAnimationScrubPanel_StartRecording StartRecordingDelegate; /** Stops the recording */ FAnimationScrubPanel_StopRecording StopRecordingDelegate; /** Determines if the playback is currently active */ FAnimationScrubPanel_GetPlaybackMode GetPlaybackModeDelegate; /** Sets the playback mode */ FAnimationScrubPanel_SetPlaybackMode SetPlaybackModeDelegate; /** Returns the current playback time */ FAnimationScrubPanel_GetPlaybackTime GetPlaybackTimeDelegate; /** Seeks to a given time */ FAnimationScrubPanel_SetPlaybackTime SetPlaybackTimeDelegate; /** steps on frame / key forward */ FAnimationScrubPanel_StepForward StepForwardDelegate; /** steps on frame / key backward */ FAnimationScrubPanel_StepBackward StepBackwardDelegate; /** Returns the current playback looping flag */ FAnimationScrubPanel_GetIsLooping GetIsLoopingDelegate; /** Sets the playback looping flag */ FAnimationScrubPanel_SetIsLooping SetIsLoopingDelegate; /** Returns the playback time range */ FAnimationScrubPanel_GetPlaybackTimeRange GetPlaybackTimeRangeDelegate; /** Returns the number of keys for this playback */ FAnimationScrubPanel_GetNumberOfKeys GetNumberOfKeysDelegate; }; /** Arguments used to create a persona viewport tab */ struct FPersonaViewportArgs { FPersonaViewportArgs(const TSharedRef& InPreviewScene) : PreviewScene(InPreviewScene) , ContextName(NAME_None) , bShowShowMenu(true) , bShowLODMenu(true) , bShowPlaySpeedMenu(true) , bShowTimeline(true) , bShowStats(true) , bAlwaysShowTransformToolbar(false) , bShowFloorOptions(true) , bShowTurnTable(true) , bShowPhysicsMenu(false) {} /** Required args */ TSharedRef PreviewScene; /** Optional blueprint editor that we can be embedded in */ TSharedPtr BlueprintEditor; /** Delegate fired when the viewport is created */ FOnViewportCreated OnViewportCreated; /** Menu extenders */ TArray> Extenders; /** Delegate used to customize viewport corner text */ FOnGetViewportText OnGetViewportText; /** The context in which we are constructed. Used to persist various settings. */ FName ContextName; /** Whether to show the 'Show' menu */ bool bShowShowMenu; /** Whether to show the 'LOD' menu */ bool bShowLODMenu; /** Whether to show the 'Play Speed' menu */ bool bShowPlaySpeedMenu; /** Whether to show the animation timeline */ bool bShowTimeline; /** Whether to show in-viewport stats */ bool bShowStats; /** Whether we should always show the transform toolbar for this viewport */ bool bAlwaysShowTransformToolbar; /** Whether to show options relating to floor height */ bool bShowFloorOptions; /** Whether to show options relating to turntable */ bool bShowTurnTable; /** Whether to show options relating to physics */ bool bShowPhysicsMenu; /** A structure providing delegates to change the timeline behavior */ FAnimationScrubPanelDelegates TimelineDelegates; }; /** * Persona module manages the lifetime of all instances of Persona editors. */ class FPersonaModule : public IModuleInterface, public IHasMenuExtensibility { public: /** * Called right after the module's DLL has been loaded and the module object has been created */ virtual void StartupModule(); /** * Called before the module is unloaded, right before the module object is destroyed. */ virtual void ShutdownModule(); /** Create a re-usable toolkit that multiple asset editors that are concerned with USkeleton-related data can use */ virtual TSharedRef CreatePersonaToolkit(UObject* InAsset, const FPersonaToolkitArgs& PersonaToolkitArgs, USkeleton* InSkeleton = nullptr) const; virtual TSharedRef CreatePersonaToolkit(USkeleton* InSkeleton, const FPersonaToolkitArgs& PersonaToolkitArgs) const; virtual TSharedRef CreatePersonaToolkit(UAnimationAsset* InAnimationAsset, const FPersonaToolkitArgs& PersonaToolkitArgs) const; virtual TSharedRef CreatePersonaToolkit(USkeletalMesh* InSkeletalMesh, const FPersonaToolkitArgs& PersonaToolkitArgs) const; virtual TSharedRef CreatePersonaToolkit(UAnimBlueprint* InAnimBlueprint, const FPersonaToolkitArgs& PersonaToolkitArgs) const; virtual TSharedRef CreatePersonaToolkit(UPhysicsAsset* InPhysicsAsset, const FPersonaToolkitArgs& PersonaToolkitArgs) const; /** Create an asset family for the supplied persona asset */ virtual TSharedRef CreatePersonaAssetFamily(const UObject* InAsset) const; /** Broadcast event that all asset families need to change */ virtual void BroadcastAssetFamilyChange() const; /** Record that an asset was opened (forward to relevant asset families) */ virtual void RecordAssetOpened(const FAssetData& InAssetData) const; /** Create a shortcut widget for an asset family */ virtual TSharedRef CreateAssetFamilyShortcutWidget(const TSharedRef& InHostingApp, const TSharedRef& InAssetFamily) const; /** Create a details panel tab factory */ virtual TSharedRef CreateDetailsTabFactory(const TSharedRef& InHostingApp, FOnDetailsCreated InOnDetailsCreated) const; /** Create a persona viewport tab factory */ virtual TSharedRef CreatePersonaViewportTabFactory(const TSharedRef& InHostingApp, const FPersonaViewportArgs& InArgs) const; /** Register 4 Persona viewport tab factories */ virtual void RegisterPersonaViewportTabFactories(FWorkflowAllowedTabSet& TabSet, const TSharedRef& InHostingApp, const FPersonaViewportArgs& InArgs) const; /** Create an anim notifies tab factory */ virtual TSharedRef CreateAnimNotifiesTabFactory(const TSharedRef& InHostingApp, const TSharedRef& InEditableSkeleton, FOnObjectsSelected InOnObjectsSelected) const; UE_DEPRECATED(5.0, "Please use the overload that does not take a post-undo delegate") virtual TSharedRef CreateCurveViewerTabFactory(const TSharedRef& InHostingApp, const TSharedPtr& InEditableSkeleton, const TSharedRef& InPreviewScene, FSimpleMulticastDelegate& InOnPostUndo, FOnObjectsSelected InOnObjectsSelected) const; /** Create a skeleton curve viewer tab factory */ virtual TSharedRef CreateCurveViewerTabFactory(const TSharedRef& InHostingApp, const TSharedPtr& InEditableSkeleton, const TSharedRef& InPreviewScene, FOnObjectsSelected InOnObjectsSelected) const; /** Create a skeleton curve metadata editor tab factory */ virtual TSharedRef CreateCurveMetadataEditorTabFactory(const TSharedRef& InHostingApp, UObject* InMetadataHost, const TSharedRef& InPreviewScene, FOnObjectsSelected InOnObjectsSelected) const; /** Create a retarget sources tab factory */ virtual TSharedRef CreateRetargetSourcesTabFactory(const TSharedRef& InHostingApp, const TSharedRef& InEditableSkeleton, FSimpleMulticastDelegate& InOnPostUndo) const; /** Create a tab factory used to configure preview scene settings */ virtual TSharedRef CreateAdvancedPreviewSceneTabFactory(const TSharedRef& InHostingApp, const TSharedRef& InPreviewScene) const; /** Create a tab factory for the animation asset browser */ virtual TSharedRef CreateAnimationAssetBrowserTabFactory(const TSharedRef& InHostingApp, const TSharedRef& InPersonaToolkit, FOnOpenNewAsset InOnOpenNewAsset, FOnAnimationSequenceBrowserCreated InOnAnimationSequenceBrowserCreated, bool bInShowHistory) const; /** Create a tab factory for editing a single object (like an animation asset) */ virtual TSharedRef CreateAssetDetailsTabFactory(const TSharedRef& InHostingApp, FOnGetAsset InOnGetAsset, FOnDetailsCreated InOnDetailsCreated) const; /** Create a tab factory for for previewing morph targets */ virtual TSharedRef CreateMorphTargetTabFactory(const TSharedRef& InHostingApp, const TSharedRef& InPreviewScene, FSimpleMulticastDelegate& OnPostUndo) const; /** Create a tab factory for for previewing morph targets */ virtual TSharedRef CreateMorphTargetTabFactory(const TSharedRef& InHostingApp, TSharedRef InViewerWidget) const; /** Create the default morph target viewer widget*/ virtual TSharedRef CreateDefaultMorphTargetViewerWidget(const TSharedRef& InPreviewScene, FSimpleMulticastDelegate& OnPostUndo) const; /** Create a tab factory for editing anim blueprint preview & defaults */ virtual TSharedRef CreateAnimBlueprintPreviewTabFactory(const TSharedRef& InBlueprintEditor, const TSharedRef& InPreviewScene) const; /** Create a tab factory for the pose watch manager */ virtual TSharedRef CreatePoseWatchTabFactory(const TSharedRef& InBlueprintEditor) const; /** Create a tab factory for editing anim blueprint parent overrides */ virtual TSharedRef CreateAnimBlueprintAssetOverridesTabFactory(const TSharedRef& InBlueprintEditor, UAnimBlueprint* InAnimBlueprint, FSimpleMulticastDelegate& InOnPostUndo) const; UE_DEPRECATED(5.0, "Please use the overload that does not take a post-undo delegate") virtual TSharedRef CreateSkeletonSlotNamesTabFactory(const TSharedRef& InHostingApp, const TSharedRef& InEditableSkeleton, FSimpleMulticastDelegate& InOnPostUndo, FOnObjectSelected InOnObjectSelected) const; /** Create a tab factory for editing slot names and groups */ virtual TSharedRef CreateSkeletonSlotNamesTabFactory(const TSharedRef& InHostingApp, const TSharedRef& InEditableSkeleton, FOnObjectSelected InOnObjectSelected) const; /** Create a toolbox tab factory */ virtual TSharedRef CreatePersonaToolboxTabFactory(const TSharedRef& InHostingApp) const; /** Create a attributes viewer tab factory */ virtual TSharedRef CreateAttributeViewerTabFactory(const TSharedRef& InHostingApp, const TSharedRef& InPreviewScene) const; /** Deprecated */ UE_DEPRECATED(5.0, "Please use the overload that takes a FBlendSpacePreviewArgs struct") virtual TSharedRef CreateBlendSpacePreviewWidget(TAttribute InBlendSpace, TAttribute InBlendPosition, TAttribute InFilteredBlendPosition) const; /** Create a widget to preview a blendspace */ virtual TSharedRef CreateBlendSpacePreviewWidget(const FBlendSpacePreviewArgs& InArgs) const; /** Create a widget to edit a blendspace */ virtual TSharedRef CreateBlendSpaceEditWidget(UBlendSpace* InBlendSpace, const FBlendSpaceEditorArgs& InArgs) const; /** Create a tab factory for editing montage sections */ virtual TSharedRef CreateAnimMontageSectionsTabFactory(const TSharedRef& InHostingApp, const TSharedRef& InPersonaToolkit, FSimpleMulticastDelegate& InOnSectionsChanged) const; /** Create a tab factory for finding and replacing in anim data */ virtual TSharedRef CreateAnimAssetFindReplaceTabFactory(const TSharedRef& InHostingApp, const FAnimAssetFindReplaceConfig& InConfig) const; /** Create a widget for finding and replacing in anim data */ virtual TSharedRef CreateFindReplaceWidget(const FAnimAssetFindReplaceConfig& InConfig) const; /** Create a widget that acts as a document for an animation asset */ virtual TSharedRef CreateEditorWidgetForAnimDocument(const TSharedRef& InHostingApp, UObject* InAnimAsset, const FAnimDocumentArgs& InArgs, FString& OutDocumentLink); /** Create a widget that acts as a curve document for an animation asset */ virtual TSharedRef CreateCurveWidgetForAnimDocument(const TSharedRef& InHostingApp, const TSharedRef& InPreviewScene, UAnimSequenceBase* InAnimSequence, const TSharedPtr& InExternalTimeSliderController, const TSharedPtr& InTabManager); /** Customize a skeletal mesh details panel */ virtual void CustomizeMeshDetails(const TSharedRef& InDetailsView, const TSharedRef& InPersonaToolkit); /** Gets the extensibility managers for outside entities to extend persona editor's menus and toolbars */ virtual TSharedPtr GetMenuExtensibilityManager() {return MenuExtensibilityManager;} virtual TSharedPtr GetToolBarExtensibilityManager() {return ToolBarExtensibilityManager;} /** Import a new asset using the supplied skeleton */ virtual void ImportNewAsset(USkeleton* InSkeleton, EFBXImportType DefaultImportType); UE_DEPRECATED(5.3, "Please use TestSkeletonCurveMetaDataForUse") virtual void TestSkeletonCurveNamesForUse(const TSharedRef& InEditableSkeleton) const { TestSkeletonCurveMetaDataForUse(InEditableSkeleton); } /** Check all animations & skeletal meshes for curve metadata usage */ virtual void TestSkeletonCurveMetaDataForUse(const TSharedRef& InEditableSkeleton) const; /** Apply Compression to list of animations and optionally asks to pick an overrides to the bone compression settings */ virtual void ApplyCompression(TArray>& AnimSequences, bool bPickBoneSettingsOverride); /** Export to FBX files of the list of animations */ virtual bool ExportToFBX(TArray>& AnimSequences, USkeletalMesh* SkeletalMesh); /** Add looping interpolation to the list of animations */ virtual void AddLoopingInterpolation(TArray>& AnimSequences); UE_DEPRECATED(4.24, "Function renamed, please use CustomizeBlueprintEditorDetails") virtual void CustomizeSlotNodeDetails(const TSharedRef& InDetailsView, FOnInvokeTab InOnInvokeTab) { CustomizeBlueprintEditorDetails(InDetailsView, InOnInvokeTab); } /** Customize the details of a slot node for the specified details view */ virtual void CustomizeBlueprintEditorDetails(const TSharedRef& InDetailsView, FOnInvokeTab InOnInvokeTab); /** Create a Persona editor mode manager. Should be destroyed using plain ol' delete. Note: Only FPersonaEditMode-derived modes should be used with this manager! */ virtual class IPersonaEditorModeManager* CreatePersonaEditorModeManager(); /** Delegate used to query whether recording is active */ virtual FIsRecordingActive& OnIsRecordingActive() { return IsRecordingActiveDelegate; } /** Delegate used to start recording animation */ virtual FRecord& OnRecord() { return RecordDelegate; } /** Delegate used to stop recording animation */ virtual FStopRecording& OnStopRecording() { return StopRecordingDelegate; } /** Delegate used to get the currently recording animation */ virtual FGetCurrentRecording& OnGetCurrentRecording() { return GetCurrentRecordingDelegate; } /** Delegate used to get the currently recording animation time */ virtual FGetCurrentRecordingTime& OnGetCurrentRecordingTime() { return GetCurrentRecordingTimeDelegate; } /** Delegate broadcast when a preview scene is created */ virtual FOnPreviewSceneCreated& OnPreviewSceneCreated() { return OnPreviewSceneCreatedDelegate; } /** Delegates that allow customizing the mesh details layout and are called from within PersonaMeshDetails' CustomizeDetails(). */ DECLARE_DELEGATE_TwoParams(FOnCustomizeMeshDetails, IDetailLayoutBuilder& DetailLayout, TWeakObjectPtr SkeletalMesh); virtual TArray& GetCustomizeMeshDetailsDelegates() { return CustomizeMeshDetailLayoutDelegates; } /** Settings for AddCommonToolbarExtensions */ struct FCommonToolMenuExtensionArgs { FCommonToolMenuExtensionArgs() : bPreviewMesh(true) , bPreviewAnimation(true) , bReferencePose(false) , bCreateAsset(true) {} /** Adds a shortcut to setup a preview mesh to override the current display */ bool bPreviewMesh; /** Adds a shortcut to setup a preview animation to override the current display */ bool bPreviewAnimation; /** Adds a shortcut to set the character back to reference pose (also clears all bone modifications) */ bool bReferencePose; /** Adds a combo menu to allow other anim assets to be created */ bool bCreateAsset; }; typedef FCommonToolMenuExtensionArgs FCommonToolbarExtensionArgs; /** Add common menu extensions */ virtual void AddCommonMenuExtensions(UToolMenu* InToolMenu, const FCommonToolMenuExtensionArgs& InArgs = FCommonToolMenuExtensionArgs()); /** Add common toolbar extensions */ virtual void AddCommonToolbarExtensions(UToolMenu* InToolMenu, const FCommonToolMenuExtensionArgs& InArgs = FCommonToolMenuExtensionArgs()); /** Add common toobar extensions (legacy support) - DEPRECATED */ virtual void AddCommonToolbarExtensions(FToolBarBuilder& InToolbarBuilder, TSharedRef PersonaToolkit, const FCommonToolbarExtensionArgs& InArgs = FCommonToolbarExtensionArgs()); /** Register common layout extensions */ virtual FOnRegisterLayoutExtensions& OnRegisterLayoutExtensions() { return OnRegisterLayoutExtensionsDelegate; } /** Register common tabs */ virtual FOnRegisterTabs& OnRegisterTabs() { return OnRegisterTabsDelegate; } /** Create a widget that can choose multiple curve names. Derives available names from the asset registry list of assets that use the specified skeleton. */ virtual TSharedRef CreateMultiCurvePicker(const USkeleton* InSkeleton, FOnCurvesPicked InOnCurvesPicked, FIsCurveNameMarkedForExclusion InIsCurveNameMarkedForExclusion = FIsCurveNameMarkedForExclusion()); /** Create a widget that can choose a curve name. Derives available names from the asset registry list of assets that use the specified skeleton. */ virtual TSharedRef CreateCurvePicker(const USkeleton* InSkeleton, FOnCurvePicked InOnCurvePicked, FIsCurveNameMarkedForExclusion InIsCurveNameMarkedForExclusion = FIsCurveNameMarkedForExclusion()); UE_DEPRECATED(5.3, "Please use CreateCurvePicker that takes a const USkeleton*") virtual TSharedRef CreateCurvePicker(TSharedRef InEditableSkeleton, FOnCurvePicked InOnCurvePicked, FIsCurveNameMarkedForExclusion InIsCurveNameMarkedForExclusion = FIsCurveNameMarkedForExclusion()); /** Create a widget that can choose a notify name. @see SSkeletonAnimNotifies. */ virtual TSharedRef CreateSkeletonNotifyPicker(FOnNotifyPicked InOnNotifyPicked, TSharedPtr InEditableSkeleton = nullptr, TSharedPtr InHostingApp = nullptr, bool bInShowSyncMarkers = false, bool bInShowNotifies = true, bool bInShowCompatibleSkeletonAssets = true, bool bInShowOtherAssets = true); // Struct allowing the anim notify system to interact with an asset type struct FNotifyHostAssetParameters { // Delegate called to replace a notify event with another using FOnReplaceNotify = TDelegate; FOnReplaceNotify OnReplaceNotify; // Delegate called to remove a notify event using FOnRemoveNotify = TDelegate; FOnRemoveNotify OnRemoveNotify; }; // Register an asset type that can contain named anim notifies virtual void RegisterNotifyHostAsset(const FTopLevelAssetPath& InAssetClassPath, const FNotifyHostAssetParameters& InParameters); // Unregister an asset type that can contain named anim notifies virtual void UnregisterNotifyHostAsset(const FTopLevelAssetPath& InAssetClassPath); // Find registered notify host parameters by asset class virtual const FNotifyHostAssetParameters* FindNotifyHostAsset(UObject* InAsset); // Get all the registered notify host class paths virtual TArray GetAllNotifyHostAssetClassPaths() const; // Get the version information for the notify host asset registry virtual uint32 GetNotifyHostAssetVersion() const; public: // Register a new blend provider provider in the editor picker for FBlendProfileInterfaceWrapper PERSONA_API void RegisterBlendProfilePickerExtender(TSharedPtr Extender); PERSONA_API void UnregisterBlendProfilePickerExtender(const FName ExtenderId); const TArray>& GetCustomBlendProfiles() const; private: TArray> CustomBlendProfiles; /** When a new anim notify blueprint is created, this will handle post creation work such as adding non-event default nodes */ void HandleNewAnimNotifyBlueprintCreated(UBlueprint* InBlueprint); /** When a new anim notify state blueprint is created, this will handle post creation work such as adding non-event default nodes */ void HandleNewAnimNotifyStateBlueprintCreated(UBlueprint* InBlueprint); /** Options for asset creation */ enum class EPoseSourceOption : uint8 { ReferencePose, CurrentPose, CurrentAnimation_AnimData, CurrentAnimation_PreviewMesh, Max }; static TSharedRef< SWidget > GenerateCreateAssetMenu(TWeakPtr InWeakPersonaToolkit); static void FillCreateAnimationMenu(FMenuBuilder& MenuBuilder, TWeakPtr InWeakPersonaToolkit); static void FillCreateAnimationFromCurrentAnimationMenu(FMenuBuilder& MenuBuilder, TWeakPtr InWeakPersonaToolkit); static void FillCreatePoseAssetMenu(FMenuBuilder& MenuBuilder, TWeakPtr InWeakPersonaToolkit); static void FillInsertPoseMenu(FMenuBuilder& MenuBuilder, TWeakPtr InWeakPersonaToolkit); static void InsertCurrentPoseToAsset(const FAssetData& NewPoseAssetData, TWeakPtr InWeakPersonaToolkit); static bool CreateAnimation(const TArray NewAssets, const EPoseSourceOption Option, TWeakPtr InWeakPersonaToolkit); static bool CreatePoseAsset(const TArray NewAssets, const EPoseSourceOption Option, TWeakPtr InWeakPersonaToolkit); static bool HandleAssetCreated(const TArray NewAssets); void RegisterToolMenuExtensions(); private: TSharedPtr MenuExtensibilityManager; TSharedPtr ToolBarExtensibilityManager; TArray CustomizeMeshDetailLayoutDelegates; /** Delegate used to query whether recording is active */ FIsRecordingActive IsRecordingActiveDelegate; /** Delegate used to start recording animation */ FRecord RecordDelegate; /** Delegate used to stop recording animation */ FStopRecording StopRecordingDelegate; /** Delegate used to get the currently recording animation */ FGetCurrentRecording GetCurrentRecordingDelegate; /** Delegate used to get the currently recording animation time */ FGetCurrentRecordingTime GetCurrentRecordingTimeDelegate; /** Delegate used to tick the skelmesh component recording */ FTickRecording TickRecordingDelegate; /** Delegate broadcast when a preview scene is created */ FOnPreviewSceneCreated OnPreviewSceneCreatedDelegate; /** Delegate broadcast to register common layout extensions */ FOnRegisterLayoutExtensions OnRegisterLayoutExtensionsDelegate; /** Delegate broadcast to register common tabs */ FOnRegisterTabs OnRegisterTabsDelegate; /** Parameters for notify hosts */ TMap NotifyHostParameters; /** Version counter for NotifyHostParameters */ uint32 NotifyHostAssetVersion = 0; };