Added exception to register crosswalks

This commit is contained in:
doterop 2021-01-11 17:48:19 +01:00 committed by bernat
parent 78e7ea1130
commit 668d7fd496
1 changed files with 12 additions and 7 deletions

View File

@ -319,7 +319,7 @@ void UBoundingBoxCalculator::GetISMBoundingBox(
const UStaticMesh *Mesh = ISMComp->GetStaticMesh();
const FBoundingBox SMBoundingBox = GetStaticMeshBoundingBox(Mesh);
if(SMBoundingBox.Extent.IsZero())
if(!Mesh)
{
UE_LOG(LogCarla, Error, TEXT("%s has no SM assigned to the ISM"), *ISMComp->GetOwner()->GetName());
return;
@ -351,8 +351,13 @@ void UBoundingBoxCalculator::GetBBsOfStaticMeshComponents(
for(UStaticMeshComponent* Comp : StaticMeshComps)
{
bool isCrosswalk = Comp->GetOwner()->GetName().Contains("crosswalk");
// Avoid duplication with SMComp and not visible meshes
if(!Comp->IsVisible() || Cast<UInstancedStaticMeshComponent>(Comp)) continue;
if( (!Comp->IsVisible() && !isCrosswalk) || Cast<UInstancedStaticMeshComponent>(Comp))
{
continue;
}
// Filter by tag
crp::CityObjectLabel Tag = ATagger::GetTagOfTaggedComponent(*Comp);
@ -361,11 +366,7 @@ void UBoundingBoxCalculator::GetBBsOfStaticMeshComponents(
UStaticMesh* StaticMesh = Comp->GetStaticMesh();
FBoundingBox BoundingBox = GetStaticMeshBoundingBox(StaticMesh);
if(BoundingBox.Extent.IsZero())
{
// UE_LOG(LogCarla, Error, TEXT("%s has no SM assigned"), *Comp->GetOwner()->GetName());
}
else
if(StaticMesh)
{
// Component-to-world transform for this component
const FTransform& CompToWorldTransform = Comp->GetComponentTransform();
@ -373,6 +374,10 @@ void UBoundingBoxCalculator::GetBBsOfStaticMeshComponents(
OutBB.Emplace(BoundingBox);
OutTag.Emplace(static_cast<uint8>(Tag));
}
else
{
// UE_LOG(LogCarla, Error, TEXT("%s has no SM assigned"), *Comp->GetOwner()->GetName());
}
}
}