Files
UnrealEngineUWP/Engine/Plugins/Runtime/StateTree/Source/StateTreeEditorModule/Public/StateTreeBaker.h
mikko mononen 841dd874f1 StateTree: Renamed item to node
- Renamed uses of item to node
- Added base class for Conditions, Evals & Tasks

#jira UE-140363
#rb mieszko.zielinski
#preflight 61fa4083db42673a6020f1fb
#lockdown julien.marchand

#ROBOMERGE-AUTHOR: mikko.mononen
#ROBOMERGE-SOURCE: CL 18841581 in //UE5/Release-5.0/... via CL 18841871 via CL 18842048
#ROBOMERGE-BOT: UE5 (Release-Engine-Test -> Main) (v910-18824042)

[CL 18842354 by mikko mononen in ue5-main branch]
2022-02-03 09:13:49 -05:00

52 lines
1.6 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "StateTreeTypes.h"
#include "StateTreePropertyBindingCompiler.h"
#include "StateTreeCompilerLog.h"
class UStateTree;
class UStateTreeState;
class UStateTreeEditorData;
struct FStateTreeEditorNode;
struct FStateTreeStateLink;
/**
* Helper class to convert StateTree editor representation into a compact baked data.
* Holds data needed during baking.
*/
struct STATETREEEDITORMODULE_API FStateTreeBaker
{
public:
FStateTreeBaker(FStateTreeCompilerLog& InLog)
: Log(InLog)
{
}
bool Bake(UStateTree& InStateTree);
private:
bool ResolveTransitionState(const UStateTreeState& SourceState, const FStateTreeStateLink& Link, FStateTreeHandle& OutTransitionHandle) const;
FStateTreeHandle GetStateHandle(const FGuid& StateID) const;
bool CreateStates();
bool CreateStateRecursive(UStateTreeState& State, const FStateTreeHandle Parent);
bool CreateStateTransitions();
bool CreateCondition(const FStateTreeEditorNode& CondNode);
bool CreateTask(const FStateTreeEditorNode& TaskNode);
bool CreateEvaluator(const FStateTreeEditorNode& EvalNode);
bool GetAndValidateBindings(const FStateTreeBindableStructDesc& TargetStruct, TArray<FStateTreeEditorPropertyBinding>& OutBindings) const;
bool IsPropertyAnyEnum(const FStateTreeBindableStructDesc& Struct, FStateTreeEditorPropertyPath Path) const;
FStateTreeCompilerLog& Log;
UStateTree* StateTree = nullptr;
UStateTreeEditorData* TreeData = nullptr;
TMap<FGuid, int32> IDToState;
TArray<UStateTreeState*> SourceStates;
FStateTreePropertyBindingCompiler BindingsCompiler;
};