Files
UnrealEngineUWP/Engine/Plugins/Runtime/StateTree/Source/StateTreeModule/Public/StateTreeAnyEnum.h
henrik karlsson 9a1d5b1ad4 [Engine/Plugins]
* 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]
2023-01-25 02:42:36 -05:00

45 lines
1.0 KiB
C

// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "StateTreeAnyEnum.generated.h"
/**
* Enum that can be any type in the UI. Helper class to deal with any enum in property binding.
*/
USTRUCT()
struct STATETREEMODULE_API FStateTreeAnyEnum
{
GENERATED_BODY()
bool operator==(const FStateTreeAnyEnum& RHS) const
{
return Value == RHS.Value && Enum == RHS.Enum;
}
bool operator!=(const FStateTreeAnyEnum& RHS) const
{
return Value != RHS.Value || Enum != RHS.Enum;
}
/** Initializes the class and value to specific enum. The value is set to the first value of the enum or 0 if class is null */
void Initialize(UEnum* NewEnum)
{
Enum = NewEnum;
Value = Enum == nullptr ? 0 : int32(Enum->GetValueByIndex(0));
}
/** The enum integer value. */
UPROPERTY(EditAnywhere, Category = Enum)
uint32 Value = 0;
/** The enum class associated with this enum. */
UPROPERTY(EditAnywhere, Category = Enum)
TObjectPtr<UEnum> Enum = nullptr;
};
#if UE_ENABLE_INCLUDE_ORDER_DEPRECATED_IN_5_2
#include "CoreMinimal.h"
#endif