// Copyright Epic Games, Inc. All Rights Reserved. #pragma once #include "Containers/Array.h" #include "Containers/Map.h" #include "StructUtils/StructView.h" #include "Tasks/SceneStateTaskMetadata.h" #include "UObject/ObjectKey.h" class UBlueprint; class UEdGraphPin; class UObject; class USceneStateMachineTaskNode; struct FSceneStateTask; struct FSceneStateTaskInstance; namespace UE::SceneState::Editor { class FStateMachineTaskCompiler { /** Information about a node to compile */ struct FTaskInfo { /** View of the task in the task node to compile */ TConstStructView Task; /** View of the task instance in the task node to compile */ TConstStructView TaskInstance; /** Metadata compiled from the node for editor-only runtime */ FSceneStateTaskMetadata Metadata; /** The task node to compile */ TObjectPtr Node; /** Prerequisite nodes that need to complete before this task executes */ TArray Prerequisites; }; public: explicit FStateMachineTaskCompiler(UEdGraphPin* InSourceOutputPin, UObject* InOuter); struct FCompileResult { /** Compiled FSceneStateTask instances */ TArray Tasks; /** Compiled Task prerequisites */ TArray TaskPrerequisites; /** The nodes' task instance views */ TArray TaskInstances; /** Additional editor-only metadata gotten from the node */ TArray TaskMetadata; /** Map of the task node to the index in the task array */ TMap TaskToIndexMap; }; void Compile(FCompileResult& OutCompileResult); private: static FTaskInfo MakeTaskInfo(USceneStateMachineTaskNode* InNode); void GatherTasks(UEdGraphPin* InOutputPin); void CompileTasks(FCompileResult& OutCompilationResult); UEdGraphPin* SourceOutputPin; TObjectPtr Outer; TArray TaskInfos; TMap ProcessedNodes; }; } // UE::SceneState::Editor