CARLA
Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
UCarlaSettingsDelegate Class Reference

Used to set settings for every actor that is spawned into the world. More...

#include <CarlaSettingsDelegate.h>

+ Inheritance diagram for UCarlaSettingsDelegate:
+ Collaboration diagram for UCarlaSettingsDelegate:

Public Member Functions

void ApplyQualityLevelPostRestart ()
 After loading a level, apply the current settings. More...
 
void ApplyQualityLevelPreRestart ()
 Before loading a level, apply the current settings. More...
 
void RegisterSpawnHandler (UWorld *World)
 Create the event trigger handler for all the newly spawned actors to be processed with a custom function here. More...
 
void Reset ()
 Reset settings to default. More...
 
void SetAllActorsDrawDistance (UWorld *world, float max_draw_distance) const
 
 UCarlaSettingsDelegate ()
 

Private Member Functions

void CheckCarlaSettings (UWorld *world)
 Check that the world, instance and settings are valid and save the CarlaSettings instance. More...
 
UWorld * GetLocalWorld ()
 
void LaunchEpicQualityCommands (UWorld *world) const
 Execute engine commands to apply the epic quality level to the world. More...
 
void LaunchLowQualityCommands (UWorld *world) const
 Execute engine commands to apply the low quality level to the world. More...
 
void OnActorSpawned (AActor *Actor)
 Function to apply to the actor that is being spawned to apply the current settings. More...
 
void SetActorComponentsDrawDistance (AActor *actor, float max_draw_distance) const
 
void SetAllLights (UWorld *world, float max_distance_fade, bool cast_shadows, bool hide_non_directional) const
 
void SetAllRoads (UWorld *world, float max_draw_distance, const TArray< FStaticMaterial > &road_pieces_materials) const
 
void SetPostProcessEffectsEnabled (UWorld *world, bool enabled) const
 

Private Attributes

FOnActorSpawned::FDelegate ActorSpawnedDelegate
 
UCarlaSettingsCarlaSettings = nullptr
 

Static Private Attributes

static EQualityLevel AppliedLowPostResetQualityLevel = EQualityLevel::Epic
 Currently applied quality level after level is restarted. More...
 

Detailed Description

Used to set settings for every actor that is spawned into the world.

Definition at line 21 of file CarlaSettingsDelegate.h.

Constructor & Destructor Documentation

◆ UCarlaSettingsDelegate()

UCarlaSettingsDelegate::UCarlaSettingsDelegate ( )

Definition at line 27 of file CarlaSettingsDelegate.cpp.

Member Function Documentation

◆ ApplyQualityLevelPostRestart()

void UCarlaSettingsDelegate::ApplyQualityLevelPostRestart ( )

After loading a level, apply the current settings.

Definition at line 73 of file CarlaSettingsDelegate.cpp.

References AppliedLowPostResetQualityLevel, CarlaSettings, CheckCarlaSettings(), Epic, UCarlaSettings::GetQualityLevel(), LaunchEpicQualityCommands(), LaunchLowQualityCommands(), Low, UCarlaSettings::LowLightFadeDistance, SetAllActorsDrawDistance(), SetAllLights(), SetAllRoads(), and SetPostProcessEffectsEnabled().

Referenced by ACarlaGameModeBase::InitGame().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ApplyQualityLevelPreRestart()

void UCarlaSettingsDelegate::ApplyQualityLevelPreRestart ( )

Before loading a level, apply the current settings.

Definition at line 120 of file CarlaSettingsDelegate.cpp.

References UCarlaSettings::bDisableRendering, CarlaSettings, CheckCarlaSettings(), and IsValid().

Referenced by ACarlaGameModeBase::RestartPlayer().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CheckCarlaSettings()

void UCarlaSettingsDelegate::CheckCarlaSettings ( UWorld *  world)
private

Check that the world, instance and settings are valid and save the CarlaSettings instance.

Parameters
worldused to get the instance of CarlaSettings.

Definition at line 152 of file CarlaSettingsDelegate.cpp.

References CarlaSettings, GetLocalWorld(), and IsValid().

Referenced by ApplyQualityLevelPostRestart(), ApplyQualityLevelPreRestart(), and RegisterSpawnHandler().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetLocalWorld()

UWorld * UCarlaSettingsDelegate::GetLocalWorld ( )
private

Definition at line 147 of file CarlaSettingsDelegate.cpp.

Referenced by CheckCarlaSettings().

+ Here is the caller graph for this function:

◆ LaunchEpicQualityCommands()

void UCarlaSettingsDelegate::LaunchEpicQualityCommands ( UWorld *  world) const
private

Execute engine commands to apply the epic quality level to the world.

Definition at line 371 of file CarlaSettingsDelegate.cpp.

