Files
UnrealEngineUWP/Engine/Plugins/Runtime/StateTree/Source/StateTreeEditorModule/Public/StateTreeBaker.h
mikko mononen c866e28ab8 StateTree: allow schema to configure editor
- allow to disable enter conditions and evaluators
- allow to configure state to have just one task

#jira UE-135723
#preflight 61b067d35c61dba07bef0718

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

[CL 18403964 by mikko mononen in ue5-release-engine-test branch]
2021-12-08 03:32:02 -05:00

55 lines
1.7 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 FStateTreeCondition;
struct FStateTreeConditionItem;
struct FStateTreeTaskItem;
struct FStateTreeEvaluatorItem;
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 FStateTreeConditionItem& CondItem);
bool GetAndValidateBindings(const FStateTreeBindableStructDesc& TargetStruct, TArray<FStateTreeEditorPropertyBinding>& OutBindings) const;
bool IsPropertyAnyEnum(const FStateTreeBindableStructDesc& Struct, FStateTreeEditorPropertyPath Path) const;
bool CreateTask(const FStateTreeTaskItem& TaskItem);
bool CreateEvaluator(const FStateTreeEvaluatorItem& EvalItem);
FStateTreeCompilerLog& Log;
UStateTree* StateTree = nullptr;
UStateTreeEditorData* TreeData = nullptr;
TMap<FGuid, int32> IDToState;
TArray<UStateTreeState*> SourceStates;
FStateTreePropertyBindingCompiler BindingsCompiler;
};