You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
- Moved event queue to it's own struct - Changed the SendEvent() API to accept struct view to prevent instanced struct copy in common cases - Fixed event handling in case EnterState() fails. - Added option for Tasks to disavble ticking, or to be ticked only when there are events - Added option for Tasks handle when properties are copied - Changed DebugText to use external Actor reference - Changed DelayTask to use the new GetInstanceData which does not need type - Added TStateTreeInstanceDataStructRef which can be used to access struct instance data in delegates #rb Maxime.Mercier Luciano.Ferraro #preflight 6360dd302b5338aceb2d0343 [CL 22888708 by mikko mononen in ue5-main branch]
46 lines
1.4 KiB
C++
46 lines
1.4 KiB
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
#include "Blueprint/StateTreeNodeBlueprintBase.h"
|
|
#include "AIController.h"
|
|
#include "StateTreeExecutionContext.h"
|
|
#include "StateTreeLinker.h"
|
|
#include "VisualLogger/VisualLogger.h"
|
|
|
|
#include UE_INLINE_GENERATED_CPP_BY_NAME(StateTreeNodeBlueprintBase)
|
|
|
|
UWorld* UStateTreeNodeBlueprintBase::GetWorld() const
|
|
{
|
|
// The items are duplicated as the StateTreeExecution context as outer, so this should be essentially the same as GetWorld() on StateTree context.
|
|
// The CDO is used by the BP editor to check for certain functionality, make it return nullptr so that the GetWorld() passes as overridden.
|
|
if (!HasAnyFlags(RF_ClassDefaultObject))
|
|
{
|
|
if (UObject* Outer = GetOuter())
|
|
{
|
|
return Outer->GetWorld();
|
|
}
|
|
}
|
|
|
|
return nullptr;
|
|
}
|
|
|
|
AActor* UStateTreeNodeBlueprintBase::GetOwnerActor(const FStateTreeExecutionContext& Context) const
|
|
{
|
|
if (const AAIController* Controller = Cast<AAIController>(Context.GetOwner()))
|
|
{
|
|
return Controller->GetPawn();
|
|
}
|
|
|
|
return Cast<AActor>(Context.GetOwner());
|
|
}
|
|
|
|
void UStateTreeNodeBlueprintBase::SendEvent(const FStateTreeEvent& Event)
|
|
{
|
|
if (CurrentContext == nullptr)
|
|
{
|
|
UE_VLOG_UELOG(this, LogStateTree, Error, TEXT("Trying to call SendEvent() outside StateTree tick. Use SendEvent() on UStateTreeComponent instead for sending signals externally."));
|
|
return;
|
|
}
|
|
CurrentContext->SendEvent(Event.Tag, Event.Payload, Event.Origin);
|
|
}
|
|
|