CARLA
ActorSpawnResult.h
Go to the documentation of this file.
1 // Copyright (c) 2017 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 "ActorSpawnResult.generated.h"
10 
11 /// List of valid types for actor attributes.
12 UENUM(BlueprintType)
13 enum class EActorSpawnResultStatus : uint8
14 {
15  Success UMETA(DisplayName = "Success"),
16  InvalidDescription UMETA(DisplayName = "Invalid actor description"),
17  Collision UMETA(DisplayName = "Failed because collision at spawn position"),
18  UnknownError UMETA(DisplayName = "Unknown Error"),
19 
20  SIZE UMETA(Hidden)
21 };
22 
23 /// Result of an actor spawn function.
24 USTRUCT(BlueprintType)
26 {
27  GENERATED_BODY()
28 
29  FActorSpawnResult() = default;
30 
31  explicit FActorSpawnResult(AActor *InActor)
32  : Actor(InActor),
33  Status(Actor != nullptr ?
35  EActorSpawnResultStatus::UnknownError) {}
36 
37  static FString StatusToString(EActorSpawnResultStatus Status);
38 
39  bool IsValid() const
40  {
41  return (Actor != nullptr) && (Status == EActorSpawnResultStatus::Success);
42  }
43 
44  UPROPERTY(EditAnywhere, BlueprintReadWrite)
45  AActor *Actor = nullptr;
46 
47  UPROPERTY(EditAnywhere, BlueprintReadWrite)
49 };
static const FString SIZE
EActorSpawnResultStatus
List of valid types for actor attributes.
carla::SharedPtr< cc::Actor > Actor
bool IsValid() const
FActorSpawnResult(AActor *InActor)
Result of an actor spawn function.