CARLA
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Private Member Functions | Private Attributes | List of all members
UCarlaLightSubsystem Class Reference

#include <CarlaLightSubsystem.h>

+ Inheritance diagram for UCarlaLightSubsystem:

Public Member Functions

void Deinitialize () override
 
bool GetDayNightCycle () const
 
bool GetDayTimeState (bool &bOutIsDay) const
 The day/night state last broadcast, if any.
 
UCarlaLight * GetLight (int Id)
 
TMap< int, UCarlaLight * > & GetLights ()
 
std::vector< carla::rpc::LightState > GetLights (FString Client)
 
void Initialize (FSubsystemCollectionBase &Collection) override
 
bool IsUpdatePending () const
 
void NotifyDayTimeChange (bool bIsDay)
 Broadcast a day/night change and then re-apply the UE4->UE5 component intensity conversion on every registered light.
 
int32 NumLights () const
 
void RegisterLight (UCarlaLight *CarlaLight)
 
void SetClientStatesdirty (FString ClientThatUpdate)
 Flag every registered client (except ClientThatUpdate) so their LightManager re-queries light states.
 
void SetDayNightCycle (const bool active)
 
void SetLights (FString Client, std::vector< carla::rpc::LightState > LightsToSet, bool DiscardClient=false)
 
void UnregisterLight (UCarlaLight *CarlaLight)
 

Public Attributes

FDayTimeChanged DayTimeChangeEvent
 

Private Member Functions

void ScheduleDayTimeState (UCarlaLight *CarlaLight)
 

Private Attributes

bool bDayNightCycle = true
 
bool bHasDayTimeState = false
 
bool bLastIsDay = true
 
TMap< FString, bool > ClientStates
 
TMap< int, UCarlaLight * > Lights
 
TSet< TWeakObjectPtr< UCarlaLight > > PendingDayTimeLights
 

Detailed Description

Definition at line 32 of file CarlaLightSubsystem.h.

Member Function Documentation

◆ Deinitialize()

void UCarlaLightSubsystem::Deinitialize ( )
override

Definition at line 22 of file CarlaLightSubsystem.cpp.

◆ GetDayNightCycle()

bool UCarlaLightSubsystem::GetDayNightCycle ( ) const
inline

Definition at line 73 of file CarlaLightSubsystem.h.

Referenced by FFrameData::AddWorldState(), and FFrameData::PlayWorldState().

◆ GetDayTimeState()

bool UCarlaLightSubsystem::GetDayTimeState ( bool &  bOutIsDay) const
inline

The day/night state last broadcast, if any.

Definition at line 79 of file CarlaLightSubsystem.h.

Referenced by FFrameData::AddWorldState(), and FFrameData::PlayWorldState().

◆ GetLight()

UCarlaLight * UCarlaLightSubsystem::GetLight ( int  Id)

◆ GetLights() [1/2]

TMap< int, UCarlaLight * > & UCarlaLightSubsystem::GetLights ( )
inline

Definition at line 66 of file CarlaLightSubsystem.h.

◆ GetLights() [2/2]

std::vector< carla::rpc::LightState > UCarlaLightSubsystem::GetLights ( FString  Client)

◆ Initialize()

void UCarlaLightSubsystem::Initialize ( FSubsystemCollectionBase &  Collection)
override

Definition at line 17 of file CarlaLightSubsystem.cpp.

◆ IsUpdatePending()

bool UCarlaLightSubsystem::IsUpdatePending ( ) const

Definition at line 143 of file CarlaLightSubsystem.cpp.

References ClientStates.

Referenced by FCarlaEngine::OnPostTick().

◆ NotifyDayTimeChange()

void UCarlaLightSubsystem::NotifyDayTimeChange ( bool  bIsDay)

Broadcast a day/night change and then re-apply the UE4->UE5 component intensity conversion on every registered light.

Use this instead of broadcasting DayTimeChangeEvent directly: blueprint-bound handlers push raw authored intensities into the light components, undoing any conversion applied earlier in the same broadcast.

Definition at line 109 of file CarlaLightSubsystem.cpp.

