2019-12-26 15:33:43 -05:00
|
|
|
// Copyright Epic Games, Inc. All Rights Reserved.
|
2019-06-11 07:01:48 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
#include "SAnimStreamableEditor.h"
|
|
|
|
|
#include "IDocumentation.h"
|
2020-01-22 17:58:55 -05:00
|
|
|
#include "AnimModel_AnimSequenceBase.h"
|
|
|
|
|
#include "SAnimTimeline.h"
|
2019-06-11 07:01:48 -04:00
|
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
2020-01-22 17:58:55 -05:00
|
|
|
// SAnimStreamableEditor
|
2019-06-11 07:01:48 -04:00
|
|
|
|
|
|
|
|
TSharedRef<SWidget> SAnimStreamableEditor::CreateDocumentAnchor()
|
|
|
|
|
{
|
2022-01-25 14:22:58 -05:00
|
|
|
return IDocumentation::Get()->CreateAnchor(TEXT("AnimatingObjects"));
|
2019-06-11 07:01:48 -04:00
|
|
|
}
|
|
|
|
|
|
2020-01-22 17:58:55 -05:00
|
|
|
void SAnimStreamableEditor::Construct(const FArguments& InArgs, const TSharedRef<class IPersonaPreviewScene>& InPreviewScene, const TSharedRef<class IEditableSkeleton>& InEditableSkeleton, const TSharedRef<FUICommandList>& InCommandList)
|
2019-06-11 07:01:48 -04:00
|
|
|
{
|
|
|
|
|
StreamableAnim = InArgs._StreamableAnim;
|
|
|
|
|
check(StreamableAnim);
|
|
|
|
|
|
2020-01-22 17:58:55 -05:00
|
|
|
AnimModel = MakeShared<FAnimModel_AnimSequenceBase>(InPreviewScene, InEditableSkeleton, InCommandList, StreamableAnim);
|
|
|
|
|
AnimModel->OnSelectObjects = FOnObjectsSelected::CreateSP(this, &SAnimEditorBase::OnSelectionChanged);
|
|
|
|
|
AnimModel->OnInvokeTab = InArgs._OnInvokeTab;
|
2019-06-11 07:01:48 -04:00
|
|
|
|
2020-01-22 17:58:55 -05:00
|
|
|
AnimModel->OnEditCurves = FOnEditCurves::CreateLambda([this, InOnEditCurves = InArgs._OnEditCurves](UAnimSequenceBase* InAnimSequence, const TArray<IAnimationEditor::FCurveEditInfo>& InCurveInfo, const TSharedPtr<ITimeSliderController>& InExternalTimeSliderController)
|
|
|
|
|
{
|
|
|
|
|
InOnEditCurves.ExecuteIfBound(InAnimSequence, InCurveInfo, TimelineWidget->GetTimeSliderController());
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
AnimModel->Initialize();
|
|
|
|
|
|
|
|
|
|
SAnimEditorBase::Construct(SAnimEditorBase::FArguments()
|
|
|
|
|
.OnObjectsSelected(InArgs._OnObjectsSelected)
|
|
|
|
|
.AnimModel(AnimModel),
|
|
|
|
|
InPreviewScene);
|
|
|
|
|
|
|
|
|
|
if (GEditor)
|
2019-06-11 07:01:48 -04:00
|
|
|
{
|
|
|
|
|
GEditor->RegisterForUndo(this);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
SAnimStreamableEditor::~SAnimStreamableEditor()
|
|
|
|
|
{
|
2020-01-22 17:58:55 -05:00
|
|
|
if (GEditor)
|
2019-06-11 07:01:48 -04:00
|
|
|
{
|
|
|
|
|
GEditor->UnregisterForUndo(this);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-01-22 17:58:55 -05:00
|
|
|
void SAnimStreamableEditor::PostUndo(bool bSuccess)
|
2019-06-11 07:01:48 -04:00
|
|
|
{
|
|
|
|
|
PostUndoRedo();
|
|
|
|
|
}
|
|
|
|
|
|
2020-01-22 17:58:55 -05:00
|
|
|
void SAnimStreamableEditor::PostRedo(bool bSuccess)
|
2019-06-11 07:01:48 -04:00
|
|
|
{
|
|
|
|
|
PostUndoRedo();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void SAnimStreamableEditor::PostUndoRedo()
|
|
|
|
|
{
|
2020-01-22 17:58:55 -05:00
|
|
|
GetPreviewScene()->SetPreviewAnimationAsset(StreamableAnim);
|
2019-06-11 07:01:48 -04:00
|
|
|
|
2020-01-22 17:58:55 -05:00
|
|
|
AnimModel->RefreshTracks();
|
2019-06-11 07:01:48 -04:00
|
|
|
}
|