Files
UnrealEngineUWP/Engine/Plugins/Runtime/SmartObjects/Source/SmartObjectsModule/Private/SmartObjectSubsystemRenderingActor.cpp
mieszko zielinski bccb817a3f SmartObject registrations changes.
- SmartObject gained knowledge whether it was registered as a part of a colleciton, or as a dynamic smart object.
- cleaned up SmartObjectComponents SOHandle setting an resetting - there's a separate function for invalidating the handle.
- added handling of SmartObjectComponent's destruction (as opposed to unregistration due to being streamed out, potentially temporarily)

#preflight 638a25c74c3ce8ae5d20ba60

[CL 23389318 by mieszko zielinski in ue5-main branch]
2022-12-05 08:19:29 -05:00

52 lines
1.8 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#include "SmartObjectSubsystemRenderingActor.h"
#include "SmartObjectDebugSceneProxy.h"
#include "SmartObjectSubsystem.h"
#include "Debug/DebugDrawService.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;
}