Files
UnrealEngineUWP/Engine/Plugins/Runtime/StateTree/Source/StateTreeModule/Public/Blueprint/StateTreeItemBlueprintBase.h
Yoan StAmant b4f64a59e0 [StateTree] external data validation from schema supported types
- fixed external requirements set by StateTreeBrainComponent to find more specific actor classes first before defaulting on AActor
- added missing supported type FMassSharedFragment for MassStateTreeSchema
- moved StateTreeLinker to it own file and handle its potential failures
#rb mikko.mononen
#rnx
#preflight 624d98fd8e5ae00f0aca3123

[CL 19646871 by Yoan StAmant in ue5-main branch]
2022-04-06 10:04:05 -04:00

71 lines
1.9 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "StateTreeTypes.h"
#include "StateTreeItemBlueprintBase.generated.h"
struct FStateTreeLinker;
struct FStateTreeExecutionContext;
UENUM()
enum class EStateTreeBlueprintPropertyCategory : uint8
{
NotSet,
Input,
Parameter,
Output,
ExternalData,
};
/** Additional information for properties, captured from property metadata. */
USTRUCT()
struct STATETREEMODULE_API FStateTreeBlueprintPropertyInfo
{
GENERATED_BODY()
FStateTreeBlueprintPropertyInfo() = default;
FStateTreeBlueprintPropertyInfo(const FName InPropertyName, const EStateTreeBlueprintPropertyCategory InCategory)
: PropertyName(InPropertyName), Category(InCategory)
{}
UPROPERTY()
FName PropertyName;
UPROPERTY()
EStateTreeBlueprintPropertyCategory Category = EStateTreeBlueprintPropertyCategory::NotSet;
};
/** Struct use to copy external data to the Blueprint item instance, resolved during StateTree linking. */
struct STATETREEMODULE_API FStateTreeBlueprintExternalDataHandle
{
const FProperty* Property = nullptr;
FStateTreeExternalDataHandle Handle;
};
UCLASS(Abstract)
class STATETREEMODULE_API UStateTreeItemBlueprintBase : public UObject
{
GENERATED_BODY()
public:
/** Called during link to collect external data handles. */
void LinkExternalData(FStateTreeLinker& Linker, TArray<FStateTreeBlueprintExternalDataHandle>& OutExternalDataHandles) const;
/** Called before call to logic functions to copy data from */
void CopyExternalData(FStateTreeExecutionContext& Context, TConstArrayView<FStateTreeBlueprintExternalDataHandle> ExternalDataHandles);
protected:
virtual UWorld* GetWorld() const override;
AActor* GetOwnerActor(const FStateTreeExecutionContext& Context) const;
#if WITH_EDITOR
virtual void PostCDOCompiled(const FPostCDOCompiledContext& Context) override;
#endif
/** Metadata for properties */
UPROPERTY()
TArray<FStateTreeBlueprintPropertyInfo> PropertyInfos;
};