2021-09-28 13:33:17 -04:00
|
|
|
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
2022-04-12 15:55:39 -04:00
|
|
|
#include "StateTreeTypes.h"
|
2021-09-28 13:33:17 -04:00
|
|
|
#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 */
|
2021-11-24 04:26:12 -05:00
|
|
|
virtual bool IsStructAllowed(const UScriptStruct* InScriptStruct) const { return false; }
|
|
|
|
|
|
|
|
|
|
/** @return True if specified class is supported */
|
2022-04-04 13:53:17 -04:00
|
|
|
virtual bool IsClassAllowed(const UClass* InScriptStruct) const { return false; }
|
2021-09-28 13:33:17 -04:00
|
|
|
|
2021-11-12 05:48:11 -05:00
|
|
|
/** @return True if specified struct/class is supported as external data */
|
2022-04-04 13:53:17 -04:00
|
|
|
virtual bool IsExternalItemAllowed(const UStruct& InStruct) const { return false; }
|
2021-11-24 04:26:12 -05:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 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;
|
2021-12-08 03:29:30 -05:00
|
|
|
|
2022-04-12 15:55:39 -04:00
|
|
|
/** @return List of named external data enforced by the schema. They must be provided at runtime through the execution context. */
|
2022-05-05 15:58:09 -04:00
|
|
|
virtual TConstArrayView<FStateTreeExternalDataDesc> GetNamedExternalDataDescs() const { return {}; }
|
2022-04-12 15:55:39 -04:00
|
|
|
|
2021-12-08 03:29:30 -05:00
|
|
|
#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
|
2021-09-28 13:33:17 -04:00
|
|
|
};
|