You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
- cache event queue for the whole active duration of the nodes - this allows events to be sent outside tick (e.g. from delegate callbacks) #preflight 638deb98c0652bbec2df9368 [CL 23389834 by mikko mononen in ue5-main branch]
48 lines
1.5 KiB
C++
48 lines
1.5 KiB
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
#include "Blueprint/StateTreeConditionBlueprintBase.h"
|
|
#include "CoreMinimal.h"
|
|
#include "StateTreeExecutionContext.h"
|
|
#include "BlueprintNodeHelpers.h"
|
|
|
|
#include UE_INLINE_GENERATED_CPP_BY_NAME(StateTreeConditionBlueprintBase)
|
|
|
|
//----------------------------------------------------------------------//
|
|
// UStateTreeConditionBlueprintBase
|
|
//----------------------------------------------------------------------//
|
|
|
|
UStateTreeConditionBlueprintBase::UStateTreeConditionBlueprintBase(const FObjectInitializer& ObjectInitializer)
|
|
: Super(ObjectInitializer)
|
|
{
|
|
bHasTestCondition = BlueprintNodeHelpers::HasBlueprintFunction(TEXT("ReceiveTestCondition"), *this, *StaticClass());
|
|
}
|
|
|
|
bool UStateTreeConditionBlueprintBase::TestCondition(FStateTreeExecutionContext& Context) const
|
|
{
|
|
if (bHasTestCondition)
|
|
{
|
|
// Cache the owner and event queue for the duration the condition is evaluated.
|
|
SetCachedEventQueueFromContext(Context);
|
|
|
|
const bool bResult = ReceiveTestCondition();
|
|
|
|
ClearCachedEventQueue();
|
|
|
|
return bResult;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
//----------------------------------------------------------------------//
|
|
// FStateTreeBlueprintConditionWrapper
|
|
//----------------------------------------------------------------------//
|
|
|
|
bool FStateTreeBlueprintConditionWrapper::TestCondition(FStateTreeExecutionContext& Context) const
|
|
{
|
|
UStateTreeConditionBlueprintBase* Condition = Context.GetInstanceDataPtr<UStateTreeConditionBlueprintBase>(*this);
|
|
check(Condition);
|
|
return Condition->TestCondition(Context);
|
|
}
|
|
|
|
|