Files
UnrealEngineUWP/Engine/Source/Editor/DetailCustomizations/Private/AnimStateNodeDetails.cpp
roland munguia 7dc3bb57a2 State machine entry, exit, fully blended in, and fully blended out anim node functions.
Additional changes:
- Added warnings for users using anim state events since we want to push towards using the state node functions.
- Added support for anim nodes to show any bound functions and not have them hardcoded.
- Added base context type for FAnimExecutionContext.
- Now users can specify the string for the default binding name of a function member reference in a BP by using the "DefaultBindingName" metadata tag. This will give the functionality to avoid having the default binding name be "NewFunction" and instead use the input string from the metadata tag.

#jira UE-184572
#rb Thomas.Sarkanen, jose.villarroel, aaron.cox
#preflight 646e6a836c2a2532b1f91efd

[CL 25631664 by roland munguia in ue5-main branch]
2023-05-25 18:06:26 -04:00

76 lines
2.5 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#include "AnimStateNodeDetails.h"
#include "DetailCategoryBuilder.h"
#include "DetailLayoutBuilder.h"
#include "DetailWidgetRow.h"
#include "Fonts/SlateFontInfo.h"
#include "HAL/Platform.h"
#include "Internationalization/Internationalization.h"
#include "Misc/Attribute.h"
#include "Widgets/DeclarativeSyntaxSupport.h"
#include "Widgets/Text/STextBlock.h"
#include "Widgets/Images/SImage.h"
#include "Widgets/Layout/SBox.h"
#include "Widgets/SToolTip.h"
class IDetailCustomization;
#define LOCTEXT_NAMESPACE "FAnimStateNodeDetails"
/////////////////////////////////////////////////////////////////////////
TSharedRef<IDetailCustomization> FAnimStateNodeDetails::MakeInstance()
{
return MakeShareable( new FAnimStateNodeDetails );
}
void FAnimStateNodeDetails::CustomizeDetails( IDetailLayoutBuilder& DetailBuilder )
{
IDetailCategoryBuilder& SegmentCategory = DetailBuilder.EditCategory("Animation State", LOCTEXT("AnimationStateCategoryTitle", "Animation State") );
GenerateAnimationStateEventRow(SegmentCategory, LOCTEXT("EnteredAnimationStateEventLabel", "Entered State Event"), TEXT("StateEntered"));
GenerateAnimationStateEventRow(SegmentCategory, LOCTEXT("ExitedAnimationStateEventLabel", "Left State Event"), TEXT("StateLeft"));
GenerateAnimationStateEventRow(SegmentCategory, LOCTEXT("FullyBlendedAnimationStateEventLabel", "Fully Blended State Event"), TEXT("StateFullyBlended"));
DetailBuilder.HideProperty("StateEntered");
DetailBuilder.HideProperty("StateLeft");
DetailBuilder.HideProperty("StateFullyBlended");
}
void FAnimStateNodeDetails::GenerateAnimationStateEventRow(IDetailCategoryBuilder& SegmentCategory,const FText& StateEventLabel, const FString& TransitionName)
{
const FSlateBrush* WarningIcon = FAppStyle::GetBrush("Icons.WarningWithColor");
SegmentCategory.AddCustomRow( StateEventLabel)
[
SNew(SHorizontalBox)
.ToolTipText(LOCTEXT("AnimStateEventDeprecatedTooltip", "This is no longer recommended. The recommended approach is to use the anim node function versions."))
.Visibility(EVisibility::Visible)
+SHorizontalBox::Slot()
.VAlign(VAlign_Center)
.AutoWidth()
[
SNew( STextBlock )
.Text( StateEventLabel )
.Font( IDetailLayoutBuilder::GetDetailFontBold() )
]
+SHorizontalBox::Slot()
.VAlign(VAlign_Center)
.AutoWidth()
.HAlign(HAlign_Right)
.Padding(4.0f, 0.0f, 0.0f, 0.0f)
[ SNew(SImage)
.Image(WarningIcon)
]
];
CreateTransitionEventPropertyWidgets(SegmentCategory, TransitionName);
}
#undef LOCTEXT_NAMESPACE