CARLA
Toggle main menu visibility
Loading...
Searching...
No Matches
Unreal
CarlaUnreal
Plugins
Carla
Source
Carla
Settings
CarlaSettingsDelegate.h
Go to the documentation of this file.
1
// Copyright (c) 2026 Computer Vision Center (CVC) at the Universitat Autonoma
2
// de Barcelona (UAB).
3
//
4
// This work is licensed under the terms of the MIT license.
5
// For a copy, see <https://opensource.org/licenses/MIT>.
6
7
#pragma once
8
9
#include "
Carla/Settings/QualityLevelUE.h
"
10
11
#include <util/ue-header-guard-begin.h>
12
#include "CoreMinimal.h"
13
#include "Engine/StaticMesh.h"
14
#include "Engine/World.h"
15
#include <util/ue-header-guard-end.h>
16
17
#include "CarlaSettingsDelegate.generated.h"
18
19
class
UCarlaSettings
;
20
21
/// Used to set settings for every actor that is spawned into the world.
22
UCLASS(BlueprintType)
23
class CARLA_API
UCarlaSettingsDelegate
: public
UObject
24
{
25
GENERATED_BODY()
26
27
public
:
28
29
UCarlaSettingsDelegate
();
30
31
/// Reset settings to default.
32
void
Reset
();
33
34
/// Create the event trigger handler for all the newly spawned actors to be
35
/// processed with a custom function here.
36
void
RegisterSpawnHandler
(UWorld *World);
37
38
/// After loading a level, apply the current settings.
39
UFUNCTION(BlueprintCallable, Category =
"CARLA Settings"
, meta = (HidePin =
"InWorld"
))
40
void
ApplyQualityLevelPostRestart
();
41
42
/// Before loading a level, apply the current settings.
43
UFUNCTION(BlueprintCallable, Category =
"CARLA Settings"
, meta = (HidePin =
"InWorld"
))
44
void
ApplyQualityLevelPreRestart
();
45
46
void
SetAllActorsDrawDistance
(UWorld *world,
float
max_draw_distance)
const
;
47
48
private
:
49
50
UWorld *
GetLocalWorld
();
51
52
/// Check that the world, instance and settings are valid and save the
53
/// CarlaSettings instance.
54
///
55
/// @param world used to get the instance of CarlaSettings.
56
void
CheckCarlaSettings
(UWorld *world);
57
58
void
SetAllRoads
(
59
UWorld *world,
60
float
max_draw_distance,
61
const
TArray<FStaticMaterial> &road_pieces_materials)
const
;
62
63
void
SetActorComponentsDrawDistance
(
AActor
*actor,
float
max_draw_distance)
const
;
64
65
void
SetPostProcessEffectsEnabled
(UWorld *world,
bool
enabled)
const
;
66
67
void
SetAllLights
(
68
UWorld *world,
69
float
max_distance_fade,
70
bool
cast_shadows,
71
bool
hide_non_directional)
const
;
72
73
/// Single-pass replacement for SetAllLights + SetAllActorsDrawDistance
74
/// when applying a quality tier. Walks the actor list once and dispatches
75
/// per-type, halving the cost of a tier change.
76
void
ApplyPerActorQualitySettings
(
77
UWorld *world,
78
float
light_fade_distance,
79
bool
cast_directional_shadows,
80
bool
hide_non_directional_lights,
81
float
draw_distance)
const
;
82
83
private
:
84
85
/// Currently applied quality level after level is restarted.
86
static
EQualityLevel
AppliedLowPostResetQualityLevel
;
87
88
UCarlaSettings
*
CarlaSettings
=
nullptr
;
89
};
QualityLevelUE.h
EQualityLevel
EQualityLevel
Definition
QualityLevelUE.h:19
AActor
UCarlaSettingsDelegate::SetAllRoads
void SetAllRoads(UWorld *world, float max_draw_distance, const TArray< FStaticMaterial > &road_pieces_materials) const
Definition
CarlaSettingsDelegate.cpp:114
UCarlaSettingsDelegate::SetPostProcessEffectsEnabled
void SetPostProcessEffectsEnabled(UWorld *world, bool enabled) const
Definition
CarlaSettingsDelegate.cpp:239
UCarlaSettingsDelegate::ApplyQualityLevelPreRestart
void ApplyQualityLevelPreRestart()
Before loading a level, apply the current settings.
Definition
CarlaSettingsDelegate.cpp:67
UCarlaSettingsDelegate::UCarlaSettingsDelegate
UCarlaSettingsDelegate()
Definition
CarlaSettingsDelegate.cpp:34
UCarlaSettingsDelegate::ApplyQualityLevelPostRestart
void ApplyQualityLevelPostRestart()
After loading a level, apply the current settings.
Definition
CarlaSettingsDelegate.cpp:46
UCarlaSettingsDelegate::Reset
void Reset()
Reset settings to default.
Definition
CarlaSettingsDelegate.cpp:36
UCarlaSettingsDelegate::CarlaSettings
UCarlaSettings * CarlaSettings
Definition
CarlaSettingsDelegate.h:88
UCarlaSettingsDelegate::CheckCarlaSettings
void CheckCarlaSettings(UWorld *world)
Check that the world, instance and settings are valid and save the CarlaSettings instance.
Definition
CarlaSettingsDelegate.cpp:97
UCarlaSettingsDelegate::GetLocalWorld
UWorld * GetLocalWorld()
Definition
CarlaSettingsDelegate.cpp:92
UCarlaSettingsDelegate::ApplyPerActorQualitySettings
void ApplyPerActorQualitySettings(UWorld *world, float light_fade_distance, bool cast_directional_shadows, bool hide_non_directional_lights, float draw_distance) const
Single-pass replacement for SetAllLights + SetAllActorsDrawDistance when applying a quality tier.
Definition
CarlaSettingsDelegate.cpp:296
UCarlaSettingsDelegate::SetAllActorsDrawDistance
void SetAllActorsDrawDistance(UWorld *world, float max_draw_distance) const
Definition
CarlaSettingsDelegate.cpp:205
UCarlaSettingsDelegate::RegisterSpawnHandler
void RegisterSpawnHandler(UWorld *World)
Create the event trigger handler for all the newly spawned actors to be processed with a custom funct...
Definition
CarlaSettingsDelegate.cpp:41
UCarlaSettingsDelegate::AppliedLowPostResetQualityLevel
static EQualityLevel AppliedLowPostResetQualityLevel
Currently applied quality level after level is restarted.
Definition
CarlaSettingsDelegate.h:86
UCarlaSettingsDelegate::SetAllLights
void SetAllLights(UWorld *world, float max_distance_fade, bool cast_shadows, bool hide_non_directional) const
Definition
CarlaSettingsDelegate.cpp:258
UCarlaSettingsDelegate::SetActorComponentsDrawDistance
void SetActorComponentsDrawDistance(AActor *actor, float max_draw_distance) const
Definition
CarlaSettingsDelegate.cpp:178
UCarlaSettings
Global settings for CARLA.
Definition
CarlaSettings.h:23
UObject
Generated by
1.18.0