CARLA
Loading...
Searching...
No Matches
PostProcessJsonUtils.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 "CoreMinimal.h"
10#include "Engine/PostProcessVolume.h"
11#include "Kismet/BlueprintFunctionLibrary.h"
12#include "Misc/Paths.h"
13#include "PostProcessJsonUtils.generated.h"
14
15USTRUCT(BlueprintType)
17{
18 GENERATED_BODY()
19
20 UPROPERTY(EditAnywhere, BlueprintReadWrite)
21 FPostProcessSettings Settings;
22};
23
24
25class UPostProcessComponent;
27
28UCLASS()
30{
31 GENERATED_BODY()
32
33public:
34 UFUNCTION(BlueprintCallable, Category = "PostProcess|JSON")
35 static bool SaveAllPostProcessToJson(APostProcessVolume* Volume, const FString& FileName);
36
37 UFUNCTION(BlueprintCallable, Category = "PostProcess|JSON")
38 static bool LoadAllPostProcessFromJsonToPostProcessVolume(APostProcessVolume* Volume, const FString& FileName);
39
40 UFUNCTION(BlueprintCallable, Category = "PostProcess|JSON")
41 static bool SaveAllPostProcessComponentToJson(UPostProcessComponent * Volume, const FString& FileName);
42
43 UFUNCTION(BlueprintCallable, Category = "PostProcess|JSON")
44 static bool LoadAllPostProcessFromJsonToPostProcessComponent(UPostProcessComponent * Volume, const FString& FileName);
45
46
47 UFUNCTION(BlueprintCallable, Category = "PostProcess|JSON")
48 static bool LoadAllPostProcessFromJsonToSceneCapture(USceneCaptureComponent2D* SensorCamera, const FString& FileName);
49
50 // Names (without ".json") of every profile currently saved under
51 // Content/Carla/Config/PostProcess/. Backs the "Get Options" dropdown on
52 // APostProcessProfileVolume::ProfileName so artists can pick an existing
53 // profile or type a new one to create it on the next SaveProfile.
54 UFUNCTION(BlueprintCallable, BlueprintPure, Category = "PostProcess|JSON")
55 static TArray<FString> GetAvailablePostProcessProfileNames();
56
57 // The camera profile RGB sensors load when spawned without
58 // post_process_profile (or with the legacy "Default"). Set with
59 // carla.PostProcess.Profile.
60 UFUNCTION(BlueprintCallable, BlueprintPure, Category = "PostProcess|JSON")
61 static FString GetActiveProfileName();
62
63 // The camera profile the sky rig's post process (PIE viewport, spectator,
64 // server window) loads at BeginPlay. Set with carla.PostProcess.ViewportProfile.
65 UFUNCTION(BlueprintCallable, BlueprintPure, Category = "PostProcess|JSON")
66 static FString GetViewportProfileName();
67
68 // Profile name given to a sensor -> file to load. Empty or "Default" (any
69 // case) means the sensor default, GetActiveProfileName().
70 static FString ResolveProfileName(const FString& Requested);
71
72 static FString GetPostProcessConfigPath(const FString& FileName)
73 {
74 return FPaths::ProjectContentDir() / TEXT("Carla/Config/PostProcess/") + FileName + TEXT(".json");
75 }
76};
static FString GetPostProcessConfigPath(const FString &FileName)