References bDayNightCycle, bHasDayTimeState, bLastIsDay, DayTimeChangeEvent, Lights, and SetClientStatesdirty().

Referenced by FFrameData::PlayWorldState(), and AWeather::UpdateStreetLightsForDayNight().

◆ NumLights()

int32 UCarlaLightSubsystem::NumLights ( ) const
inline

Definition at line 53 of file CarlaLightSubsystem.h.

Referenced by AWeather::UpdateStreetLightsForDayNight().

◆ RegisterLight()

void UCarlaLightSubsystem::RegisterLight ( UCarlaLight *  CarlaLight)

◆ ScheduleDayTimeState()

void UCarlaLightSubsystem::ScheduleDayTimeState ( UCarlaLight *  CarlaLight)
private

Definition at line 68 of file CarlaLightSubsystem.cpp.

References bLastIsDay, IsValid(), Lights, PendingDayTimeLights, and SetClientStatesdirty().

Referenced by RegisterLight().

◆ SetClientStatesdirty()

void UCarlaLightSubsystem::SetClientStatesdirty ( FString  ClientThatUpdate)

Flag every registered client (except ClientThatUpdate) so their LightManager re-queries light states.

Must be called after any server-side state change made outside a client request (day/night broadcast, recorder replay), or clients keep serving stale cached values.

Definition at line 228 of file CarlaLightSubsystem.cpp.

References ClientStates.

Referenced by NotifyDayTimeChange(), CarlaReplayerHelper::ProcessReplayerLightScene(), RegisterLight(), ScheduleDayTimeState(), and UnregisterLight().

◆ SetDayNightCycle()

void UCarlaLightSubsystem::SetDayNightCycle ( const bool  active)

◆ SetLights()

void UCarlaLightSubsystem::SetLights ( FString  Client,
std::vector< carla::rpc::LightState >  LightsToSet,
bool  DiscardClient = false 
)

Definition at line 176 of file CarlaLightSubsystem.cpp.

References ClientStates, and Lights.

Referenced by FCarlaServer::FPimpl::BindActions().

◆ UnregisterLight()

void UCarlaLightSubsystem::UnregisterLight ( UCarlaLight *  CarlaLight)

Definition at line 99 of file CarlaLightSubsystem.cpp.

References DayTimeChangeEvent, Lights, and SetClientStatesdirty().

Member Data Documentation

◆ bDayNightCycle

bool UCarlaLightSubsystem::bDayNightCycle = true
private

Definition at line 114 of file CarlaLightSubsystem.h.

Referenced by NotifyDayTimeChange(), RegisterLight(), and SetDayNightCycle().

◆ bHasDayTimeState

bool UCarlaLightSubsystem::bHasDayTimeState = false
private

Definition at line 111 of file CarlaLightSubsystem.h.

Referenced by NotifyDayTimeChange(), RegisterLight(), and SetDayNightCycle().

◆ bLastIsDay

bool UCarlaLightSubsystem::bLastIsDay = true
private

Definition at line 112 of file CarlaLightSubsystem.h.

Referenced by NotifyDayTimeChange(), and ScheduleDayTimeState().

◆ ClientStates

TMap<FString, bool> UCarlaLightSubsystem::ClientStates
private

Definition at line 118 of file CarlaLightSubsystem.h.

Referenced by GetLights(), IsUpdatePending(), SetClientStatesdirty(), and SetLights().

◆ DayTimeChangeEvent

FDayTimeChanged UCarlaLightSubsystem::DayTimeChangeEvent

Definition at line 86 of file CarlaLightSubsystem.h.

Referenced by NotifyDayTimeChange(), RegisterLight(), and UnregisterLight().

◆ Lights

TMap<int, UCarlaLight* > UCarlaLightSubsystem::Lights
private

◆ PendingDayTimeLights

TSet<TWeakObjectPtr<UCarlaLight> > UCarlaLightSubsystem::PendingDayTimeLights
private

Definition at line 115 of file CarlaLightSubsystem.h.

Referenced by ScheduleDayTimeState().


The documentation for this class was generated from the following files: