Files
UnrealEngine/Engine/Source/Editor/UnrealEd/Public/ActorEditorContextState.h
2025-05-18 13:04:45 +08:00

48 lines
1.0 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "Templates/SubclassOf.h"
#include "ActorEditorContextState.generated.h"
UCLASS(MinimalAPI, Within = ActorEditorContextStateCollection)
class UActorEditorContextClientState : public UObject
{
GENERATED_BODY()
};
UCLASS(MinimalAPI)
class UActorEditorContextStateCollection : public UObject
{
GENERATED_BODY()
public:
template <class TState>
const TState* GetState() const
{
return Cast<TState>(ClientStates.FindRef(TState::StaticClass()));
}
void AddState(UActorEditorContextClientState* InState)
{
ClientStates.Emplace(InState->GetClass(), InState);
}
bool IsEmpty() const
{
return ClientStates.IsEmpty();
}
private:
void Reset()
{
ClientStates.Reset();
}
UPROPERTY(VisibleAnywhere, Instanced, Category = States, meta = (DisplayName = "Context"))
TMap<TSubclassOf<UActorEditorContextClientState>, TObjectPtr<UActorEditorContextClientState>> ClientStates;
friend class UActorEditorContextSubsystem;
};