2022-05-02 09:15:14 -04:00
|
|
|
|
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
|
|
|
|
|
|
|
|
#include "Components/StateTreeComponentSchema.h"
|
|
|
|
|
|
#include "StateTreeConditionBase.h"
|
|
|
|
|
|
#include "StateTreeEvaluatorBase.h"
|
|
|
|
|
|
#include "StateTreeTaskBase.h"
|
|
|
|
|
|
#include "GameFramework/Actor.h"
|
|
|
|
|
|
#include "Components/ActorComponent.h"
|
|
|
|
|
|
#include "Subsystems/WorldSubsystem.h"
|
|
|
|
|
|
|
2022-08-29 14:47:43 -04:00
|
|
|
|
|
|
|
|
|
|
UStateTreeComponentSchema::UStateTreeComponentSchema()
|
|
|
|
|
|
: ContextActorClass(AActor::StaticClass())
|
|
|
|
|
|
, ContextActorDataDesc(FName("Actor"), AActor::StaticClass(), FGuid(0x1D971B00, 0x28884FDE, 0xB5436802, 0x36984FD5))
|
|
|
|
|
|
{
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-05-02 09:15:14 -04:00
|
|
|
|
bool UStateTreeComponentSchema::IsStructAllowed(const UScriptStruct* InScriptStruct) const
|
|
|
|
|
|
{
|
|
|
|
|
|
return InScriptStruct->IsChildOf(FStateTreeConditionCommonBase::StaticStruct())
|
|
|
|
|
|
|| InScriptStruct->IsChildOf(FStateTreeEvaluatorCommonBase::StaticStruct())
|
|
|
|
|
|
|| InScriptStruct->IsChildOf(FStateTreeTaskCommonBase::StaticStruct());
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool UStateTreeComponentSchema::IsClassAllowed(const UClass* InClass) const
|
|
|
|
|
|
{
|
|
|
|
|
|
return IsChildOfBlueprintBase(InClass);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool UStateTreeComponentSchema::IsExternalItemAllowed(const UStruct& InStruct) const
|
|
|
|
|
|
{
|
|
|
|
|
|
return InStruct.IsChildOf(AActor::StaticClass())
|
|
|
|
|
|
|| InStruct.IsChildOf(UActorComponent::StaticClass())
|
|
|
|
|
|
|| InStruct.IsChildOf(UWorldSubsystem::StaticClass());
|
|
|
|
|
|
}
|
2022-08-29 14:47:43 -04:00
|
|
|
|
|
|
|
|
|
|
TConstArrayView<FStateTreeExternalDataDesc> UStateTreeComponentSchema::GetNamedExternalDataDescs() const
|
|
|
|
|
|
{
|
|
|
|
|
|
return MakeArrayView(&ContextActorDataDesc, 1);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-09-05 09:08:59 -04:00
|
|
|
|
void UStateTreeComponentSchema::PostLoad()
|
|
|
|
|
|
{
|
|
|
|
|
|
Super::PostLoad();
|
|
|
|
|
|
ContextActorDataDesc.Struct = ContextActorClass.Get();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-08-29 14:48:32 -04:00
|
|
|
|
#if WITH_EDITOR
|
2022-08-29 14:47:43 -04:00
|
|
|
|
void UStateTreeComponentSchema::PostEditChangeChainProperty(FPropertyChangedChainEvent& PropertyChangedEvent)
|
|
|
|
|
|
{
|
|
|
|
|
|
Super::PostEditChangeChainProperty(PropertyChangedEvent);
|
|
|
|
|
|
|
|
|
|
|
|
FProperty* Property = PropertyChangedEvent.Property;
|
|
|
|
|
|
|
|
|
|
|
|
if (Property)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (Property->GetOwnerClass() == UStateTreeComponentSchema::StaticClass()
|
|
|
|
|
|
&& Property->GetFName() == GET_MEMBER_NAME_CHECKED(UStateTreeComponentSchema, ContextActorClass))
|
|
|
|
|
|
{
|
|
|
|
|
|
ContextActorDataDesc.Struct = ContextActorClass.Get();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2022-08-29 14:48:32 -04:00
|
|
|
|
#endif
|