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