You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
Removed redundant private include paths from build.cs files. Fixed include paths to be relative to the private or public folders. Hid or removed includes that reached into other private module folders. Updated PublicInclude paths when necessary. #jira #preflight 631e283bec5b0c765fc0ffdb [CL 21960084 by bryan sefcik in ue5-main branch]
188 lines
4.6 KiB
C++
188 lines
4.6 KiB
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
|
|
#include "SAnimEditorBase.h"
|
|
#include "Widgets/Layout/SBorder.h"
|
|
#include "Widgets/Text/STextBlock.h"
|
|
#include "Widgets/Layout/SScrollBox.h"
|
|
#include "Animation/DebugSkelMeshComponent.h"
|
|
#include "Animation/EditorAnimBaseObj.h"
|
|
#include "Animation/AnimCompositeBase.h"
|
|
#include "IDocumentation.h"
|
|
|
|
#include "AnimPreviewInstance.h"
|
|
#include "Animation/BlendSpace.h"
|
|
#include "AnimTimeline/AnimModel.h"
|
|
#include "AnimTimeline/SAnimTimeline.h"
|
|
|
|
#define LOCTEXT_NAMESPACE "AnimEditorBase"
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
// SAnimEditorBase
|
|
|
|
TSharedRef<SWidget> SAnimEditorBase::CreateDocumentAnchor()
|
|
{
|
|
return IDocumentation::Get()->CreateAnchor(TEXT("Engine/Animation/Sequences"));
|
|
}
|
|
|
|
void SAnimEditorBase::Construct(const FArguments& InArgs, const TSharedPtr<class IPersonaPreviewScene>& InPreviewScene)
|
|
{
|
|
PreviewScenePtr = InPreviewScene;
|
|
OnObjectsSelected = InArgs._OnObjectsSelected;
|
|
|
|
SetInputViewRange(0, GetSequenceLength());
|
|
|
|
TSharedPtr<SVerticalBox> AnimVerticalBox;
|
|
|
|
TSharedPtr<SWidget> TimelineToUse;
|
|
if (InArgs._DisplayAnimTimeline)
|
|
{
|
|
check(InArgs._AnimModel.IsValid());
|
|
TimelineToUse = SAssignNew(TimelineWidget, SAnimTimeline, InArgs._AnimModel.ToSharedRef());
|
|
}
|
|
else
|
|
{
|
|
TimelineToUse = SNullWidget::NullWidget;
|
|
}
|
|
|
|
ChildSlot
|
|
[
|
|
SAssignNew(AnimVerticalBox, SVerticalBox)
|
|
+SVerticalBox::Slot()
|
|
.FillHeight(1)
|
|
[
|
|
SNew(SOverlay)
|
|
+SOverlay::Slot()
|
|
[
|
|
SAssignNew(NonScrollEditorPanels, SVerticalBox)
|
|
]
|
|
+SOverlay::Slot()
|
|
[
|
|
TimelineToUse.ToSharedRef()
|
|
]
|
|
]
|
|
];
|
|
|
|
if (InArgs._DisplayAnimScrubBar)
|
|
{
|
|
// If we are an anim sequence, add scrub panel as well
|
|
AnimVerticalBox->AddSlot()
|
|
.AutoHeight()
|
|
.VAlign(VAlign_Bottom)
|
|
[
|
|
SNew(SHorizontalBox)
|
|
+SHorizontalBox::Slot()
|
|
.FillWidth(1)
|
|
[
|
|
ConstructAnimScrubPanel(InArgs._DisplayAnimScrubBarEditing)
|
|
]
|
|
];
|
|
}
|
|
}
|
|
|
|
TSharedRef<SWidget> SAnimEditorBase::ConstructAnimScrubPanel(bool bDisplayAnimScrubBarEditing)
|
|
{
|
|
if(PreviewScenePtr.IsValid())
|
|
{
|
|
return SAssignNew( AnimScrubPanel, SAnimationScrubPanel, PreviewScenePtr.Pin().ToSharedRef() )
|
|
.LockedSequence(Cast<UAnimSequenceBase>(GetEditorObject()))
|
|
.ViewInputMin(this, &SAnimEditorBase::GetViewMinInput)
|
|
.ViewInputMax(this, &SAnimEditorBase::GetViewMaxInput)
|
|
.bDisplayAnimScrubBarEditing(bDisplayAnimScrubBarEditing)
|
|
.OnSetInputViewRange(this, &SAnimEditorBase::SetInputViewRange)
|
|
.bAllowZoom(true);
|
|
}
|
|
|
|
return SNullWidget::NullWidget;
|
|
}
|
|
|
|
void SAnimEditorBase::AddReferencedObjects( FReferenceCollector& Collector )
|
|
{
|
|
EditorObjectTracker.AddReferencedObjects(Collector);
|
|
}
|
|
|
|
UObject* SAnimEditorBase::ShowInDetailsView( UClass* EdClass )
|
|
{
|
|
check(GetEditorObject()!=NULL);
|
|
|
|
UObject *Obj = EditorObjectTracker.GetEditorObjectForClass(EdClass);
|
|
|
|
if(Obj != NULL)
|
|
{
|
|
if(Obj->IsA(UEditorAnimBaseObj::StaticClass()))
|
|
{
|
|
UEditorAnimBaseObj *EdObj = Cast<UEditorAnimBaseObj>(Obj);
|
|
InitDetailsViewEditorObject(EdObj);
|
|
|
|
TArray<UObject*> Objects;
|
|
Objects.Add(EdObj);
|
|
OnObjectsSelected.ExecuteIfBound(Objects);
|
|
}
|
|
}
|
|
return Obj;
|
|
}
|
|
|
|
void SAnimEditorBase::ClearDetailsView()
|
|
{
|
|
TArray<UObject*> Objects;
|
|
OnObjectsSelected.ExecuteIfBound(Objects);
|
|
}
|
|
|
|
FText SAnimEditorBase::GetEditorObjectName() const
|
|
{
|
|
if (GetEditorObject() != NULL)
|
|
{
|
|
return FText::FromString(GetEditorObject()->GetName());
|
|
}
|
|
else
|
|
{
|
|
return LOCTEXT("NoEditorObject", "No Editor Object");
|
|
}
|
|
}
|
|
|
|
void SAnimEditorBase::OnSelectionChanged(const TArray<UObject*>& SelectedItems)
|
|
{
|
|
OnObjectsSelected.ExecuteIfBound(SelectedItems);
|
|
}
|
|
|
|
class UAnimSingleNodeInstance* SAnimEditorBase::GetPreviewInstance() const
|
|
{
|
|
return (GetPreviewScene()->GetPreviewMeshComponent()) ? GetPreviewScene()->GetPreviewMeshComponent()->PreviewInstance : nullptr;
|
|
}
|
|
|
|
float SAnimEditorBase::GetScrubValue() const
|
|
{
|
|
UAnimSingleNodeInstance * PreviewInstance = GetPreviewInstance();
|
|
if (PreviewInstance)
|
|
{
|
|
float CurTime = PreviewInstance->GetCurrentTime();
|
|
return (CurTime);
|
|
}
|
|
else
|
|
{
|
|
return 0.f;
|
|
}
|
|
}
|
|
|
|
void SAnimEditorBase::SetInputViewRange(float InViewMinInput, float InViewMaxInput)
|
|
{
|
|
ViewMaxInput = FMath::Min<float>(InViewMaxInput, GetSequenceLength());
|
|
ViewMinInput = FMath::Max<float>(InViewMinInput, 0.f);
|
|
}
|
|
|
|
float SAnimEditorBase::GetSequenceLength() const
|
|
{
|
|
if (UAnimSequenceBase* AnimSeqBase = Cast<UAnimSequenceBase>(GetEditorObject()))
|
|
{
|
|
return AnimSeqBase->GetPlayLength();
|
|
}
|
|
else if (UBlendSpace* BlendSpaceBase = Cast<UBlendSpace>(GetEditorObject()))
|
|
{
|
|
// Blendspaces use normalized time, so we just return 1 here
|
|
return 1.0f;
|
|
}
|
|
|
|
return 0.f;
|
|
}
|
|
#undef LOCTEXT_NAMESPACE
|