27#include <util/ue-header-guard-begin.h>
28#include "Components/DirectionalLightComponent.h"
29#include "Engine/DecalActor.h"
30#include "Engine/LevelStreaming.h"
31#include "Engine/LocalPlayer.h"
32#include "Materials/MaterialInstanceDynamic.h"
33#include "Engine/StaticMeshActor.h"
34#include "EngineUtils.h"
35#include "Async/ParallelFor.h"
36#include "DynamicRHI.h"
37#include "DrawDebugHelpers.h"
38#include "Kismet/KismetSystemLibrary.h"
39#include "Misc/PackageName.h"
40#include <util/ue-header-guard-end.h>
47 : Super(ObjectInitializer)
49 PrimaryActorTick.bCanEverTick =
true;
50 PrimaryActorTick.TickGroup = TG_PrePhysics;
51 bAllowTickBeforeBeginPlay =
false;
53 Episode = CreateDefaultSubobject<UCarlaEpisode>(TEXT(
"Episode"));
55 Recorder = CreateDefaultSubobject<ACarlaRecorder>(TEXT(
"Recorder"));
57 ObjectRegister = CreateDefaultSubobject<UObjectRegister>(TEXT(
"ObjectRegister"));
60 HUDClass = ACarlaHUD::StaticClass();
62 TaggerDelegate = CreateDefaultSubobject<UTaggerDelegate>(TEXT(
"TaggerDelegate"));
63 CarlaSettingsDelegate = CreateDefaultSubobject<UCarlaSettingsDelegate>(TEXT(
"CarlaSettingsDelegate"));
68 UWorld* World = GetWorld();
69 TSoftObjectPtr<UWorld> AssetPtr (World);
70 FString Path = FPaths::GetPath(AssetPtr.GetLongPackageName());
71 Path.RemoveFromStart(
"/Game/");
80 UWorld* World = GetWorld();
81 const FString PackagePath = FPaths::GetPath(World->GetPackage()->GetName());
83 if (!PackagePath.StartsWith(TEXT(
"/Game/")) &&
84 FPackageName::TryConvertLongPackageNameToFilename(PackagePath, Filename))
86 return FPaths::ConvertRelativePathToFull(Filename);
89 return FPaths::ConvertRelativePathToFull(FPaths::ProjectContentDir()) + Path;
93 const FString &MapName,
94 const FString &Options,
95 FString &ErrorMessage)
98 Super::InitGame(MapName, Options, ErrorMessage);
100 UWorld* World = GetWorld();
101 check(World !=
nullptr);
102 FString InMapName(MapName);
106 TEXT(
"Missing episode, can't continue without an episode!"));
109 UGameplayStatics::GetActorOfClass(GetWorld(), ALargeMapManager::StaticClass());
110 LMManager = Cast<ALargeMapManager>(LMManagerActor);
111 if (
LMManager && World->GetWorldPartition() !=
nullptr)
118 UE_LOG(LogCarla, Log, TEXT(
119 "World Partition map detected: disabling legacy LargeMapManager"));
135 FString CorrectedMapName = InMapName;
136 constexpr auto PIEPrefix = TEXT(
"UEDPIE_0_");
137 CorrectedMapName.RemoveFromStart(PIEPrefix);
138 UE_LOG(LogCarla, Log, TEXT(
"Corrected map name from %s to %s"), *InMapName, *CorrectedMapName);
145 GameInstance = Cast<UCarlaGameInstance>(GetGameInstance());
148 TEXT(
"GameInstance is not a UCarlaGameInstance, did you forget to set "
149 "it in the project settings?"));
154 UE_LOG(LogCarla, Error, TEXT(
"Missing TaggerDelegate!"));
161 UE_LOG(LogCarla, Error, TEXT(
"Missing CarlaSettingsDelegate!"));
164 if (UGameplayStatics::GetActorOfClass(World, ASkyBase::StaticClass()) ==
nullptr)
168 UClass* SkyClass = LoadClass<ASkyBase>(
170 TEXT(
"/Game/Carla/Blueprints/LevelDesign/BP_Carla_Sky.BP_Carla_Sky_C"));
171 if (SkyClass !=
nullptr)
174 if (SkyActor !=
nullptr)
183 TArray<UDirectionalLightComponent*> SunComponents;
184 SkyActor->GetComponents<UDirectionalLightComponent>(SunComponents);
185 for (UDirectionalLightComponent* SunComponent : SunComponents)
187 if (SunComponent->GetName().Contains(TEXT(
"Sun")))
189 SunComponent->SetWorldRotation(FRotator(-45.0f, 45.0f, 0.0f));
193 UE_LOG(LogCarla, Log, TEXT(
"Map without a sky rig: spawned BP_Carla_Sky"));
202 UGameplayStatics::GetActorOfClass(GetWorld(), AWeather::StaticClass());
203 if (WeatherActor !=
nullptr) {
204 UE_LOG(LogCarla, Log, TEXT(
"Existing weather actor. Doing nothing then!"));
217 TEXT(
"/Game/Carla/Blueprints/Weather/BP_CarlaWeather.BP_CarlaWeather_C"));
222 UE_LOG(LogCarla, Error, TEXT(
"Missing weather class!"));
266 Super::RestartPlayer(NewPlayer);
279 for (TFieldIterator<FProperty> It(
Weather->GetClass()); It; ++It)
281 if ((*It)->GetAuthoredName() != TEXT(
"DefaultWeathers") && (*It)->GetName() != TEXT(
"DefaultWeathers"))
285 const FMapProperty* MapProp = CastField<FMapProperty>(*It);
286 if (MapProp ==
nullptr)
290 const FStrProperty* KeyProp = CastField<FStrProperty>(MapProp->KeyProp);
291 if (KeyProp ==
nullptr)
295 FScriptMapHelper Helper(MapProp, MapProp->ContainerPtrToValuePtr<
void>(
Weather));
296 for (FScriptMapHelper::FIterator MapIt(Helper); MapIt; ++MapIt)
298 if (KeyProp->GetPropertyValue(Helper.GetKeyPtr(MapIt.GetInternalIndex())) == MapName)
312 UWorld* World = GetWorld();
313 check(World !=
nullptr);
326 if (World->GetWorldPartition() !=
nullptr)
328 FWorldDelegates::LevelAddedToWorld.AddUObject(
339 World->SpawnActor<ADecalActor>(
340 FVector(0,0,-1000000), FRotator(0,0,0), FActorSpawnParameters());
343 Manager->InitializeTrafficLights();
359 FString MapName = World->GetMapName();
360 MapName.RemoveFromStart(World->StreamingLevelsPrefix);
380 World->GetTimerManager().SetTimerForNextTick([WeakWeather, DefaultWeather]()
382 if (WeakWeather.IsValid())
384 WeakWeather->ApplyWeather(DefaultWeather);
413 TArray<AActor*> FoundActors;
414 UGameplayStatics::GetAllActorsOfClass(World, AActor::StaticClass(), FoundActors);
415 for(
AActor* Actor : FoundActors)
417 TArray<UCarlaLight*> Lights;
418 Actor->GetComponents(Lights,
false);
419 for(UCarlaLight* Light : Lights)
421 Light->RegisterLight();
429 TArray<FString> Names;
430 TArray<AActor*> Actors;
431 UGameplayStatics::GetAllActorsOfClass(GetWorld(), AActor::StaticClass(), Actors);
432 for (
AActor* Actor : Actors)
434 TArray<UStaticMeshComponent*> StaticMeshes;
435 Actor->GetComponents(StaticMeshes);
436 if (StaticMeshes.Num())
438 Names.Add(Actor->GetName());
446 TArray<AActor*> Actors;
447 UGameplayStatics::GetAllActorsOfClass(GetWorld(), AActor::StaticClass(), Actors);
448 for (
AActor* Actor : Actors)
450 if(Actor->GetName() == ActorName)
461 FlushRenderingCommands();
462 TArray<FColor> Colors;
467 auto& Color = Texture.
At(
x,
y);
468 Colors.Add(FColor(Color.
r, Color.
g, Color.
b, Color.
a));
471 UTexture2D* UETexture = UTexture2D::CreateTransient(Texture.
GetWidth(), Texture.
GetHeight(), EPixelFormat::PF_B8G8R8A8);
472 FTexture2DMipMap& Mip = UETexture->GetPlatformData()->Mips[0];
473 void* Data = Mip.BulkData.Lock( LOCK_READ_WRITE );
474 FMemory::Memcpy( Data,
477 Mip.BulkData.Unlock();
478 UETexture->UpdateResource();
484 FlushRenderingCommands();
485 TArray<FFloat16Color> Colors;
490 auto& Color = Texture.
At(
x,
y);
491 Colors.Add(FLinearColor(Color.
r, Color.
g, Color.
b, Color.
a));
494 UTexture2D* UETexture = UTexture2D::CreateTransient(Texture.
GetWidth(), Texture.
GetHeight(), EPixelFormat::PF_FloatRGBA);
495 FTexture2DMipMap& Mip = UETexture->GetPlatformData()->Mips[0];
496 void* Data = Mip.BulkData.Lock( LOCK_READ_WRITE );
497 FMemory::Memcpy( Data,
500 Mip.BulkData.Unlock();
501 UETexture->UpdateResource();
511 TArray<UStaticMeshComponent*> StaticMeshes;
512 Actor->GetComponents(StaticMeshes);
513 for (UStaticMeshComponent* Mesh : StaticMeshes)
515 for (
int i = 0; i < Mesh->GetNumMaterials(); ++i)
517 UMaterialInterface* OriginalMaterial = Mesh->GetMaterial(i);
518 UMaterialInstanceDynamic* DynamicMaterial = Cast<UMaterialInstanceDynamic>(OriginalMaterial);
521 DynamicMaterial = UMaterialInstanceDynamic::Create(OriginalMaterial, NULL);
522 Mesh->SetMaterial(i, DynamicMaterial);
527 case cr::MaterialParameter::Tex_Diffuse:
528 DynamicMaterial->SetTextureParameterValue(
"BaseColor", Texture);
529 DynamicMaterial->SetTextureParameterValue(
"Difuse", Texture);
530 DynamicMaterial->SetTextureParameterValue(
"Difuse 2", Texture);
531 DynamicMaterial->SetTextureParameterValue(
"Difuse 3", Texture);
532 DynamicMaterial->SetTextureParameterValue(
"Difuse 4", Texture);
534 case cr::MaterialParameter::Tex_Normal:
535 DynamicMaterial->SetTextureParameterValue(
"Normal", Texture);
536 DynamicMaterial->SetTextureParameterValue(
"Normal 2", Texture);
537 DynamicMaterial->SetTextureParameterValue(
"Normal 3", Texture);
538 DynamicMaterial->SetTextureParameterValue(
"Normal 4", Texture);
540 case cr::MaterialParameter::Tex_Emissive:
541 DynamicMaterial->SetTextureParameterValue(
"Emissive", Texture);
543 case cr::MaterialParameter::Tex_Ao_Roughness_Metallic_Emissive:
544 DynamicMaterial->SetTextureParameterValue(
"AO / Roughness / Metallic / Emissive", Texture);
545 DynamicMaterial->SetTextureParameterValue(
"ORMH", Texture);
546 DynamicMaterial->SetTextureParameterValue(
"ORMH 2", Texture);
547 DynamicMaterial->SetTextureParameterValue(
"ORMH 3", Texture);
548 DynamicMaterial->SetTextureParameterValue(
"ORMH 4", Texture);
558 Super::Tick(DeltaSeconds);
569 if (InLevel ==
nullptr || InWorld != GetWorld())
578 TArray<AActor*> DuplicateManagers;
579 for (
AActor* Actor : InLevel->Actors)
584 DuplicateManagers.Add(Actor);
587 for (
AActor* Actor : DuplicateManagers)
589 UE_LOG(LogCarla, Log, TEXT(
"Destroying streamed-in duplicate TrafficLightManager %s"),
597 FWorldDelegates::LevelAddedToWorld.RemoveAll(
this);
603 Super::EndPlay(EndPlayReason);
613 auto *World = GetWorld();
614 check(World !=
nullptr);
618 if (FactoryClass !=
nullptr)
621 if (Factory !=
nullptr)
628 UE_LOG(LogCarla, Error, TEXT(
"Failed to spawn actor spawner"));
636 for (TActorIterator<AVehicleSpawnPoint> It(GetWorld()); It; ++It)
651 UE_LOG(LogCarla, Log, TEXT(
"Generating SpawnPoints ..."));
652 std::vector<std::pair<carla::road::element::Waypoint, carla::road::element::Waypoint>> Topology =
Map->GenerateTopology();
653 UWorld* World = GetWorld();
654 for(
auto& Pair : Topology)
657 FTransform Transform(CarlaTransform);
658 Transform.AddToTranslation(FVector(0.f, 0.f, 50.0f));
667 if (!
Map.has_value()) {
668 UE_LOG(LogCarla, Error, TEXT(
"Invalid Map"));
680 UWorld* World = GetWorld();
681 AActor* TrafficLightManagerActor = UGameplayStatics::GetActorOfClass(World, ATrafficLightManager::StaticClass());
683 if (TrafficLightManagerActor !=
nullptr &&
684 World->GetWorldPartition() !=
nullptr &&
685 TrafficLightManagerActor->GetLevel() != World->PersistentLevel)
691 BakedInStreamedCell = Cast<ATrafficLightManager>(TrafficLightManagerActor);
692 TrafficLightManagerActor =
nullptr;
694 if(TrafficLightManagerActor ==
nullptr)
696 FActorSpawnParameters SpawnParams;
702 BakedInStreamedCell->Destroy();
715 TArray<AActor*> WorldActors;
716 UGameplayStatics::GetAllActorsOfClass(GetWorld(), AStaticMeshActor::StaticClass(), WorldActors);
718 for (
AActor *Actor : WorldActors)
720 AStaticMeshActor *MeshActor = CastChecked<AStaticMeshActor>(Actor);
721 if (MeshActor->GetStaticMeshComponent()->GetStaticMesh() == NULL)
723 UE_LOG(LogTemp, Error, TEXT(
"The object : %s has no mesh"), *MeshActor->GetFullName());
730 TArray<AActor*> WorldActors;
731 UGameplayStatics::GetAllActorsOfClass(GetWorld(), AStaticMeshActor::StaticClass(), WorldActors);
733 for(
AActor *Actor : WorldActors)
735 AStaticMeshActor *MeshActor = CastChecked<AStaticMeshActor>(Actor);
736 if(MeshActor->GetStaticMeshComponent()->GetStaticMesh() != NULL)
740 if (MeshTag != crp::CityObjectLabel::Roads &&
741 MeshTag != crp::CityObjectLabel::Sidewalks &&
742 MeshTag != crp::CityObjectLabel::RoadLines &&
743 MeshTag != crp::CityObjectLabel::Ground &&
744 MeshTag != crp::CityObjectLabel::Terrain &&
745 MeshActor->GetStaticMeshComponent()->GetGenerateOverlapEvents() ==
false)
747 MeshActor->GetStaticMeshComponent()->SetGenerateOverlapEvents(
true);
756 auto World = GetWorld();
757 check(World !=
nullptr);
766 UKismetSystemLibrary::FlushDebugStrings(World);
767 UKismetSystemLibrary::FlushPersistentDebugLines(World);
772 const auto& Signals =
Map->GetSignals();
773 const auto& Controllers =
Map->GetControllers();
775 for(
const auto& Signal : Signals) {
776 const auto& ODSignal = Signal.second;
777 const FTransform Transform = ODSignal->GetTransform();
778 const FVector Location = Transform.GetLocation();
779 const FQuat Rotation = Transform.GetRotation();
791 TArray<const cre::RoadInfoSignal*> References;
792 auto waypoints =
Map->GenerateWaypointsOnRoadEntries();
793 std::unordered_set<cr::RoadId> ExploredRoads;
794 for (
auto & waypoint : waypoints)
797 if (ExploredRoads.count(waypoint.road_id) > 0)
801 ExploredRoads.insert(waypoint.road_id);
804 auto SignalReferences =
Map->GetLane(waypoint).
806 for (
auto *SignalReference : SignalReferences)
808 References.Add(SignalReference);
811 for (
auto& Reference : References)
813 auto RoadId = Reference->GetRoadId();
814 const auto* SignalReference = Reference;
815 const FTransform SignalTransform = SignalReference->GetSignal()->GetTransform();
816 for(
auto &validity : SignalReference->GetValidities())
823 auto signal_waypoint =
Map->GetWaypoint(
824 RoadId, lane, SignalReference->GetS()).value();
826 if(
Map->GetLane(signal_waypoint).GetType() != cr::Lane::LaneType::Driving)
829 FTransform ReferenceTransform =
Map->ComputeTransform(signal_waypoint);
833 ReferenceTransform.GetLocation(),
842 ReferenceTransform.GetLocation(),
843 SignalTransform.GetLocation(),
855 UWorld* World = GetWorld();
858 TArray<AActor*> FoundActors;
859 UGameplayStatics::GetAllActorsOfClass(World, AActor::StaticClass(), FoundActors);
861 TArray<FBoundingBox> BoundingBoxes;
864 return BoundingBoxes;
870 TArray<AActor*> FoundActors;
871 UGameplayStatics::GetAllActorsOfClass(GetWorld(), AActor::StaticClass(), FoundActors);
877 TSet<uint64> StillLoaded;
880 TSet<const AActor*> LoadedActors;
881 LoadedActors.Reserve(FoundActors.Num());
882 for (
const AActor* Actor : FoundActors)
884 LoadedActors.Add(Actor);
902 const TSet<uint64>& EnvObjectIds,
924 const UWorld* World = GetWorld();
925 UGameplayStatics::FlushLevelStreaming(World);
927 TArray<FName> LevelsToLoad;
930 FLatentActionInfo LatentInfo;
931 LatentInfo.CallbackTarget =
this;
932 LatentInfo.ExecutionFunction =
"OnLoadStreamLevel";
933 LatentInfo.Linkage = 0;
938 for(FName& LevelName : LevelsToLoad)
941 UGameplayStatics::LoadStreamLevel(World, LevelName,
true,
true, LatentInfo);
943 UGameplayStatics::FlushLevelStreaming(World);
950 const UWorld* World = GetWorld();
952 TArray<FName> LevelsToUnLoad;
955 FLatentActionInfo LatentInfo;
956 LatentInfo.CallbackTarget =
this;
957 LatentInfo.ExecutionFunction =
"OnUnloadStreamLevel";
959 LatentInfo.Linkage = 0;
963 for(FName& LevelName : LevelsToUnLoad)
966 UGameplayStatics::UnloadStreamLevel(World, LevelName, LatentInfo,
false);
968 UGameplayStatics::FlushLevelStreaming(World);
975 UWorld* World = GetWorld();
976 const TArray <ULevelStreaming*> Levels = World->GetStreamingLevels();
977 TArray<FString> LayersToLoad;
986 FString LayerName = UTF8_TO_TCHAR(MapLayerToString(
static_cast<crp::MapLayer>(LayerMask)).c_str());
990 LayersToLoad.Emplace(LayerName);
992 LayerMask = (LayerMask << 1) & AllLayersMask;
996 for(ULevelStreaming* Level : Levels)
998 TArray<FString> StringArray;
999 FString FullSubMapName = Level->GetWorldAssetPackageFName().ToString();
1001 FullSubMapName.ParseIntoArray(StringArray, TEXT(
"/"),
false);
1002 FString SubMapName = StringArray[StringArray.Num() - 1];
1003 for(FString LayerName : LayersToLoad)
1005 if(SubMapName.Contains(LayerName))
1007 OutLevelNames.Emplace(FName(*SubMapName));
1017 ULevel* OutLevel =
nullptr;
1018 UWorld* World = GetWorld();
1019 const TArray <ULevelStreaming*> Levels = World->GetStreamingLevels();
1021 for(ULevelStreaming* Level : Levels)
1023 FString FullSubMapName = Level->GetWorldAssetPackageFName().ToString();
1024 if(FullSubMapName.Contains(LevelName))
1026 OutLevel = Level->GetLoadedLevel();
1029 UE_LOG(LogCarla, Warning, TEXT(
"%s has not been loaded"), *LevelName);
1042 if (OutLevel ==
nullptr)
1044 OutLevel = World->PersistentLevel;
static bool IsMapInBlueprintWeatherTable(const AWeather *Weather, const FString &MapName)
Base class for Carla actor factories.
TSubclassOf< AWeather > WeatherClass
The class of Weather to spawn.
void RegisterEnvironmentObjects()
uint64 EnvironmentObjectsRegistrations
void UnLoadMapLayer(int32 MapLayers)
TArray< FTransform > SpawnPointsTransforms
std::optional< carla::road::Map > Map
void EnableEnvironmentObjects(const TSet< uint64 > &EnvObjectIds, bool Enable)
TArray< ACarlaActorFactory * > ActorFactoryInstances
void DebugShowSignals(bool enable)
void BeginPlay() override
UCarlaGameInstance * GameInstance
UCarlaSettingsDelegate * CarlaSettingsDelegate
AActor * FindActorByName(const FString &ActorName)
void LoadMapLayer(int32 MapLayers)
void InitGame(const FString &MapName, const FString &Options, FString &ErrorMessage) override
void CheckForEmptyMeshes()
void ApplyTextureToActor(AActor *Actor, UTexture2D *Texture, const carla::rpc::MaterialParameter &TextureParam)
const FString GetFullMapPath() const
ALargeMapManager * LMManager
void RestartPlayer(AController *NewPlayer) override
FOnEpisodeInitialisedDelegate OnEpisodeInitialisedDelegate
void SpawnActorFactories()
ACarlaRecorder * Recorder
TSet< uint64 > DisabledEnvironmentObjects
void EnableOverlapEvents()
void EndPlay(const EEndPlayReason::Type EndPlayReason) override
ULevel * GetULevelFromName(FString LevelName)
void OnLevelAddedToWorld(ULevel *InLevel, UWorld *InWorld)
Tags actors of World Partition cells as they stream in.
FDelegateHandle OnEpisodeSettingsChangeHandle
const FString GetRelativeMapPath() const
void ConvertMapLayerMaskToMapNames(int32 MapLayer, TArray< FName > &OutLevelNames)
void GenerateSpawnPoints()
int PendingLevelsToUnLoad
UTaggerDelegate * TaggerDelegate
ATrafficLightManager * TrafficLightManager
UObjectRegister * ObjectRegister
void OnEpisodeSettingsChanged(const FEpisodeSettings &Settings)
ATrafficLightManager * GetTrafficLightManager()
TArray< FString > GetNamesOfAllActors()
uint64 EnvironmentObjectsSerial
void Tick(float DeltaSeconds) override
TArray< FBoundingBox > GetAllBBsOfLevel(uint8 TagQueried=0xFF) const
ACarlaGameModeBase(const FObjectInitializer &ObjectInitializer)
TSet< TSubclassOf< ACarlaActorFactory > > ActorFactories
List of actor spawners that will be used to define and spawn the actors available in game.
virtual void LoadGeoReference()
Loads the episode georeference (parsing the map's OpenDRIVE by default) and stores the recommended sp...
void OnUnloadStreamLevel()
bool ReadyToRegisterObjects
UTexture2D * CreateUETexture(const carla::rpc::TextureColor &Texture)
CarlaReplayer * GetReplayer(void)
void SetEpisode(UCarlaEpisode *ThisEpisode)
void RegisterInitialObjects()
void ConsiderSpectatorAsEgo(bool _SpectatorAsEgo)
static const FName FallbackSkyTag
static crp::CityObjectLabel GetTagOfTaggedComponent(const UPrimitiveComponent &Component)
Retrieve the tag of an already tagged component.
static void TagActorsInLevel(UWorld &World, bool bTagForSemanticSegmentation)
Set the tag of every actor in level.
Class In charge of creating and assigning traffic light groups, controllers and components.
void AdoptModelConfigurationFrom(const ATrafficLightManager &Other)
Copy the authored model configuration (traffic light / sign / speed limit blueprints) from another ma...
void ApplyWeather(const FWeatherParameters &WeatherParameters)
Update the weather parameters and notifies it to the blueprint's event.
const FWeatherParameters & GetCurrentWeather() const
Returns the current WeatherParameters.
void CheckPlayAfterMapLoaded(void)
static FOnEpisodeSettingsChange OnEpisodeSettingsChange
static TArray< FBoundingBox > GetBoundingBoxOfActors(const TArray< AActor * > &Actors, uint8 InTagQueried=0xFF)
void RegisterActorFactory(ACarlaActorFactory &ActorFactory)
const FEpisodeSettings & GetSettings() const
void SetRecorder(ACarlaRecorder *Rec)
void InitializeAtBeginPlay()
carla::geom::GeoProjection MapGeoProjection
void NotifyBeginEpisode(UCarlaEpisode &Episode)
FCarlaEngine * GetCarlaEngine()
int32 GetCurrentMapLayer() const
void ApplyQualityLevelPreRestart()
Before loading a level, apply the current settings.
void ApplyQualityLevelPostRestart()
After loading a level, apply the current settings.
void Reset()
Reset settings to default.
void SetAllActorsDrawDistance(UWorld *world, float max_draw_distance) const
void RegisterSpawnHandler(UWorld *World)
Create the event trigger handler for all the newly spawned actors to be processed with a custom funct...
void EnableEnvironmentObjects(const TSet< uint64 > &EnvObjectIds, bool Enable)
void RegisterObjects(TArray< AActor * > Actors)
TSet< uint64 > FindEnvironmentObjectsOf(const TSet< uint64 > &EnvObjectIds, const TSet< const AActor * > &Actors) const
The ids of EnvObjectIds registered now for an actor of Actors.
TSet< uint64 > FindEnvironmentObjects(const TSet< uint64 > &EnvObjectIds) const
The ids of EnvObjectIds that are registered now.
static FString GetXODR(const UWorld *World)
Return the OpenDrive XML associated to MapName, or empty if the file is not found.
void SetSemanticSegmentationEnabled(bool Enable=true)
void RegisterSpawnHandler(UWorld *World)
static bool GetMapDefaultWeather(const FString &MapName, const FWeatherParameters &Base, UPARAM(ref) FWeatherParameters &OutWeather)
static std::vector< int > GenerateRange(int a, int b)
Vector3D GetUpVector() const
static std::optional< road::Map > Load(const std::string &opendrive)
T & At(uint32_t x, uint32_t y)
uint32_t GetWidth() const
uint32_t GetHeight() const
static WeatherParameters Default