EM_Task/UnrealEd/Private/Factories/ActorFactoryPointLight.cpp

29 lines
1.3 KiB
C++
Raw Normal View History

2026-02-13 16:18:33 +08:00
// Copyright Epic Games, Inc. All Rights Reserved.
/*=============================================================================
AnimCompositeFactory.cpp: Factory for AnimComposite
=============================================================================*/
#include "ActorFactories/ActorFactoryPointLight.h"
#include "GameFramework/Actor.h"
#include "Components/PointLightComponent.h"
#include "Components/RectLightComponent.h"
void UActorFactoryPointLight::PostSpawnActor(UObject* Asset, AActor* NewActor)
{
// Make all spawned actors use the candela units.
TArray<UPointLightComponent*> PointLightComponents;
NewActor->GetComponents<UPointLightComponent>(PointLightComponents);
for (UPointLightComponent* Component: PointLightComponents)
{
if (Component && Component->CreationMethod == EComponentCreationMethod::Native)
{
static const auto CVarDefaultLightUnits = IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT("r.DefaultFeature.LightUnits"));
ELightUnits DefaultUnits = (ELightUnits)CVarDefaultLightUnits->GetValueOnAnyThread();
Component->Intensity *= UPointLightComponent::GetUnitsConversionFactor(Component->IntensityUnits, DefaultUnits);
Component->IntensityUnits = DefaultUnits;
}
}
}