You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
* Ran IWYU on ~170 plugins to remove includes not needed. Public api still keep old includes inside #if UE_ENABLE_INCLUDE_ORDER_DEPRECATED_IN_5_2 #preflight 63d09351574ab9cae4670216 #rb none [CL 23844750 by henrik karlsson in ue5-main branch]
87 lines
2.2 KiB
C++
87 lines
2.2 KiB
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
#pragma once
|
|
|
|
#include "PropertyBag.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()
|
|
|
|
/** @return true if the reference is set. */
|
|
bool IsValid() const
|
|
{
|
|
return StateTree != nullptr;
|
|
}
|
|
|
|
/** Sets the StateTree asset and referenced parameters. */
|
|
void SetStateTree(UStateTree* NewStateTree)
|
|
{
|
|
StateTree = NewStateTree;
|
|
SyncParameters();
|
|
}
|
|
|
|
/** @return const pointer to the referenced StateTree asset. */
|
|
const UStateTree* GetStateTree() const
|
|
{
|
|
return StateTree;
|
|
}
|
|
|
|
/** @return pointer to the referenced StateTree asset. */
|
|
UStateTree* GetMutableStateTree()
|
|
{
|
|
return StateTree;
|
|
}
|
|
|
|
/** @return reference to the parameters for the referenced StateTree asset. */
|
|
const FInstancedPropertyBag& GetParameters() const
|
|
{
|
|
ConditionallySyncParameters();
|
|
return Parameters;
|
|
}
|
|
|
|
/** @return reference to the parameters for the referenced StateTree asset. */
|
|
FInstancedPropertyBag& GetMutableParameters()
|
|
{
|
|
ConditionallySyncParameters();
|
|
return Parameters;
|
|
}
|
|
|
|
/**
|
|
* Enforce self parameters to be compatible with those exposed by the selected StateTree asset.
|
|
*/
|
|
void SyncParameters() { SyncParametersToMatchStateTree(Parameters); }
|
|
|
|
/**
|
|
* Sync provided parameters to be compatible with those exposed by the selected StateTree asset.
|
|
*/
|
|
void SyncParametersToMatchStateTree(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;
|
|
|
|
/** Sync parameters to match the asset if required. */
|
|
void ConditionallySyncParameters() const;
|
|
|
|
protected:
|
|
UPROPERTY(EditAnywhere, Category = "")
|
|
TObjectPtr<UStateTree> StateTree = nullptr;
|
|
|
|
UPROPERTY(EditAnywhere, Category = "", meta = (FixedLayout))
|
|
FInstancedPropertyBag Parameters;
|
|
};
|
|
|
|
#if UE_ENABLE_INCLUDE_ORDER_DEPRECATED_IN_5_2
|
|
#include "StateTreeTypes.h"
|
|
#endif
|