2022-04-12 15:55:39 -04:00
|
|
|
|
// 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()
|
2022-05-10 10:15:17 -04:00
|
|
|
|
struct STATETREEMODULE_API FStateTreeReference
|
2022-04-12 15:55:39 -04:00
|
|
|
|
{
|
|
|
|
|
|
GENERATED_BODY()
|
|
|
|
|
|
|
2022-05-10 10:15:17 -04:00
|
|
|
|
FStateTreeReference();
|
|
|
|
|
|
~FStateTreeReference();
|
|
|
|
|
|
|
2022-04-12 15:55:39 -04:00
|
|
|
|
UPROPERTY(EditDefaultsOnly, Category="")
|
2022-04-14 19:51:54 -04:00
|
|
|
|
TObjectPtr<UStateTree> StateTree = nullptr;
|
2022-04-12 15:55:39 -04:00
|
|
|
|
|
2022-05-05 12:02:47 -04:00
|
|
|
|
UPROPERTY(EditDefaultsOnly, Category="", meta=(FixedLayout))
|
|
|
|
|
|
FInstancedPropertyBag Parameters;
|
2022-04-12 15:55:39 -04:00
|
|
|
|
|
|
|
|
|
|
#if WITH_EDITOR
|
2022-05-10 10:15:17 -04:00
|
|
|
|
void PostSerialize(const FArchive& Ar);
|
|
|
|
|
|
|
2022-04-12 15:55:39 -04:00
|
|
|
|
/**
|
2022-05-10 10:15:17 -04:00
|
|
|
|
* Enforce self parameters to be compatible with those exposed by the selected StateTree asset.
|
2022-04-12 15:55:39 -04:00
|
|
|
|
*/
|
2022-05-10 10:15:17 -04:00
|
|
|
|
void SyncParameters() { SyncParameters(Parameters); }
|
2022-04-12 15:55:39 -04:00
|
|
|
|
|
2022-05-10 10:15:17 -04:00
|
|
|
|
/**
|
|
|
|
|
|
* Sync provided parameters to be compatible with those exposed by the selected StateTree asset.
|
|
|
|
|
|
*/
|
|
|
|
|
|
void SyncParameters(FInstancedPropertyBag& ParametersToSync) const;
|
2022-04-12 15:55:39 -04:00
|
|
|
|
|
2022-05-10 10:15:17 -04:00
|
|
|
|
/**
|
|
|
|
|
|
* 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;
|
2022-04-12 15:55:39 -04:00
|
|
|
|
|
2022-05-10 10:15:17 -04:00
|
|
|
|
private:
|
2022-04-12 15:55:39 -04:00
|
|
|
|
FDelegateHandle PIEHandle;
|
|
|
|
|
|
#endif
|
|
|
|
|
|
};
|
2022-05-10 10:15:17 -04:00
|
|
|
|
|
|
|
|
|
|
#if WITH_EDITORONLY_DATA
|
|
|
|
|
|
template<>
|
|
|
|
|
|
struct TStructOpsTypeTraits<FStateTreeReference> : public TStructOpsTypeTraitsBase2<FStateTreeReference>
|
|
|
|
|
|
{
|
|
|
|
|
|
enum
|
|
|
|
|
|
{
|
|
|
|
|
|
WithPostSerialize = true,
|
|
|
|
|
|
};
|
|
|
|
|
|
};
|
|
|
|
|
|
#endif
|