You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
#rb guillaume.arruda, Mieszko.Zielinski [CL 32754702 by mikko mononen in ue5-main branch]
56 lines
1.9 KiB
C++
56 lines
1.9 KiB
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
#include "Blueprint/StateTreeConditionBlueprintBase.h"
|
|
#include "Blueprint/StateTreeNodeBlueprintBase.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.
|
|
SetCachedInstanceDataFromContext(Context);
|
|
|
|
const bool bResult = ReceiveTestCondition();
|
|
|
|
ClearCachedInstanceData();
|
|
|
|
return bResult;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
//----------------------------------------------------------------------//
|
|
// FStateTreeBlueprintConditionWrapper
|
|
//----------------------------------------------------------------------//
|
|
|
|
bool FStateTreeBlueprintConditionWrapper::TestCondition(FStateTreeExecutionContext& Context) const
|
|
{
|
|
UStateTreeConditionBlueprintBase* Condition = Context.GetInstanceDataPtr<UStateTreeConditionBlueprintBase>(*this);
|
|
check(Condition);
|
|
return Condition->TestCondition(Context);
|
|
}
|
|
|
|
#if WITH_EDITOR
|
|
FText FStateTreeBlueprintConditionWrapper::GetDescription(const FGuid& ID, FStateTreeDataView InstanceDataView, const IStateTreeBindingLookup& BindingLookup, EStateTreeNodeFormatting Formatting) const
|
|
{
|
|
if (ConditionClass)
|
|
{
|
|
return ConditionClass->GetDisplayNameText();
|
|
}
|
|
return FText::GetEmpty();
|
|
}
|
|
#endif |