Referenced by ApplyQualityLevelPostRestart().

+ Here is the caller graph for this function:

◆ LaunchLowQualityCommands()

void UCarlaSettingsDelegate::LaunchLowQualityCommands ( UWorld *  world) const
private

Execute engine commands to apply the low quality level to the world.

Definition at line 169 of file CarlaSettingsDelegate.cpp.

Referenced by ApplyQualityLevelPostRestart().

+ Here is the caller graph for this function:

◆ OnActorSpawned()

void UCarlaSettingsDelegate::OnActorSpawned ( AActor Actor)
private

Function to apply to the actor that is being spawned to apply the current settings.

Definition at line 43 of file CarlaSettingsDelegate.cpp.

References UCarlaSettings::CARLA_ROAD_TAG, CARLA_SETTINGS_MAX_SCALE_SIZE, UCarlaSettings::CARLA_SKY_TAG, CarlaSettings, UCarlaSettings::GetQualityLevel(), IsValid(), Low, and SetActorComponentsDrawDistance().

+ Here is the call graph for this function:

◆ RegisterSpawnHandler()

void UCarlaSettingsDelegate::RegisterSpawnHandler ( UWorld *  World)

Create the event trigger handler for all the newly spawned actors to be processed with a custom function here.

Definition at line 37 of file CarlaSettingsDelegate.cpp.

References ActorSpawnedDelegate, and CheckCarlaSettings().

Referenced by ACarlaGameModeBase::InitGame().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Reset()

void UCarlaSettingsDelegate::Reset ( void  )

Reset settings to default.

Definition at line 32 of file CarlaSettingsDelegate.cpp.

References AppliedLowPostResetQualityLevel, and Epic.

Referenced by ACarlaGameModeBase::EndPlay().

+ Here is the caller graph for this function:

◆ SetActorComponentsDrawDistance()

void UCarlaSettingsDelegate::SetActorComponentsDrawDistance ( AActor actor,
float  max_draw_distance 
) const
private

Definition at line 291 of file CarlaSettingsDelegate.cpp.

References CARLA_SETTINGS_MAX_SCALE_SIZE, and IsValid().

Referenced by OnActorSpawned(), and SetAllActorsDrawDistance().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetAllActorsDrawDistance()

void UCarlaSettingsDelegate::SetAllActorsDrawDistance ( UWorld *  world,
float  max_draw_distance 
) const

: use semantics to grab all actors by type (vehicles,ground,people,props) and set different distances configured in the global properties

Definition at line 318 of file CarlaSettingsDelegate.cpp.

References UCarlaSettings::CARLA_ROAD_TAG, UCarlaSettings::CARLA_SKY_TAG, IsValid(), and SetActorComponentsDrawDistance().

Referenced by ApplyQualityLevelPostRestart(), and ACarlaGameModeBase::OnEpisodeSettingsChanged().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetAllLights()

void UCarlaSettingsDelegate::SetAllLights ( UWorld *  world,
float  max_distance_fade,
bool  cast_shadows,
bool  hide_non_directional 
) const
private

Definition at line 416 of file CarlaSettingsDelegate.cpp.

References IsValid().

Referenced by ApplyQualityLevelPostRestart().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetAllRoads()

void UCarlaSettingsDelegate::SetAllRoads ( UWorld *  world,
float  max_draw_distance,
const TArray< FStaticMaterial > &  road_pieces_materials 
) const
private

Definition at line 227 of file CarlaSettingsDelegate.cpp.

References UCarlaSettings::CARLA_ROAD_TAG, and IsValid().

Referenced by ApplyQualityLevelPostRestart().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetPostProcessEffectsEnabled()

void UCarlaSettingsDelegate::SetPostProcessEffectsEnabled ( UWorld *  world,
bool  enabled 
) const
private

Definition at line 352 of file CarlaSettingsDelegate.cpp.

References IsValid().

Referenced by ApplyQualityLevelPostRestart().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ ActorSpawnedDelegate

FOnActorSpawned::FDelegate UCarlaSettingsDelegate::ActorSpawnedDelegate
private

Definition at line 88 of file CarlaSettingsDelegate.h.

Referenced by RegisterSpawnHandler().

◆ AppliedLowPostResetQualityLevel

EQualityLevel UCarlaSettingsDelegate::AppliedLowPostResetQualityLevel = EQualityLevel::Epic
staticprivate

Currently applied quality level after level is restarted.

quality settings configuration between runs

Definition at line 84 of file CarlaSettingsDelegate.h.

Referenced by ApplyQualityLevelPostRestart(), and Reset().

◆ CarlaSettings

UCarlaSettings* UCarlaSettingsDelegate::CarlaSettings = nullptr
private

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