CARLA
Loading...
Searching...
No Matches
LoadAssetMaterialsCommandlet.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
12
15#include <carla/geom/Math.h>
16#include <carla/rpc/String.h>
18
19#include <util/ue-header-guard-begin.h>
20#include "Engine/ObjectLibrary.h"
21#include <util/ue-header-guard-end.h>
22
23#include "LoadAssetMaterialsCommandlet.generated.h"
24
25USTRUCT()
26struct CARLA_API FLargeMapTileData
27{
28 GENERATED_USTRUCT_BODY()
29
30 UPROPERTY()
31 float FirstTileCenterX = 0.0F;
32
33 UPROPERTY()
34 float FirstTileCenterY = 0.0F;
35
36 UPROPERTY()
37 float Size = 0.0F;
38};
39
41
42UCLASS()
44 : public UCommandlet
45{
46 GENERATED_BODY()
47
48public:
49
50 /// Default constructor.
52
53#if WITH_EDITORONLY_DATA
54
55 /// Gets the Path of all the Assets contained in the package to cook with name
56 /// @a PackageName
57 FAssetsPaths GetAssetsPathFromPackage(const FString &PackageName) const;
58
59 /// Parses the command line parameters provided through @a InParams
60 FPackageParams ParseParams(const FString& InParams) const;
61
62 void LoadAssetsMaterials(const FString &PackageName, const TArray<FMapData> &MapsPaths);
63
64 void ApplyRoadPainterMaterials(const FString &LoadedMapName, const FString &PackageName, bool IsInTiles = false);
65
66 FDecalsProperties ReadDecalsConfigurationFile(const FString &PackageName);
67
68 /// Main method and entry of the commandlet, taking as input parameters @a
69 /// Params.
70 virtual int32 Main(const FString &Params) override;
71
72#endif // WITH_EDITORONLY_DATA
73
74private:
75
76 /// Loaded assets from any object library
77 UPROPERTY()
78 TArray<FAssetData> AssetDatas;
79
80 UPROPERTY()
81 UWorld *World;
82
83 UPROPERTY()
85
86 /// Used for loading maps in object library. Loaded Data is stored in
87 /// AssetDatas.
88 UPROPERTY()
89 UObjectLibrary *MapObjectLibrary;
90
91 /// Subclass for acquiring the RoadPainter blueprint
92 UPROPERTY()
94
95 /// Dictionary for translating the JSON file "decal_names" array
96 /// to already loaded Material Instances, which are used to apply on the roads
97 UPROPERTY()
98 TMap<FString, FString> DecalNamesMap;
99
100 //UPROPERTY()
101 //TSet<FVector> WaypointsUsedForDecals;
102
103 std::optional<carla::road::Map> XODRMap;
104
105 /// Gets the first .Package.json file found in Unreal Content Directory with
106 /// @a PackageName
107 FString GetFirstPackagePath(const FString &PackageName) const;
108
110
112
114
116};
TArray< FAssetData > AssetDatas
Loaded assets from any object library.
UObjectLibrary * MapObjectLibrary
Used for loading maps in object library.
TMap< FString, FString > DecalNamesMap
Dictionary for translating the JSON file "decal_names" array to already loaded Material Instances,...
FString GetFirstPackagePath(const FString &PackageName) const
Gets the first .Package.json file found in Unreal Content Directory with PackageName.
TSubclassOf< ARoadPainterWrapper > RoadPainterSubclass
Subclass for acquiring the RoadPainter blueprint.
std::optional< carla::road::Map > XODRMap
This file contains definitions of common data structures used in traffic manager.
Struct containing all assets data read from .Package.json file.
Struct containing Package with Name and bOnlyPrepareMaps flag used to separate the cooking of maps an...