Files
UnrealEngine/Engine/Plugins/Experimental/SceneState/Source/SceneStateGameplay/Private/SceneStateComponentPlayer.cpp
2025-05-18 13:04:45 +08:00

35 lines
740 B
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#include "SceneStateComponentPlayer.h"
#include "GameFramework/Actor.h"
#include "SceneStateComponent.h"
AActor* USceneStateComponentPlayer::GetActor() const
{
if (UActorComponent* Component = Cast<UActorComponent>(GetOuter()))
{
return Component->GetOwner();
}
return nullptr;
}
bool USceneStateComponentPlayer::OnGetContextName(FString& OutContextName) const
{
if (AActor* Actor = GetActor())
{
#if WITH_EDITOR
OutContextName = Actor->GetActorLabel();
#else
OutContextName = Actor->GetName();
#endif
return true;
}
return false;
}
bool USceneStateComponentPlayer::OnGetContextObject(UObject*& OutContextObject) const
{
OutContextObject = GetActor();
return true;
}