You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
Refactored FindField into FindUField and FindFProperty to avoid confusion caused by the fact that FindField<UField> will no longer return FProperties. #jira UE-90683 #rb Steve.Robb #tests Basic editor functionality test, cooked and ran PC client and server, bot soak tests for two hours #ROBOMERGE-OWNER: robert.manuszewski #ROBOMERGE-AUTHOR: robert.manuszewski #ROBOMERGE-SOURCE: CL 12190998 in //UE4/Release-4.25/... via CL 12190999 #ROBOMERGE-BOT: RELEASE (Release-4.25Plus -> Main) (v661-12148976) [CL 12191300 by robert manuszewski in Main branch]
41 lines
1.4 KiB
C++
41 lines
1.4 KiB
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
#include "Animation/WidgetAnimationDelegateBinding.h"
|
|
#include "UMGPrivate.h"
|
|
#include "Blueprint/UserWidget.h"
|
|
#include "Animation/WidgetAnimation.h"
|
|
|
|
|
|
UWidgetAnimationDelegateBinding::UWidgetAnimationDelegateBinding(const FObjectInitializer& ObjectInitializer)
|
|
: Super(ObjectInitializer)
|
|
{
|
|
}
|
|
|
|
void UWidgetAnimationDelegateBinding::BindDynamicDelegates(UObject* InInstance) const
|
|
{
|
|
if (UUserWidget* InUserWidget = Cast<UUserWidget>(InInstance))
|
|
{
|
|
for (int32 BindIndex = 0; BindIndex < WidgetAnimationDelegateBindings.Num(); ++BindIndex)
|
|
{
|
|
const FBlueprintWidgetAnimationDelegateBinding& Binding = WidgetAnimationDelegateBindings[BindIndex];
|
|
|
|
FObjectProperty* AnimationProp = FindFProperty<FObjectProperty>(InUserWidget->GetClass(), Binding.AnimationToBind);
|
|
if (AnimationProp)
|
|
{
|
|
UWidgetAnimation* AnimationPropData = Cast<UWidgetAnimation>(AnimationProp->GetObjectPropertyValue_InContainer(InUserWidget));
|
|
if (ensure(AnimationPropData))
|
|
{
|
|
FWidgetAnimationDynamicEvent Delegate;
|
|
Delegate.BindUFunction(InUserWidget, Binding.FunctionNameToBind);
|
|
|
|
InUserWidget->BindToAnimationEvent(AnimationPropData, Delegate, Binding.Action, Binding.UserTag);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
UE_LOG(LogUMG, Error, TEXT("Unable to find Animation %s on Widget Class '%s', was the animation deleted?"), *Binding.AnimationToBind.ToString(), *InUserWidget->GetClass()->GetName());
|
|
}
|
|
}
|
|
}
|
|
}
|