Files
UnrealEngineUWP/Engine/Plugins/Runtime/StateTree/Source/StateTreeModule/Public/StateTreeSchema.h
Yoan StAmant c135ebcd95 [StateTree]
+ Added StateTree parameters usable for data bindings and that could be overriden on context initialization by a StateTreeReference
+ Added StateTreeReference struct to hold a reference to a StateTree asset along with a list of values to parameterized the tree.
+ Added named external data items that are defined bt the Schema and for which values must be provided at runtime through the execution context.
+ Added delegate OnPostCompile after successful compilation. The StateTreeReference listens to it to validate its parameters
+ EditorData now contains its own version of the schema and parameters. On successful compilation they are copied over the StateTree own properties.
#rnx
#rb mikko.mononen
#preflight 6255d281647ad886b3593cb0

[CL 19727363 by Yoan StAmant in ue5-main branch]
2022-04-12 15:55:39 -04:00

62 lines
2.4 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "StateTreeTypes.h"
#include "StateTreeSchema.generated.h"
/**
* Schema describing which inputs, evaluators, and tasks a StateTree can contain.
* Each StateTree asset saves the schema class name in asset data tags, which can be
* used to limit which StatTree assets can be selected per use case, i.e.:
*
* UPROPERTY(EditDefaultsOnly, Category = AI, meta=(RequiredAssetDataTags="Schema=StateTreeSchema_SupaDupa"))
* UStateTree* StateTree;
*
*/
UCLASS(Abstract)
class STATETREEMODULE_API UStateTreeSchema : public UObject
{
GENERATED_BODY()
public:
/** @return Returns the script struct the storage struct will be derived from. */
virtual UScriptStruct* GetStorageSuperStruct() const { return nullptr; }
/** @return True if specified struct is supported */
virtual bool IsStructAllowed(const UScriptStruct* InScriptStruct) const { return false; }
/** @return True if specified class is supported */
virtual bool IsClassAllowed(const UClass* InScriptStruct) const { return false; }
/** @return True if specified struct/class is supported as external data */
virtual bool IsExternalItemAllowed(const UStruct& InStruct) const { return false; }
/**
* Helper function to check if a class is any of the Blueprint extendable item classes (Eval, Task, Condition).
* Can be used to quickly accept all of those classes in IsClassAllowed().
* @return True if the class is a StateTree item Blueprint base class.
*/
bool IsChildOfBlueprintBase(const UClass* InClass) const;
/** @return List of named external data enforced by the schema. They must be provided at runtime through the execution context. */
virtual TConstArrayView<FStateTreeExternalDataDesc> GetNamedExternalDataDescs() const { return {}; }
/** @return List of mutable named external data enforced by the schema. They must be provided at runtime through the execution context. */
virtual TArrayView<FStateTreeExternalDataDesc> GetMutableNamedExternalDataDescs() { return {}; }
#if WITH_EDITOR
/** @return True if enter conditions are allowed. */
virtual bool AllowEnterConditions() const { return true; }
/** @return True if evaluators are allowed. */
virtual bool AllowEvaluators() const { return true; }
/** @return True if multiple tasks are allowed. */
virtual bool AllowMultipleTasks() const { return true; }
#endif // WITH_EDITOR
};