Files
UnrealEngineUWP/Engine/Plugins/Runtime/StateTree/Source/StateTreeModule/Public/StateTreeReference.h
mikko mononen 68a3b6aa67 StateTree: Made StateTreeComponent to use StateTreeRef, and fixed StateTreeRef on Actor Components
#preflight 62da4a10185da2495f802bae

#ROBOMERGE-AUTHOR: mikko.mononen
#ROBOMERGE-SOURCE: CL 21217415 via CL 21217580 via CL 21217683
#ROBOMERGE-BOT: UE5 (Release-Engine-Staging -> Main) (v972-20964824)

[CL 21218420 by mikko mononen in ue5-main branch]
2022-07-22 05:33:11 -04:00

61 lines
1.5 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "StateTreeTypes.h"
#include "StateTreeReference.generated.h"
class UStateTree;
/**
* Struct to hold reference to a StateTree asset along with values to parameterized it.
*/
USTRUCT()
struct STATETREEMODULE_API FStateTreeReference
{
GENERATED_BODY()
FStateTreeReference();
~FStateTreeReference();
UPROPERTY(EditAnywhere, Category = "")
TObjectPtr<UStateTree> StateTree = nullptr;
UPROPERTY(EditAnywhere, Category = "", meta = (FixedLayout))
FInstancedPropertyBag Parameters;
#if WITH_EDITOR
void PostSerialize(const FArchive& Ar);
/**
* Enforce self parameters to be compatible with those exposed by the selected StateTree asset.
*/
void SyncParameters() { SyncParameters(Parameters); }
/**
* Sync provided parameters to be compatible with those exposed by the selected StateTree asset.
*/
void SyncParameters(FInstancedPropertyBag& ParametersToSync) const;
/**
* Indicates if current parameters are compatible with those available in the selected StateTree asset.
* @return true when parameters requires to be synced to be compatible with those available in the selected StateTree asset, false otherwise.
*/
bool RequiresParametersSync() const;
private:
FDelegateHandle PIEHandle;
#endif
};
#if WITH_EDITORONLY_DATA
template<>
struct TStructOpsTypeTraits<FStateTreeReference> : public TStructOpsTypeTraitsBase2<FStateTreeReference>
{
enum
{
WithPostSerialize = true,
};
};
#endif