Files
UnrealEngineUWP/Engine/Plugins/Runtime/StateTree/Source/StateTreeModule/Public/Blueprint/StateTreeConditionBlueprintBase.h
mikko mononen 97d82b0cb0 StateTree: shared instance data
- Separated condition instance data into a shared instance data (mutable but no persistent state)
- Made BP TestCondition() const, conditions should not hold state
- Added macro to define runtime data POD for faster init
- Added custom serialization version for UStateTree, older assets need recompile
- Updated memory reporting to be a bit more accurate, separated shared and unique data

#jira UE-147508
#rb Mieszko.Zielinski
#preflight 627b657d2d608c533b5cde15

[CL 20134929 by mikko mononen in ue5-main branch]
2022-05-11 04:04:58 -04:00

47 lines
1.3 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "Templates/SubclassOf.h"
#include "StateTreeTypes.h"
#include "StateTreeConditionBase.h"
#include "StateTreePropertyBindings.h"
#include "StateTreeItemBlueprintBase.h"
#include "StateTreeConditionBlueprintBase.generated.h"
struct FStateTreeExecutionContext;
/*
* Base class for Blueprint based Conditions.
*/
UCLASS(Abstract, Blueprintable)
class STATETREEMODULE_API UStateTreeConditionBlueprintBase : public UStateTreeItemBlueprintBase
{
GENERATED_BODY()
public:
UFUNCTION(BlueprintImplementableEvent)
bool ReceiveTestCondition(AActor* OwnerActor) const;
virtual bool TestCondition(FStateTreeExecutionContext& Context) const;
};
/**
* Wrapper for Blueprint based Conditions.
*/
USTRUCT()
struct STATETREEMODULE_API FStateTreeBlueprintConditionWrapper : public FStateTreeConditionBase
{
GENERATED_BODY()
virtual const UStruct* GetInstanceDataType() const override { return ConditionClass; };
virtual bool Link(FStateTreeLinker& Linker) override;
virtual bool TestCondition(FStateTreeExecutionContext& Context) const override;
UPROPERTY()
TSubclassOf<UStateTreeConditionBlueprintBase> ConditionClass = nullptr;
TArray<FStateTreeBlueprintExternalDataHandle> ExternalDataHandles;
};