Add Games File
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
// Copyright Epic Games, Inc. All Rights Reserved.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "Factories/Factory.h"
|
||||
#include "LipSyncMappingAssetFactory.generated.h"
|
||||
|
||||
UCLASS()
|
||||
class FUNNYGIRLEDITOR_API ULipSyncMappingAssetFactory : public UFactory
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
ULipSyncMappingAssetFactory();
|
||||
|
||||
virtual UObject* FactoryCreateNew(UClass* InClass, UObject* InParent, FName InName, EObjectFlags Flags, UObject* Context, FFeedbackContext* Warn) override;
|
||||
virtual FString GetDefaultNewAssetName() const override;
|
||||
};
|
||||
@@ -0,0 +1,16 @@
|
||||
// Copyright Epic Games, Inc. All Rights Reserved.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "AssetTypeActions_Base.h"
|
||||
|
||||
class FLipSyncMappingAssetTypeActions : public FAssetTypeActions_Base
|
||||
{
|
||||
public:
|
||||
virtual FText GetName() const override;
|
||||
virtual FColor GetTypeColor() const override;
|
||||
virtual UClass* GetSupportedClass() const override;
|
||||
virtual uint32 GetCategories() override;
|
||||
virtual FText GetAssetDescription(const FAssetData& AssetData) const override;
|
||||
};
|
||||
@@ -0,0 +1,49 @@
|
||||
// Copyright Epic Games, Inc. All Rights Reserved.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "Toolkits/AssetEditorToolkit.h"
|
||||
|
||||
class IDetailsView;
|
||||
class SDockTab;
|
||||
class UMorphPresetDataAsset;
|
||||
|
||||
class FMorphPresetEditorController;
|
||||
class SMorphPresetTimelinePanel;
|
||||
class SMorphPresetViewportPanel;
|
||||
|
||||
class FUNNYGIRLEDITOR_API FMorphPresetAssetEditor : public FAssetEditorToolkit
|
||||
{
|
||||
public:
|
||||
static const FName EditorName;
|
||||
static const FName ViewportTabId;
|
||||
static const FName TimelineTabId;
|
||||
static const FName DetailsTabId;
|
||||
|
||||
void InitMorphPresetAssetEditor(const EToolkitMode::Type Mode, const TSharedPtr<class IToolkitHost>& InitToolkitHost, UMorphPresetDataAsset* InAsset);
|
||||
|
||||
virtual void RegisterTabSpawners(const TSharedRef<FTabManager>& InTabManager) override;
|
||||
virtual void UnregisterTabSpawners(const TSharedRef<FTabManager>& InTabManager) override;
|
||||
|
||||
virtual FName GetToolkitFName() const override;
|
||||
virtual FText GetBaseToolkitName() const override;
|
||||
virtual FString GetWorldCentricTabPrefix() const override;
|
||||
virtual FLinearColor GetWorldCentricTabColorScale() const override;
|
||||
|
||||
UMorphPresetDataAsset* GetPreset() const { return Preset.Get(); }
|
||||
|
||||
private:
|
||||
TSharedRef<SDockTab> SpawnTab_Viewport(const FSpawnTabArgs& Args);
|
||||
TSharedRef<SDockTab> SpawnTab_Timeline(const FSpawnTabArgs& Args);
|
||||
TSharedRef<SDockTab> SpawnTab_Details(const FSpawnTabArgs& Args);
|
||||
void HandleDetailsChanged(const struct FPropertyChangedEvent& PropertyChangedEvent);
|
||||
void HandlePresetChanged();
|
||||
|
||||
private:
|
||||
TWeakObjectPtr<UMorphPresetDataAsset> Preset;
|
||||
TSharedPtr<FMorphPresetEditorController> EditorController;
|
||||
TSharedPtr<SMorphPresetViewportPanel> ViewportWidget;
|
||||
TSharedPtr<SMorphPresetTimelinePanel> TimelineWidget;
|
||||
TSharedPtr<IDetailsView> DetailsView;
|
||||
};
|
||||
@@ -0,0 +1,19 @@
|
||||
// Copyright Epic Games, Inc. All Rights Reserved.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "Factories/Factory.h"
|
||||
#include "MorphPresetAssetFactory.generated.h"
|
||||
|
||||
UCLASS()
|
||||
class FUNNYGIRLEDITOR_API UMorphPresetAssetFactory : public UFactory
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
UMorphPresetAssetFactory();
|
||||
|
||||
virtual UObject* FactoryCreateNew(UClass* InClass, UObject* InParent, FName InName, EObjectFlags Flags, UObject* Context, FFeedbackContext* Warn) override;
|
||||
virtual FString GetDefaultNewAssetName() const override;
|
||||
};
|
||||
@@ -0,0 +1,17 @@
|
||||
// Copyright Epic Games, Inc. All Rights Reserved.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "AssetTypeActions_Base.h"
|
||||
|
||||
class FMorphPresetAssetTypeActions : public FAssetTypeActions_Base
|
||||
{
|
||||
public:
|
||||
virtual FText GetName() const override;
|
||||
virtual FColor GetTypeColor() const override;
|
||||
virtual UClass* GetSupportedClass() const override;
|
||||
virtual uint32 GetCategories() override;
|
||||
virtual FText GetAssetDescription(const FAssetData& AssetData) const override;
|
||||
virtual void OpenAssetEditor(const TArray<UObject*>& InObjects, TSharedPtr<IToolkitHost> EditWithinLevelEditor = TSharedPtr<IToolkitHost>()) override;
|
||||
};
|
||||
@@ -0,0 +1,37 @@
|
||||
// Copyright Epic Games, Inc. All Rights Reserved.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "IDetailCustomization.h"
|
||||
|
||||
class IDetailLayoutBuilder;
|
||||
class IPropertyUtilities;
|
||||
class SMultiLineEditableTextBox;
|
||||
class UMorphPresetDataAsset;
|
||||
|
||||
class FUNNYGIRLEDITOR_API FMorphPresetDetailsCustomization : public IDetailCustomization
|
||||
{
|
||||
public:
|
||||
static TSharedRef<IDetailCustomization> MakeInstance();
|
||||
|
||||
virtual void CustomizeDetails(IDetailLayoutBuilder& DetailBuilder) override;
|
||||
|
||||
private:
|
||||
void RefreshJsonFromPreset();
|
||||
void ApplyJsonToPreset(const FString& JsonString);
|
||||
FText GetStatusText() const;
|
||||
FSlateColor GetStatusColor() const;
|
||||
FReply OnApplyJsonClicked();
|
||||
FReply OnResetJsonClicked();
|
||||
void HandleJsonTextChanged(const FText& NewText);
|
||||
|
||||
private:
|
||||
TWeakObjectPtr<UMorphPresetDataAsset> Preset;
|
||||
TSharedPtr<SMultiLineEditableTextBox> JsonTextBox;
|
||||
TSharedPtr<IPropertyUtilities> PropertyUtilities;
|
||||
FString CachedJsonText;
|
||||
FText StatusText;
|
||||
bool bIsUpdatingJsonText = false;
|
||||
bool bLastApplySucceeded = true;
|
||||
};
|
||||
@@ -0,0 +1,99 @@
|
||||
// Copyright Epic Games, Inc. All Rights Reserved.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
|
||||
class FUICommandList;
|
||||
class AActor;
|
||||
class IPersonaPreviewScene;
|
||||
class IPersonaToolkit;
|
||||
class UAnimationAsset;
|
||||
class UAnimSequence;
|
||||
class ULipSyncComponent;
|
||||
class ULipSyncMappingDataAsset;
|
||||
class UMorphControllerComponent;
|
||||
class UMorphPresetDataAsset;
|
||||
class USoundBase;
|
||||
class USkeletalMesh;
|
||||
|
||||
class FUNNYGIRLEDITOR_API FMorphPresetEditorController : public TSharedFromThis<FMorphPresetEditorController>
|
||||
{
|
||||
public:
|
||||
explicit FMorphPresetEditorController(UMorphPresetDataAsset* InPreset);
|
||||
~FMorphPresetEditorController();
|
||||
|
||||
void Initialize();
|
||||
|
||||
UMorphPresetDataAsset* GetPreset() const;
|
||||
USkeletalMesh* GetPreviewMesh() const;
|
||||
bool SetPreviewMesh(USkeletalMesh* InPreviewMesh);
|
||||
|
||||
TSharedPtr<IPersonaToolkit> GetPersonaToolkit() const { return PersonaToolkit; }
|
||||
TSharedPtr<IPersonaPreviewScene> GetPreviewScene() const;
|
||||
TSharedRef<FUICommandList> GetCommandList() const { return CommandList.ToSharedRef(); }
|
||||
|
||||
float GetTimelineLength() const;
|
||||
float GetCurrentTime() const;
|
||||
FText GetPreviewStatusText() const { return PreviewStatusText; }
|
||||
void SetCurrentTime(float InTime);
|
||||
bool TryGetHeadLocation(FVector& OutHeadLocation) const;
|
||||
bool ResolvePreviewBoneName(FName InBoneName, FName& OutBoneName) const;
|
||||
void NotifyPresetEdited(bool bBroadcastPresetChanged = true);
|
||||
|
||||
bool IsPlaying() const { return bIsPlaying; }
|
||||
void SetPlaying(bool bInPlaying);
|
||||
void TogglePlaying();
|
||||
void Tick(float DeltaTime);
|
||||
|
||||
USoundBase* GetLipSyncPreviewSound() const;
|
||||
bool SetLipSyncPreviewSound(USoundBase* InSound);
|
||||
ULipSyncMappingDataAsset* GetLipSyncPreviewMapping() const;
|
||||
bool SetLipSyncPreviewMapping(ULipSyncMappingDataAsset* InMapping);
|
||||
float GetLipSyncPreviewSmoothness() const { return LipSyncPreviewSmoothness; }
|
||||
void SetLipSyncPreviewSmoothness(float InSmoothness);
|
||||
FText GetLipSyncPreviewTranscript() const { return LipSyncPreviewTranscript; }
|
||||
void SetLipSyncPreviewTranscript(const FText& InTranscript);
|
||||
bool PlayLipSyncPreviewAudio(float StartTime = 0.0f);
|
||||
void StopLipSyncPreviewAudio();
|
||||
bool IsLipSyncPreviewAudioPlaying() const;
|
||||
|
||||
DECLARE_MULTICAST_DELEGATE(FOnChanged);
|
||||
FOnChanged& OnPreviewSceneChanged() { return PreviewSceneChanged; }
|
||||
FOnChanged& OnPlaybackStateChanged() { return PlaybackStateChanged; }
|
||||
FOnChanged& OnPresetChanged() { return PresetChanged; }
|
||||
|
||||
private:
|
||||
void RebuildPreviewScene();
|
||||
void RebuildPreviewAnimation();
|
||||
void ApplyPresetToPreview();
|
||||
void RefreshPreviewAnimationPose();
|
||||
UAnimationAsset* ResolvePreviewAnimationAsset() const;
|
||||
float GetPreviewAnimationPosition() const;
|
||||
bool IsPreviewAnimationCompatible(UAnimationAsset* PreviewAsset) const;
|
||||
void RebuildLipSyncPreviewComponents();
|
||||
void DestroyLipSyncPreviewComponents();
|
||||
void TickLipSyncPreviewComponents(float DeltaTime);
|
||||
ULipSyncMappingDataAsset* ResolveLipSyncPreviewMapping() const;
|
||||
|
||||
private:
|
||||
TWeakObjectPtr<UMorphPresetDataAsset> Preset;
|
||||
TSharedPtr<IPersonaToolkit> PersonaToolkit;
|
||||
TSharedPtr<FUICommandList> CommandList;
|
||||
TStrongObjectPtr<UAnimSequence> PreviewAnimation;
|
||||
TStrongObjectPtr<ULipSyncMappingDataAsset> DefaultLipSyncPreviewMapping;
|
||||
TWeakObjectPtr<ULipSyncMappingDataAsset> LipSyncPreviewMapping;
|
||||
TWeakObjectPtr<USoundBase> LipSyncPreviewSound;
|
||||
TWeakObjectPtr<AActor> LipSyncPreviewActor;
|
||||
TWeakObjectPtr<UMorphControllerComponent> LipSyncPreviewMorphController;
|
||||
TWeakObjectPtr<ULipSyncComponent> LipSyncPreviewComponent;
|
||||
bool bIsPlaying = false;
|
||||
bool bLipSyncPreviewAudioActive = false;
|
||||
float CurrentTime = 0.0f;
|
||||
float LipSyncPreviewSmoothness = 0.55f;
|
||||
FText LipSyncPreviewTranscript;
|
||||
FText PreviewStatusText;
|
||||
FOnChanged PreviewSceneChanged;
|
||||
FOnChanged PlaybackStateChanged;
|
||||
FOnChanged PresetChanged;
|
||||
};
|
||||
@@ -0,0 +1,40 @@
|
||||
// Copyright Epic Games, Inc. All Rights Reserved.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "Widgets/SCompoundWidget.h"
|
||||
|
||||
class UMorphPresetDataAsset;
|
||||
|
||||
/**
|
||||
* Editor Window для импорта морф таргетов из JSON в Morph Preset.
|
||||
* Режим Embedded: передай Preset — пикер скрыт, редактор привязан к ассету.
|
||||
* Режим Standalone: Preset = nullptr — показывается пикер (Tools -> Morph Preset Editor).
|
||||
*/
|
||||
class FUNNYGIRLEDITOR_API SMorphPresetEditorWindow : public SCompoundWidget
|
||||
{
|
||||
public:
|
||||
SLATE_BEGIN_ARGS(SMorphPresetEditorWindow) {}
|
||||
SLATE_ARGUMENT(UMorphPresetDataAsset*, Preset)
|
||||
SLATE_END_ARGS()
|
||||
|
||||
void Construct(const FArguments& InArgs);
|
||||
|
||||
/** Только в embedded режиме (Preset задан): обновить JSON из ассета. */
|
||||
void RefreshFromPreset();
|
||||
|
||||
private:
|
||||
TSharedRef<SWidget> BuildContent();
|
||||
|
||||
/** true = внутри окна ассета (preset передан), false = отдельное окно с пикером */
|
||||
bool bEmbeddedMode = false;
|
||||
FReply OnApplyClicked();
|
||||
FReply OnExportClicked();
|
||||
void OnPresetChanged(const FAssetData& AssetData);
|
||||
FString GetSelectedPresetPath() const;
|
||||
|
||||
TSharedPtr<class SObjectPropertyEntryBox> PresetPicker;
|
||||
TSharedPtr<class SMultiLineEditableTextBox> JsonTextBox;
|
||||
TWeakObjectPtr<UMorphPresetDataAsset> SelectedPreset;
|
||||
};
|
||||
@@ -0,0 +1,81 @@
|
||||
// Copyright Epic Games, Inc. All Rights Reserved.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "ITransportControl.h"
|
||||
#include "Input/Events.h"
|
||||
#include "Input/Reply.h"
|
||||
#include "Widgets/SCompoundWidget.h"
|
||||
|
||||
class FMorphPresetEditorController;
|
||||
template<typename ItemType> class SListView;
|
||||
|
||||
class FUNNYGIRLEDITOR_API SMorphPresetTimelinePanel : public SCompoundWidget
|
||||
{
|
||||
public:
|
||||
SLATE_BEGIN_ARGS(SMorphPresetTimelinePanel) {}
|
||||
SLATE_ARGUMENT(TSharedPtr<FMorphPresetEditorController>, Controller)
|
||||
SLATE_END_ARGS()
|
||||
|
||||
void Construct(const FArguments& InArgs);
|
||||
virtual ~SMorphPresetTimelinePanel() override;
|
||||
void Refresh();
|
||||
virtual bool SupportsKeyboardFocus() const override { return true; }
|
||||
virtual FReply OnKeyDown(const FGeometry& MyGeometry, const FKeyEvent& InKeyEvent) override;
|
||||
|
||||
bool HasSelectedClips() const;
|
||||
int32 GetSelectedClipCount() const;
|
||||
bool IsClipSelected(int32 ClipIndex) const;
|
||||
void ToggleClipSelection(int32 ClipIndex);
|
||||
void SelectOnlyClip(int32 ClipIndex);
|
||||
void ClearClipSelection();
|
||||
void SelectAllClips();
|
||||
void BeginMoveSelectedClips(int32 PrimaryClipIndex);
|
||||
void ApplyMoveSelectedClips(float DeltaTime);
|
||||
void EndMoveSelectedClips();
|
||||
void DeleteSelectedClips();
|
||||
TSharedRef<SWidget> BuildClipInspectorWidget(int32 ClipIndex);
|
||||
void RegisterTimelineScrollBox(TSharedPtr<class SScrollBox> InTimelineScrollBox);
|
||||
|
||||
private:
|
||||
void RefreshAvailableMorphs();
|
||||
FReply OnPlayPauseClicked();
|
||||
FReply OnStopClicked();
|
||||
FReply OnAddMorphClicked();
|
||||
FReply OnDeleteSelectedClicked();
|
||||
EPlaybackMode::Type GetPlaybackMode() const;
|
||||
void OnLoopCheckStateChanged(ECheckBoxState NewState);
|
||||
ECheckBoxState GetLoopCheckState() const;
|
||||
void HandleTimeChanged(float InNewValue);
|
||||
TSharedRef<SWidget> BuildTimelineWidget();
|
||||
TSharedRef<SWidget> BuildMorphLibraryWidget();
|
||||
TSharedRef<class ITableRow> GenerateMorphRow(TSharedPtr<FString> Item, const TSharedRef<class STableViewBase>& OwnerTable) const;
|
||||
void HandleMorphSelectionChanged(TSharedPtr<FString> Item, ESelectInfo::Type SelectInfo);
|
||||
void HandleMorphDoubleClicked(TSharedPtr<FString> Item);
|
||||
bool CanAddSelectedMorph() const;
|
||||
struct FMorphTimelineClip* GetMutableClipByIndex(int32 ClipIndex) const;
|
||||
const struct FMorphTimelineClip* GetClipByIndex(int32 ClipIndex) const;
|
||||
int32 GetPrimarySelectedClipIndex() const;
|
||||
void NotifyClipChanged(bool bRefreshTimeline = false);
|
||||
void HandleClipWeightChanged(float NewValue);
|
||||
void HandleClipStartTimeChanged(float NewValue);
|
||||
void HandleClipDurationChanged(float NewValue);
|
||||
EActiveTimerReturnType HandleActiveTimer(double InCurrentTime, float InDeltaTime);
|
||||
FText GetPlayPauseText() const;
|
||||
float GetCurrentTime() const;
|
||||
TOptional<float> GetTimelineMaxTime() const;
|
||||
void HandleControllerChanged();
|
||||
|
||||
private:
|
||||
TSharedPtr<FMorphPresetEditorController> Controller;
|
||||
TSharedPtr<class SBox> TimelineContainer;
|
||||
TSharedPtr<class SScrollBox> TimelineScrollBox;
|
||||
TArray<TSharedPtr<FString>> AvailableMorphItems;
|
||||
TSharedPtr<FString> SelectedMorphItem;
|
||||
TSharedPtr<SListView<TSharedPtr<FString>>> MorphListView;
|
||||
TSet<int32> SelectedClipIndices;
|
||||
TMap<int32, float> DragInitialClipStartTimes;
|
||||
int32 DragPrimaryClipIndex = INDEX_NONE;
|
||||
float TimelineScrollOffset = 0.0f;
|
||||
};
|
||||
@@ -0,0 +1,47 @@
|
||||
// Copyright Epic Games, Inc. All Rights Reserved.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "Widgets/SCompoundWidget.h"
|
||||
|
||||
class FMorphPresetEditorController;
|
||||
class ULipSyncMappingDataAsset;
|
||||
class USoundBase;
|
||||
class USkeletalMesh;
|
||||
|
||||
class FUNNYGIRLEDITOR_API SMorphPresetViewportPanel : public SCompoundWidget
|
||||
{
|
||||
public:
|
||||
SLATE_BEGIN_ARGS(SMorphPresetViewportPanel) {}
|
||||
SLATE_ARGUMENT(TSharedPtr<FMorphPresetEditorController>, Controller)
|
||||
SLATE_ARGUMENT(TSharedPtr<class FAssetEditorToolkit>, AssetEditorToolkit)
|
||||
SLATE_END_ARGS()
|
||||
|
||||
void Construct(const FArguments& InArgs);
|
||||
virtual ~SMorphPresetViewportPanel() override;
|
||||
|
||||
private:
|
||||
void RebuildContent();
|
||||
void OnPreviewMeshChanged(const struct FAssetData& AssetData);
|
||||
void OnLipSyncSoundChanged(const struct FAssetData& AssetData);
|
||||
void OnLipSyncMappingChanged(const struct FAssetData& AssetData);
|
||||
FString GetSelectedPreviewMeshPath() const;
|
||||
FString GetSelectedLipSyncSoundPath() const;
|
||||
FString GetSelectedLipSyncMappingPath() const;
|
||||
FReply OnPlayLipSyncClicked();
|
||||
FReply OnStopLipSyncClicked();
|
||||
FText GetLipSyncPlaybackText() const;
|
||||
float GetLipSyncSmoothness() const;
|
||||
void OnLipSyncSmoothnessChanged(float NewValue);
|
||||
FText GetLipSyncTranscript() const;
|
||||
void OnLipSyncTranscriptChanged(const FText& NewText);
|
||||
FText GetPreviewStatusText() const;
|
||||
EVisibility GetPreviewStatusVisibility() const;
|
||||
EActiveTimerReturnType HandleActiveTimer(double InCurrentTime, float InDeltaTime);
|
||||
|
||||
private:
|
||||
TSharedPtr<FMorphPresetEditorController> Controller;
|
||||
TWeakPtr<class FAssetEditorToolkit> AssetEditorToolkit;
|
||||
TSharedPtr<class SBorder> RootBorder;
|
||||
};
|
||||
Reference in New Issue
Block a user