Files
UnrealEngineUWP/Engine/Plugins/Runtime/SmartObjects/Source/SmartObjectsModule/Private/SmartObjectSubsystemRenderingActor.cpp
mieszko zielinski bf25520ccc SmartObject collection rework, introducing a FSmartObjectContainer type that encapsulates SmartObjectComponent registration and storage. The SmartObjectSubsystem now stores a Container that aggregates all other containers supplied by loaded/streamed in SmartObjectPersistentCollection instances.
In addition:
* SmartObjectCollection got deprecated and there's a auto-update path triggered in SmartObjectCollection::PostLoad
* SmartObjectComponent component can opt out of being a part of a collection with `bCanBePartOfCollection`
* Right now we limit SmartObjects to be registered with at most a single Collection. This might change in the future if required.

Note that this is the first change in a series, we're going to support miltiple collections per level with convenient ways of assigning SmartObjects to individual collections.

#jira UE-168977
#preflight 637f8faa4004f73f627ecaca

#preflight 637fa5378b12eb83a77ad7d9

[CL 23262132 by mieszko zielinski in ue5-main branch]
2022-11-24 14:53:52 -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().Bounds;
}
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;
}