Files
UnrealEngineUWP/Engine/Source/Editor/Persona/Private/SPoseAssetNameWidget.cpp
Thomas Sarkanen 502797ca50 Animation Curve Runtime & Editor Improvements
Runtime notes:
- Removes 'smart name' usage across the animation systems.
- Changed curve blending from a uniform array (sized per skeleton) to a sparse array of sorted named values. Blends and other combiners are performed using a dual iteration 'tape merge'.
- Skeleton curves are no longer guaranteed to cover all curve names that can be found at runtime.

Editor notes:
- Curve metadata (flags, bone links etc.) is still present on the skeleton, but can also now exist on a skeletal mesh
- Curve metadata (for morph targets) is still populated on import
- Curves can now be used arbitrarily at runtime

New features:
- New Find/Replace dialog that allows for batch-replacing curves and notifies across all of a project's assets
- New curve debugger tab in various Persona editors that allows for viewing curve values live. This also now allows viewing curves for specific pose watches.
- Pose watches now output curve tracks to the Rewind Debugger

#rb Jurre.deBaare,Nicholas.Frechette,Sara.Schvartzman,Helge.Mathee,Kiaran.Ritchie,Jaime.Cifuentes,Martin.Wilson,Keith.Yerex,Andrean.Franc (and more!)
#jira UE-167776
#jira UE-173716
#jira UE-110407
#preflight 63fc98c81206d91a2bc3ab90
#preflight 63f3ad4f81646f1f24c240c2

[CL 24421496 by Thomas Sarkanen in ue5-main branch]
2023-02-27 07:20:58 -05:00

103 lines
2.6 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#include "SPoseAssetNameWidget.h"
#define LOCTEXT_NAMESPACE "SPoseAssetNameWidget"
#define DEFAULTTEXT TEXT("None Selected")
void SPoseAssetNameWidget::Construct(const FArguments& InArgs)
{
PoseAsset = InArgs._PoseAsset;
OnSelectionChanged = InArgs._OnSelectionChanged;
ChildSlot
[
SAssignNew(BasePoseComboBox, SComboBox< TSharedPtr<FString> >)
.OptionsSource(&BasePoseComboList)
.OnGenerateWidget(this, &SPoseAssetNameWidget::MakeBasePoseComboWidget)
.OnSelectionChanged(this, &SPoseAssetNameWidget::SelectionChanged)
.OnComboBoxOpening(this, &SPoseAssetNameWidget::OnBasePoseComboOpening)
.ContentPadding(3.f)
.Content()
[
SNew(STextBlock)
.Text(this, &SPoseAssetNameWidget::GetBasePoseComboBoxContent)
.ToolTipText(this, &SPoseAssetNameWidget::GetBasePoseComboBoxToolTip)
]
];
RefreshBasePoseChanged();
}
TSharedRef<SWidget> SPoseAssetNameWidget::MakeBasePoseComboWidget(TSharedPtr<FString> InItem)
{
return SNew(STextBlock).Text(FText::FromString(*InItem));
}
void SPoseAssetNameWidget::RefreshBasePoseChanged()
{
if (PoseAsset.IsValid())
{
BasePoseComboList.Reset();
// add pose names
// go through profile and see if it has mine
for (const FName& PoseName : PoseAsset->GetPoseFNames())
{
BasePoseComboList.Add(MakeShareable(new FString(PoseName.ToString())));
}
}
// if nothing in combo, make sure to add empty text
if (BasePoseComboList.Num() == 0)
{
BasePoseComboList.Add(MakeShareable(new FString(DEFAULTTEXT)));
}
// should we trigger selection? Or The SetSelectedItem should trigger it?
BasePoseComboBox->RefreshOptions();
// test null item
BasePoseComboBox->SetSelectedItem(BasePoseComboList[0]);
}
void SPoseAssetNameWidget::OnBasePoseComboOpening()
{
// do I have to do this?
TSharedPtr<FString> ComboStringPtr = BasePoseComboBox->GetSelectedItem();
if (ComboStringPtr.IsValid())
{
BasePoseComboBox->SetSelectedItem(ComboStringPtr);
}
}
FText SPoseAssetNameWidget::GetBasePoseComboBoxContent() const
{
if (BasePoseComboList.Num() > 0)
{
return FText::FromString(*BasePoseComboBox->GetSelectedItem().Get());
}
return FText();
}
FText SPoseAssetNameWidget::GetBasePoseComboBoxToolTip() const
{
return LOCTEXT("BasePoseComboToolTip", "Select Pose");
}
void SPoseAssetNameWidget::SetPoseAsset(UPoseAsset* NewPoseAsset)
{
PoseAsset = NewPoseAsset;
RefreshBasePoseChanged();
}
void SPoseAssetNameWidget::SelectionChanged(TSharedPtr<FString> PoseName, ESelectInfo::Type SelectionType)
{
if (PoseName.IsValid() && *PoseName.Get() != DEFAULTTEXT)
{
OnSelectionChanged.ExecuteIfBound(PoseName, SelectionType);
}
}
#undef LOCTEXT_NAMESPACE