CARLA
Toggle main menu visibility
Loading...
Searching...
No Matches
Unreal
CarlaUnreal
Plugins
Carla
Source
Carla
Game
CarlaStatics.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/Game/CarlaEpisode.h
"
10
#include "
Carla/Game/CarlaGameInstance.h
"
11
#include "
Carla/Game/CarlaGameModeBase.h
"
12
#include "
Carla/Settings/CarlaSettings.h
"
13
14
#include <util/ue-header-guard-begin.h>
15
#include "Kismet/GameplayStatics.h"
16
#include "Kismet/BlueprintFunctionLibrary.h"
17
#include <util/ue-header-guard-end.h>
18
19
#include "CarlaStatics.generated.h"
20
21
// =============================================================================
22
// -- UCarlaStatics declaration ------------------------------------------------
23
// =============================================================================
24
25
UCLASS()
26
class CARLA_API
UCarlaStatics
: public
UBlueprintFunctionLibrary
27
{
28
GENERATED_BODY()
29
30
public
:
31
32
UFUNCTION(BlueprintPure, Category=
"CARLA"
, meta=(WorldContext=
"WorldContextObject"
))
33
static
ACarlaGameModeBase
*
GetGameMode
(
const
UObject
*WorldContextObject);
34
35
UFUNCTION(BlueprintPure, Category=
"CARLA"
, meta=(WorldContext=
"WorldContextObject"
))
36
static
UCarlaGameInstance
*
GetGameInstance
(
const
UObject
*WorldContextObject);
37
38
UFUNCTION(BlueprintPure, Category=
"CARLA"
, meta=(WorldContext=
"WorldContextObject"
))
39
static
UCarlaEpisode
*
GetCurrentEpisode
(
const
UObject
*WorldContextObject);
40
41
UFUNCTION(BlueprintPure, Category=
"CARLA"
, meta=(WorldContext=
"WorldContextObject"
))
42
static
UCarlaSettings
*
GetCarlaSettings
(
const
UObject
*WorldContextObject);
43
44
UFUNCTION(BlueprintPure, Category=
"CARLA"
)
45
static
TArray<FString>
GetAllPluginContentPaths
();
46
47
UFUNCTION(BlueprintPure, Category=
"CARLA"
)
48
static
TArray<FString>
GetAllMapNames
();
49
50
UFUNCTION(BlueprintPure, Category=
"CARLA"
)
51
static
FString
FindMapPath
(
const
FString &MapName);
52
53
/// Drop the cached .umap walk (content pack mounted/unmounted).
54
static
void
InvalidateMapCache
();
55
56
UFUNCTION(BlueprintPure, Category=
"CARLA"
, meta=(WorldContext=
"WorldContextObject"
))
57
static
ACarlaRecorder
*
GetRecorder
(
const
UObject
*WorldContextObject);
58
59
static
CarlaReplayer
*
GetReplayer
(
const
UObject
*WorldContextObject);
60
61
UFUNCTION(BlueprintPure, Category=
"CARLA"
, meta=(WorldContext=
"WorldContextObject"
))
62
static
ALargeMapManager
*
GetLargeMapManager
(
const
UObject
*WorldContextObject);
63
};
64
65
// =============================================================================
66
// -- UCarlaStatics implementation ---------------------------------------------
67
// =============================================================================
68
69
inline
ACarlaGameModeBase
*
UCarlaStatics::GetGameMode
(
const
UObject
*WorldContext)
70
{
71
return
Cast<ACarlaGameModeBase>(UGameplayStatics::GetGameMode(WorldContext));
72
}
73
74
inline
UCarlaGameInstance
*
UCarlaStatics::GetGameInstance
(
const
UObject
*WorldContext)
75
{
76
return
Cast<UCarlaGameInstance>(UGameplayStatics::GetGameInstance(WorldContext));
77
}
78
79
inline
UCarlaEpisode
*
UCarlaStatics::GetCurrentEpisode
(
const
UObject
*WorldContext)
80
{
81
auto
GameInstance =
GetGameInstance
(WorldContext);
82
return
GameInstance !=
nullptr
? GameInstance->GetCarlaEpisode() :
nullptr
;
83
}
84
85
inline
UCarlaSettings
*
UCarlaStatics::GetCarlaSettings
(
const
UObject
*WorldContext)
86
{
87
auto
GameInstance =
GetGameInstance
(WorldContext);
88
return
GameInstance !=
nullptr
? GameInstance->GetCARLASettings() :
nullptr
;
89
}
90
91
inline
ACarlaRecorder
*
UCarlaStatics::GetRecorder
(
const
UObject
*WorldContextObject)
92
{
93
auto
* Episode =
UCarlaStatics::GetCurrentEpisode
(WorldContextObject);
94
if
(Episode)
95
{
96
return
Episode->GetRecorder();
97
}
98
return
nullptr
;
99
}
100
101
inline
CarlaReplayer
*
UCarlaStatics::GetReplayer
(
const
UObject
*WorldContextObject)
102
{
103
auto
* Episode =
UCarlaStatics::GetCurrentEpisode
(WorldContextObject);
104
if
(Episode)
105
{
106
return
Episode->GetReplayer();
107
}
108
return
nullptr
;
109
}
110
111
inline
ALargeMapManager
*
UCarlaStatics::GetLargeMapManager
(
const
UObject
*WorldContextObject)
112
{
113
ACarlaGameModeBase
* GameMode =
GetGameMode
(WorldContextObject);
114
if
(GameMode)
115
{
116
return
GameMode->
GetLMManager
();
117
}
118
return
nullptr
;
119
}
CarlaEpisode.h
CarlaGameInstance.h
CarlaGameModeBase.h
CarlaSettings.h
ACarlaGameModeBase
Base class for the CARLA Game Mode.
Definition
CarlaGameModeBase.h:41
ACarlaGameModeBase::GetLMManager
ALargeMapManager * GetLMManager() const
Definition
CarlaGameModeBase.h:129
ACarlaRecorder
Recorder for the simulation.
Definition
CarlaRecorder.h:94
ALargeMapManager
Definition
LargeMapManager.h:62
CarlaReplayer
Definition
CarlaReplayer.h:29
UBlueprintFunctionLibrary
UCarlaEpisode
A simulation episode.
Definition
CarlaEpisode.h:45
UCarlaGameInstance
The game instance contains elements that must be kept alive in between levels.
Definition
CarlaGameInstance.h:30
UCarlaSettings
Global settings for CARLA.
Definition
CarlaSettings.h:23
UCarlaStatics
Definition
CarlaStatics.h:27
UCarlaStatics::FindMapPath
static FString FindMapPath(const FString &MapName)
Definition
CarlaStatics.cpp:201
UCarlaStatics::GetGameInstance
static UCarlaGameInstance * GetGameInstance(const UObject *WorldContextObject)
Definition
CarlaStatics.h:74
UCarlaStatics::GetCarlaSettings
static UCarlaSettings * GetCarlaSettings(const UObject *WorldContextObject)
Definition
CarlaStatics.h:85
UCarlaStatics::InvalidateMapCache
static void InvalidateMapCache()
Drop the cached .umap walk (content pack mounted/unmounted).
Definition
CarlaStatics.cpp:107
UCarlaStatics::GetReplayer
static CarlaReplayer * GetReplayer(const UObject *WorldContextObject)
Definition
CarlaStatics.h:101
UCarlaStatics::GetLargeMapManager
static ALargeMapManager * GetLargeMapManager(const UObject *WorldContextObject)
Definition
CarlaStatics.h:111
UCarlaStatics::GetCurrentEpisode
static UCarlaEpisode * GetCurrentEpisode(const UObject *WorldContextObject)
Definition
CarlaStatics.h:79
UCarlaStatics::GetAllPluginContentPaths
static TArray< FString > GetAllPluginContentPaths()
Definition
CarlaStatics.cpp:112
UCarlaStatics::GetAllMapNames
static TArray< FString > GetAllMapNames()
Definition
CarlaStatics.cpp:163
UCarlaStatics::GetGameMode
static ACarlaGameModeBase * GetGameMode(const UObject *WorldContextObject)
Definition
CarlaStatics.h:69
UCarlaStatics::GetRecorder
static ACarlaRecorder * GetRecorder(const UObject *WorldContextObject)
Definition
CarlaStatics.h:91
UObject
Generated by
1.18.0