Files
Jurre deBaare a5305f76a3 Contributed by Yupeng.Zhang from The Coalition:
Animation Modifier : Fix Modifier on Skeleton
Transfered the ownership of 'PreviouslyAppliedModifier' from an animation modifier instance to the animation sequence being applied.
This solved the following issue:
- Modifier on Skeleton cause USkeleton dirtied everytime the modifier is applied to an animation sequence.
- Modifier on Skeleton cannot be re-apply or reverted correctly.
- CanRevert & OutOfDate status for Modifier on Skeleton was not reflect the true status of all animation sequences referencing that skeleton.

- CurrentAnimSequence/CurrentSkeleton was not set on OnRevert()
- IAnimationDataController::FScopedBracket was not open on OnRevert() before re-apply modifier
- Stateful animation modifier can now be reverted correctly (Applied modifier instance is nolonger reverted after OnApply call)

#preflight 63775e0ff514e1ded99ef095

[CL 23191977 by Jurre deBaare in ue5-main branch]
2022-11-18 05:35:47 -05:00

74 lines
2.0 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#include "SModifierItemRow.h"
#include "Animation/Skeleton.h"
#include "AnimationModifier.h"
#include "Containers/UnrealString.h"
#include "Delegates/Delegate.h"
#include "Layout/Children.h"
#include "Misc/Attribute.h"
#include "SlotBase.h"
#include "Styling/AppStyle.h"
#include "Templates/ChooseClass.h"
#include "Templates/SubclassOf.h"
#include "UObject/WeakObjectPtrTemplates.h"
#include "Widgets/Images/SImage.h"
#include "Widgets/SBoxPanel.h"
#include "Widgets/SCompoundWidget.h"
#include "Widgets/Text/STextBlock.h"
class STableViewBase;
struct FGeometry;
struct FPointerEvent;
void SModifierItemRow::Construct(const FArguments& InArgs, const TSharedRef<STableViewBase>& InOwnerTableView, const ModifierListviewItem& Item)
{
STableRow<ModifierListviewItem>::ConstructInternal(STableRow::FArguments(), InOwnerTableView);
OnOpenModifier = InArgs._OnOpenModifier;
InternalItem = Item;
ChildSlot
[
SNew(SHorizontalBox)
+ SHorizontalBox::Slot()
.AutoWidth()
.Padding(6.0f, 2.0f, 0.0f, 2.0f)
[
SNew(SImage)
.Image(InternalItem->OuterClass == USkeleton::StaticClass() ? FAppStyle::GetBrush("ClassIcon.Skeleton") : FAppStyle::GetBrush("ClassIcon.AnimSequence"))
]
+ SHorizontalBox::Slot()
.AutoWidth()
.Padding(6.0f, 3.0f, 0.0f, 2.0f)
[
SNew(STextBlock)
.Text(this, &SModifierItemRow::GetInstanceText)
.OnDoubleClicked(this, &SModifierItemRow::OnDoubleClicked)
]
];
}
FReply SModifierItemRow::OnDoubleClicked(const FGeometry& MyGeometry, const FPointerEvent& PointerEvent)
{
OnOpenModifier.ExecuteIfBound(InternalItem->Instance);
return FReply::Handled();
}
FText SModifierItemRow::GetInstanceText() const
{
FString LabelString = InternalItem->Class->GetName();
static const FString Postfix("_C");
// Ensure we remove the modifier class postfix
LabelString.RemoveFromEnd(Postfix);
if (InternalItem->OutOfDate)
{
LabelString.Append(" (Out of Date)");
}
return FText::FromString(LabelString);
}