Files
UnrealEngine/Engine/Plugins/Runtime/SmartObjects/Source/SmartObjectsModule/Private/SmartObjectSubsystemRenderingActor.cpp
2025-05-18 13:04:45 +08:00

55 lines
1.8 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#include "SmartObjectSubsystemRenderingActor.h"
#include "Engine/World.h"
#include "SmartObjectSubsystem.h"
#include UE_INLINE_GENERATED_CPP_BY_NAME(SmartObjectSubsystemRenderingActor)
//----------------------------------------------------------------------//
// USmartObjectSubsystemRenderingComponent
//----------------------------------------------------------------------//
FBoxSphereBounds USmartObjectSubsystemRenderingComponent::CalcBounds(const FTransform& LocalToWorld) const
{
if (const USmartObjectSubsystem* Subsystem = UWorld::GetSubsystem<USmartObjectSubsystem>(GetWorld()))
{
return Subsystem->GetSmartObjectContainer().GetBounds();
}
return FBox(ForceInit);
}
#if UE_ENABLE_DEBUG_DRAWING
void USmartObjectSubsystemRenderingComponent::DebugDraw(FDebugRenderSceneProxy* DebugProxy)
{
if (const USmartObjectSubsystem* Subsystem = UWorld::GetSubsystem<USmartObjectSubsystem>(GetWorld()))
{
Subsystem->DebugDraw(DebugProxy);
}
}
void USmartObjectSubsystemRenderingComponent::DebugDrawCanvas(UCanvas* Canvas, APlayerController* PlayerController)
{
if (const USmartObjectSubsystem* Subsystem = UWorld::GetSubsystem<USmartObjectSubsystem>(GetWorld()))
{
Subsystem->DebugDrawCanvas(Canvas, PlayerController);
}
}
#endif // UE_ENABLE_DEBUG_DRAWING
//----------------------------------------------------------------------//
// ASmartObjectSubsystemRenderingActor
//----------------------------------------------------------------------//
ASmartObjectSubsystemRenderingActor::ASmartObjectSubsystemRenderingActor()
{
RenderingComponent = CreateDefaultSubobject<USmartObjectSubsystemRenderingComponent>(TEXT("RenderingComp"));
RootComponent = RenderingComponent;
#if WITH_EDITORONLY_DATA
bListedInSceneOutliner = false;
#endif
}