Files
UnrealEngineUWP/Engine/Plugins/Runtime/StateTree/Source/StateTreeEditorModule/Public/StateTreeBaker.h
mikko mononen ef7ea7b60d StateTree: Resolve external dependecies at load time instead of bake time
- added StateTree linker
- added Link() method to tasks and evaluators
- added templated item reference which makes getter code less error prone

#jira none

#ROBOMERGE-AUTHOR: mikko.mononen
#ROBOMERGE-SOURCE: CL 17941680 in //UE5/Main/...
#ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v885-17909292)
#ROBOMERGE[STARSHIP]: UE5-Release-Engine-Staging Release-5.0

[CL 17941733 by mikko mononen in ue5-release-engine-test branch]
2021-10-27 06:11:44 -04:00

48 lines
1.5 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "StateTreeTypes.h"
#include "StateTreePropertyBindingCompiler.h"
class UStateTree;
class UStateTreeState;
class UStateTreeEditorData;
struct FStateTreeCondition;
struct FStateTreeConditionItem;
struct FStateTreeStateLink;
/**
* Helper class to convert StateTree editor representation into a compact baked data.
* Holds data needed during baking.
*/
struct STATETREEEDITORMODULE_API FStateTreeBaker
{
public:
bool Bake(UStateTree& InStateTree);
private:
enum class EBindingContainerType : uint8
{
Evaluator,
Task,
};
bool ResolveTransitionState(const UStateTreeState& SourceState, const TCHAR* ContextStr, 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 FStateTreeConditionItem& CondItem);
bool GetAndValidateBindings(const FStateTreeBindableStructDesc& TargetStruct, TArray<FStateTreeEditorPropertyBinding>& OutBindings) const;
bool IsPropertyAnyEnum(const FStateTreeBindableStructDesc& Struct, FStateTreeEditorPropertyPath Path) const;
UStateTree* StateTree = nullptr;
UStateTreeEditorData* TreeData = nullptr;
TMap<FGuid, int32> IDToState;
TArray<UStateTreeState*> SourceStates;
FStateTreePropertyBindingCompiler BindingsCompiler;
};