12 #include "CommandLine.h" 13 #include "Engine/DirectionalLight.h" 14 #include "Engine/Engine.h" 15 #include "Engine/PointLight.h" 16 #include "Engine/PostProcessVolume.h" 17 #include "Engine/StaticMesh.h" 18 #include "Kismet/GameplayStatics.h" 19 #include "Materials/MaterialInstance.h" 21 #include "UnrealMathUtility.h" 24 #define S_CARLA_SERVER TEXT("CARLA/Server") 25 #define S_CARLA_QUALITYSETTINGS TEXT("CARLA/QualitySettings") 39 const FString &SQualitySettingsLevel,
42 if (SQualitySettingsLevel.Equals(
"Low"))
46 if (SQualitySettingsLevel.Equals(
"Epic"))
55 const UEnum *ptr = FindObject<UEnum>(ANY_PACKAGE, TEXT(
"EQualityLevel"),
true);
58 return FString(
"Invalid");
60 return ptr->GetNameStringByIndex(static_cast<int32>(QualitySettingsLevel));
66 const bool bLoadCarlaServerSection)
69 if (bLoadCarlaServerSection)
85 FString sQualityLevel;
94 if (FPaths::IsRelative(Value))
96 Value = FPaths::ConvertRelativePathToFull(FPaths::LaunchDir(), Value);
111 LoadSettingsFromFile(FPaths::Combine(FPaths::ProjectConfigDir(), TEXT(
"CarlaSettings.ini")),
false);
149 FString StringQualityLevel;
150 if (FParse::Value(
FCommandLine::Get(), TEXT(
"-quality-level="), StringQualityLevel))
167 UE_LOG(LogCarla, Log, TEXT(
"Loading CARLA settings from string"));
170 constexpr
bool bLoadCarlaServerSection =
false;
177 auto EnabledDisabled = [](
bool bValue) {
return (bValue ? TEXT(
"Enabled") : TEXT(
"Disabled")); };
178 UE_LOG(LogCarla, Log,
179 TEXT(
"== CARLA Settings =============================================================="));
180 UE_LOG(LogCarla, Log, TEXT(
"Last settings file loaded: %s"), *
CurrentFileName);
182 UE_LOG(LogCarla, Log, TEXT(
"RPC Port = %d"),
RPCPort);
183 UE_LOG(LogCarla, Log, TEXT(
"Streaming Port = %d"),
StreamingPort);
184 UE_LOG(LogCarla, Log, TEXT(
"Secondary Port = %d"),
SecondaryPort);
185 UE_LOG(LogCarla, Log, TEXT(
"Synchronous Mode = %s"), EnabledDisabled(
bSynchronousMode));
186 UE_LOG(LogCarla, Log, TEXT(
"Rendering = %s"), EnabledDisabled(!
bDisableRendering));
189 UE_LOG(LogCarla, Log,
190 TEXT(
"================================================================================"));
193 #undef S_CARLA_QUALITYSETTINGS 194 #undef S_CARLA_SERVER 198 if (FPaths::FileExists(FilePath))
200 UE_LOG(LogCarla, Log, TEXT(
"Loading CARLA settings from \"%s\""), *FilePath);
201 const FIniFile ConfigFile(FilePath);
202 constexpr
bool bLoadCarlaServerSection =
true;
206 else if (bLogOnFailure)
208 UE_LOG(LogCarla, Error, TEXT(
"Unable to find settings file \"%s\""), *FilePath);
bool bSynchronousMode
In synchronous mode, CARLA waits every tick until the control from the client is received.
uint32 SecondaryPort
setting for the secondary servers port.
EQualityLevel QualityLevel
Quality Settings level.
void GetString(const TCHAR *Section, const TCHAR *Key, FString &Target) const
void GetInt(const TCHAR *Section, const TCHAR *Key, T &Target) const
static bool GetSettingsFilePathFromCommandLine(FString &Value)
uint32 StreamingPort
setting for the streaming port.
void LoadSettingsFromFile(const FString &FilePath, bool bLogOnFailure)
void LoadSettings()
Load the settings based on the command-line arguments and the INI file if provided.
void SetQualityLevel(EQualityLevel InQualityLevel)
Sets the new quality settings level and make changes in the game related to it.
#define S_CARLA_QUALITYSETTINGS
static T Get(carla::rpc::Response< T > &response)
void LoadSettingsFromString(const FString &INIFileContents)
Load the settings from the given string (formatted as INI).
static void LoadSettingsFromConfig(const FIniFile &ConfigFile, UCarlaSettings &Settings, const bool bLoadCarlaServerSection)
static EQualityLevel QualityLevelFromString(const FString &SQualitySettingsLevel, const EQualityLevel Default=EQualityLevel::INVALID)
void ProcessInputFileContents(const FString &INIFileContents)
std::string PrimaryIP
setting for the IP and Port of the primary server to connect.
Global settings for CARLA.
void GetBool(const TCHAR *Section, const TCHAR *Key, bool &Target) const
FString QualityLevelToString(EQualityLevel QualitySettingsLevel)
uint32 RPCPort
World port to listen for client connections.
static const FName CARLA_ROAD_TAG
CARLA_ROAD name to tag road mesh actors.
void LogSettings() const
Log settings values.
FString CurrentFileName
File name of the settings file used to load this settings.
bool bDisableRendering
Enable or disable the viewport rendering of the world.
static const FName CARLA_SKY_TAG
CARLA_SKY name to tag the sky sphere (BPS) actors in the scenes.
Wrapper around Unreal's INI file.