Make OpenDrive static functions available in blueprints
This commit is contained in:
parent
8febd66739
commit
f026ead7f2
|
@ -136,7 +136,7 @@ void AOpenDriveActor::BuildRoutes(FString MapName)
|
|||
|
||||
// As the OpenDrive file has the same name as level, build the path to the
|
||||
// xodr file using the lavel name and the game content directory.
|
||||
const FString XodrContent = FOpenDrive::Load(MapName);
|
||||
const FString XodrContent = UOpenDrive::LoadXODR(MapName);
|
||||
|
||||
auto map = carla::opendrive::OpenDriveParser::Load(carla::rpc::FromFString(XodrContent));
|
||||
|
||||
|
|
|
@ -195,7 +195,7 @@ void FCarlaServer::FPimpl::BindActions()
|
|||
BIND_SYNC(get_map_info) << [this]() -> R<cr::MapInfo>
|
||||
{
|
||||
REQUIRE_CARLA_EPISODE();
|
||||
auto FileContents = FOpenDrive::Load(Episode->GetMapName());
|
||||
auto FileContents = UOpenDrive::LoadXODR(Episode->GetMapName());
|
||||
const auto &SpawnPoints = Episode->GetRecommendedSpawnPoints();
|
||||
return cr::MapInfo{
|
||||
cr::FromFString(Episode->GetMapName()),
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
#include "Runtime/Core/Public/HAL/FileManagerGeneric.h"
|
||||
|
||||
static FString FOpenDrive_FindPathToXODRFile(const FString &InMapName)
|
||||
FString UOpenDrive::FindPathToXODRFile(const FString &InMapName)
|
||||
{
|
||||
FString MapName = InMapName;
|
||||
#if WITH_EDITOR
|
||||
|
@ -50,9 +50,9 @@ static FString FOpenDrive_FindPathToXODRFile(const FString &InMapName)
|
|||
return FilesFound.Num() > 0 ? FilesFound[0u] : FString{};
|
||||
}
|
||||
|
||||
FString FOpenDrive::Load(const FString &MapName)
|
||||
FString UOpenDrive::LoadXODR(const FString &MapName)
|
||||
{
|
||||
const auto FilePath = FOpenDrive_FindPathToXODRFile(MapName);
|
||||
const auto FilePath = FindPathToXODRFile(MapName);
|
||||
|
||||
FString Content;
|
||||
|
||||
|
|
|
@ -6,11 +6,21 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
class FOpenDrive
|
||||
#include "Kismet/BlueprintFunctionLibrary.h"
|
||||
|
||||
#include "OpenDrive.generated.h"
|
||||
|
||||
UCLASS()
|
||||
class CARLA_API UOpenDrive : public UBlueprintFunctionLibrary
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
|
||||
static FString FindPathToXODRFile(const FString &MapName);
|
||||
|
||||
/// Return the OpenDrive XML associated to @a MapName, or empty if the file
|
||||
/// is not found.
|
||||
static FString Load(const FString &MapName);
|
||||
UFUNCTION(BlueprintCallable, Category="CARLA|OpenDrive")
|
||||
static FString LoadXODR(const FString &MapName);
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue