diff --git a/LibCarla/source/carla/rpc/ActorAttributeType.h b/LibCarla/source/carla/rpc/ActorAttributeType.h index dda52939f..9ecf822b6 100644 --- a/LibCarla/source/carla/rpc/ActorAttributeType.h +++ b/LibCarla/source/carla/rpc/ActorAttributeType.h @@ -12,11 +12,11 @@ namespace carla { namespace rpc { enum class ActorAttributeType : uint8_t { - Bool, - Int, - Float, - String, - RGBColor, + Bool = 1u, + Int = 2u, + Float = 3u, + String = 4u, + RGBColor = 5u, SIZE, INVALID diff --git a/PythonAPI/carla/source/libcarla/Blueprint.cpp b/PythonAPI/carla/source/libcarla/Blueprint.cpp index e711290e4..9f3c04664 100644 --- a/PythonAPI/carla/source/libcarla/Blueprint.cpp +++ b/PythonAPI/carla/source/libcarla/Blueprint.cpp @@ -37,7 +37,7 @@ namespace client { std::ostream &operator<<(std::ostream &out, const ActorAttribute &attr) { using Type = carla::rpc::ActorAttributeType; - static_assert(static_cast(Type::SIZE) == 5u, "Please update this function."); + static_assert(static_cast(Type::SIZE) == 6u, "Please update this function."); out << "ActorAttribute(id=" << attr.GetId(); switch (attr.GetType()) { case Type::Bool: diff --git a/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Actor/ActorBlueprintFunctionLibrary.cpp b/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Actor/ActorBlueprintFunctionLibrary.cpp index 2de3050a2..823859d4d 100644 --- a/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Actor/ActorBlueprintFunctionLibrary.cpp +++ b/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Actor/ActorBlueprintFunctionLibrary.cpp @@ -1593,6 +1593,12 @@ void UActorBlueprintFunctionLibrary::MakePedestrianDefinition( EActorAttributeType::String, GetAge(Parameters.Age)}); + + Definition.Attributes.Emplace(FActorAttribute{ + TEXT("can_use_wheel_chair"), + EActorAttributeType::Bool, + Parameters.bCanUseWheelChair ? TEXT("true") : TEXT("false") }); + if (Parameters.Speed.Num() > 0) { FActorVariation Speed; @@ -1606,6 +1612,8 @@ void UActorBlueprintFunctionLibrary::MakePedestrianDefinition( Definition.Variations.Emplace(Speed); } + bool bCanUseWheelChair = Parameters.bCanUseWheelChair; + FActorVariation IsInvincible; IsInvincible.Id = TEXT("is_invincible"); IsInvincible.Type = EActorAttributeType::Bool; @@ -1613,6 +1621,20 @@ void UActorBlueprintFunctionLibrary::MakePedestrianDefinition( IsInvincible.bRestrictToRecommended = false; Definition.Variations.Emplace(IsInvincible); + FActorVariation WheelChairVariation; + WheelChairVariation.Id = TEXT("use_wheelchair"); + WheelChairVariation.Type = EActorAttributeType::Bool; + if(bCanUseWheelChair) + { + WheelChairVariation.RecommendedValues = { TEXT("true"), TEXT("false") }; + } + else + { + WheelChairVariation.RecommendedValues = { TEXT("false") }; + } + WheelChairVariation.bRestrictToRecommended = true; + Definition.Variations.Emplace(WheelChairVariation); + Success = CheckActorDefinition(Definition); } diff --git a/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Actor/PedestrianParameters.h b/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Actor/PedestrianParameters.h index 86310a6d9..7572e9b3a 100644 --- a/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Actor/PedestrianParameters.h +++ b/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Actor/PedestrianParameters.h @@ -55,4 +55,7 @@ struct CARLA_API FPedestrianParameters UPROPERTY(EditAnywhere, BlueprintReadWrite) int32 Generation = 0; + + UPROPERTY(EditAnywhere, BlueprintReadWrite) + bool bCanUseWheelChair = false; }; diff --git a/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Walker/WalkerBase.h b/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Walker/WalkerBase.h index 676569ed4..5990bceeb 100644 --- a/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Walker/WalkerBase.h +++ b/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Walker/WalkerBase.h @@ -24,6 +24,9 @@ public: UPROPERTY(Category="Walker Base", BlueprintReadWrite, EditAnywhere) float AfterLifeSpan = 10.0f; + UPROPERTY(Category="Walker Base", BlueprintReadWrite, EditAnywhere) + bool bUsesWheelChair = false; + UFUNCTION(BlueprintCallable) void StartDeathLifeSpan() {