Added Any as a filter option instead of None

This commit is contained in:
doterop 2020-11-19 10:51:47 +01:00 committed by bernat
parent 32851266ff
commit c98eb974c6
8 changed files with 24 additions and 22 deletions

View File

@ -37,6 +37,7 @@ namespace rpc {
Dynamic = 20u,
Water = 21u,
Terrain = 22u,
Any = 0xFF
};
} // namespace rpc

View File

@ -181,7 +181,7 @@ void export_world() {
;
enum_<cr::CityObjectLabel>("CityObjectLabel")
.value("Any", cr::CityObjectLabel::None)
.value("NONE", cr::CityObjectLabel::None)
.value("Buildings", cr::CityObjectLabel::Buildings)
.value("Fences", cr::CityObjectLabel::Fences)
.value("Other", cr::CityObjectLabel::Other)
@ -204,6 +204,7 @@ void export_world() {
.value("Dynamic", cr::CityObjectLabel::Dynamic)
.value("Water", cr::CityObjectLabel::Water)
.value("Terrain", cr::CityObjectLabel::Terrain)
.value("Any", cr::CityObjectLabel::Any)
;
class_<cr::LabelledPoint>("LabelledPoint", no_init)
@ -270,8 +271,8 @@ void export_world() {
.def("reset_all_traffic_lights", &cc::World::ResetAllTrafficLights)
.def("get_lightmanager", CONST_CALL_WITHOUT_GIL(cc::World, GetLightManager))
.def("freeze_all_traffic_lights", &cc::World::FreezeAllTrafficLights, (arg("frozen")))
.def("get_level_bbs", &GetLevelBBs, (arg("bb_type")=cr::CityObjectLabel::None))
.def("get_environment_objects", &GetEnvironmentObjects, (arg("object_type")=cr::CityObjectLabel::None))
.def("get_level_bbs", &GetLevelBBs, (arg("bb_type")=cr::CityObjectLabel::Any))
.def("get_environment_objects", &GetEnvironmentObjects, (arg("object_type")=cr::CityObjectLabel::Any))
.def("enable_environment_objects", &EnableEnvironmentObjects, (arg("env_objects_ids"), arg("enable")))
.def("cast_ray", CALL_RETURNING_LIST_2(cc::World, CastRay, cg::Location, cg::Location), (arg("initial_location"), arg("final_location")))
.def("project_point", CALL_RETURNING_OPTIONAL_3(cc::World, ProjectPoint, cg::Location, cg::Vector3D, float), (arg("location"), arg("direction"), arg("search_distance")=10000.f))

View File

@ -349,7 +349,7 @@ void ACarlaGameModeBase::DebugShowSignals(bool enable)
}
TArray<FBoundingBox> ACarlaGameModeBase::GetAllBBsOfLevel(uint8 TagQueried)
TArray<FBoundingBox> ACarlaGameModeBase::GetAllBBsOfLevel(uint8 TagQueried) const
{
UWorld* World = GetWorld();

View File

@ -54,10 +54,10 @@ public:
ATrafficLightManager* GetTrafficLightManager();
UFUNCTION(Category = "Carla Game Mode", BlueprintCallable, CallInEditor, Exec)
TArray<FBoundingBox> GetAllBBsOfLevel(uint8 TagQueried = 0);
TArray<FBoundingBox> GetAllBBsOfLevel(uint8 TagQueried = 0xFF) const;
UFUNCTION(Category = "Carla Game Mode", BlueprintCallable, CallInEditor, Exec)
TArray<FEnvironmentObject> GetEnvironmentObjects(uint8 QueriedTag = 0) const
TArray<FEnvironmentObject> GetEnvironmentObjects(uint8 QueriedTag = 0xFF) const
{
return ObjectRegister->GetEnvironmentObjects(QueriedTag);
}

View File

@ -99,7 +99,7 @@ FBoundingBox UBoundingBoxCalculator::GetVehicleBoundingBox(
check(Vehicle);
crp::CityObjectLabel TagQueried = (crp::CityObjectLabel)InTagQueried;
bool FilterByTagEnabled = (TagQueried != crp::CityObjectLabel::None);
bool FilterByTagEnabled = (TagQueried != crp::CityObjectLabel::Any);
UActorComponent *ActorComp = Vehicle->GetComponentByClass(USkeletalMeshComponent::StaticClass());
USkeletalMeshComponent* ParentComp = Cast<USkeletalMeshComponent>(ActorComp);
@ -187,7 +187,7 @@ FBoundingBox UBoundingBoxCalculator::GetCharacterBoundingBox(
check(Character);
crp::CityObjectLabel TagQueried = (crp::CityObjectLabel)InTagQueried;
bool FilterByTag = TagQueried == crp::CityObjectLabel::None ||
bool FilterByTag = TagQueried == crp::CityObjectLabel::Any ||
TagQueried == crp::CityObjectLabel::Pedestrians;
UCapsuleComponent* Capsule = Character->GetCapsuleComponent();
@ -232,7 +232,7 @@ void UBoundingBoxCalculator::GetTrafficLightBoundingBox(
CombineBBsOfActor(TrafficLight, BBsOfTL, TagsOfTL, DistanceThreshold, TLTag);
check(BBsOfTL.Num() == TagsOfTL.Num());
bool FilterByTagEnabled = (InTagQueried != static_cast<uint8>(crp::CityObjectLabel::None));
bool FilterByTagEnabled = (InTagQueried != static_cast<uint8>(crp::CityObjectLabel::Any));
for(int i = 0; i < BBsOfTL.Num(); i++)
{
@ -346,7 +346,7 @@ void UBoundingBoxCalculator::GetBBsOfStaticMeshComponents(
uint8 InTagQueried)
{
crp::CityObjectLabel TagQueried = (crp::CityObjectLabel)InTagQueried;
bool FilterByTagEnabled = (TagQueried != crp::CityObjectLabel::None);
bool FilterByTagEnabled = (TagQueried != crp::CityObjectLabel::Any);
for(UStaticMeshComponent* Comp : StaticMeshComps)
{
@ -383,7 +383,7 @@ void UBoundingBoxCalculator::GetBBsOfSkeletalMeshComponents(
uint8 InTagQueried)
{
crp::CityObjectLabel TagQueried = (crp::CityObjectLabel)InTagQueried;
bool FilterByTagEnabled = (TagQueried != crp::CityObjectLabel::None);
bool FilterByTagEnabled = (TagQueried != crp::CityObjectLabel::Any);
for(USkeletalMeshComponent* Comp : SkeletalMeshComps)
{
@ -430,7 +430,7 @@ TArray<FBoundingBox> UBoundingBoxCalculator::GetBBsOfActor(
TArray<FBoundingBox> Result;
TArray<uint8> Tags;
crp::CityObjectLabel TagQueried = (crp::CityObjectLabel)InTagQueried;
bool FilterByTagEnabled = (TagQueried != crp::CityObjectLabel::None);
bool FilterByTagEnabled = (TagQueried != crp::CityObjectLabel::Any);
FString ClassName = Actor->GetClass()->GetName();

View File

@ -30,24 +30,24 @@ public:
UFUNCTION(Category = "Carla Actor", BlueprintCallable)
static FBoundingBox GetActorBoundingBox(
const AActor *Actor,
uint8 InTagQueried = 0);
uint8 InTagQueried = 0xFF);
UFUNCTION(Category = "Carla Actor", BlueprintCallable)
static FBoundingBox GetVehicleBoundingBox(
const ACarlaWheeledVehicle* Vehicle,
uint8 InTagQueried = 0);
uint8 InTagQueried = 0xFF);
UFUNCTION(Category = "Carla Actor", BlueprintCallable)
static FBoundingBox GetCharacterBoundingBox(
const ACharacter* Character,
uint8 InTagQueried = 0);
uint8 InTagQueried = 0xFF);
UFUNCTION(Category = "Carla Actor", BlueprintCallable)
static void GetTrafficLightBoundingBox(
const ATrafficLightBase* TrafficLight,
TArray<FBoundingBox>& OutBB,
TArray<uint8>& OutTag,
uint8 InTagQueried = 0);
uint8 InTagQueried = 0xFF);
UFUNCTION(Category = "Carla Util", BlueprintCallable)
static FBoundingBox GetSkeletalMeshBoundingBox(const USkeletalMesh* SkeletalMesh);
@ -65,7 +65,7 @@ public:
const TArray<UStaticMeshComponent*>& StaticMeshComps,
TArray<FBoundingBox>& OutBB,
TArray<uint8>& OutTag,
uint8 InTagQueried = 0);
uint8 InTagQueried = 0xFF);
UFUNCTION(Category = "Carla Util", BlueprintCallable)
static void GetBBsOfSkeletalMeshComponents(
@ -77,12 +77,12 @@ public:
UFUNCTION(Category = "Carla Util", BlueprintCallable)
static TArray<FBoundingBox> GetBoundingBoxOfActors(
const TArray<AActor*>& Actors,
uint8 InTagQueried = 0);
uint8 InTagQueried = 0xFF);
UFUNCTION(Category = "Carla Util", BlueprintCallable)
static TArray<FBoundingBox> GetBBsOfActor(
const AActor* Actor,
uint8 InTagQueried = 0);
uint8 InTagQueried = 0xFF);
// Combines the BBs of an actor based on the distance and type of the BB
// The BBs not combined are included too (ie: TL BBs and pole)
@ -94,7 +94,7 @@ public:
TArray<FBoundingBox>& OutBB,
TArray<uint8>& OutTag,
const float DistanceThreshold = 0.0f,
uint8 TagToCombine = 0);
uint8 TagToCombine = 0xFF);
UFUNCTION(Category = "Carla Util", BlueprintCallable)
static FBoundingBox CombineBBs(const TArray<FBoundingBox>& BBsToCombine);

View File

@ -21,7 +21,7 @@ TArray<FEnvironmentObject> UObjectRegister::GetEnvironmentObjects(uint8 InTagQue
TArray<FEnvironmentObject> Result;
crp::CityObjectLabel TagQueried = (crp::CityObjectLabel)InTagQueried;
bool FilterByTagEnabled = (TagQueried != crp::CityObjectLabel::None);
bool FilterByTagEnabled = (TagQueried != crp::CityObjectLabel::Any);
for(const FEnvironmentObject& It : EnvironmentObjects)
{

View File

@ -26,7 +26,7 @@ public:
~UObjectRegister() {}
UFUNCTION(Category = "Carla Object Register", BlueprintCallable, CallInEditor)
TArray<FEnvironmentObject> GetEnvironmentObjects(uint8 InTagQueried = 0) const;
TArray<FEnvironmentObject> GetEnvironmentObjects(uint8 InTagQueried = 0xFF) const;
UFUNCTION(Category = "Carla Object Register")
void RegisterObjects(TArray<AActor*> Actors);