Skip to content

Commit

Permalink
Merge branch 'reichardtj-hotfix/segment-more-than-static-meshes'
Browse files Browse the repository at this point in the history
  • Loading branch information
sytelus committed Mar 29, 2018
2 parents 4526689 + ea946e9 commit d5008af
Showing 1 changed file with 30 additions and 1 deletion.
31 changes: 30 additions & 1 deletion Unreal/Plugins/AirSim/Source/AirBlueprintLib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,27 @@ std::string UAirBlueprintLib::GetMeshName(T* mesh)
}
}

template<>
std::string UAirBlueprintLib::GetMeshName<USkinnedMeshComponent>(USkinnedMeshComponent* mesh)
{
switch(mesh_naming_method)
{
case msr::airlib::AirSimSettings::SegmentationSettings::MeshNamingMethodType::OwnerName:
if (mesh->GetOwner())
return std::string(TCHAR_TO_UTF8(*(mesh->GetOwner()->GetName())));
else
return ""; // std::string(TCHAR_TO_UTF8(*(UKismetSystemLibrary::GetDisplayName(mesh))));
case msr::airlib::AirSimSettings::SegmentationSettings::MeshNamingMethodType::StaticMeshName:
if (mesh->SkeletalMesh)
return std::string(TCHAR_TO_UTF8(*(mesh->SkeletalMesh->GetName())));
else
return "";
default:
return "";
}
}


std::string UAirBlueprintLib::GetMeshName(ALandscapeProxy* mesh)
{
return std::string(TCHAR_TO_UTF8(*(mesh->GetName())));
Expand All @@ -341,6 +362,10 @@ void UAirBlueprintLib::InitializeMeshStencilIDs(bool ignore_existing)
{
InitializeObjectStencilID(*comp, ignore_existing);
}
for (TObjectIterator<USkinnedMeshComponent> comp; comp; ++comp)
{
InitializeObjectStencilID(*comp, ignore_existing);
}
//for (TObjectIterator<UFoliageType> comp; comp; ++comp)
//{
// InitializeObjectStencilID(*comp);
Expand Down Expand Up @@ -378,6 +403,10 @@ bool UAirBlueprintLib::SetMeshStencilID(const std::string& mesh_name, int object
{
SetObjectStencilIDIfMatch(*comp, object_id, mesh_name, is_name_regex, name_regex, changes);
}
for (TObjectIterator<USkinnedMeshComponent> comp; comp; ++comp)
{
SetObjectStencilIDIfMatch(*comp, object_id, mesh_name, is_name_regex, name_regex, changes);
}
for (TObjectIterator<ALandscapeProxy> comp; comp; ++comp)
{
SetObjectStencilIDIfMatch(*comp, object_id, mesh_name, is_name_regex, name_regex, changes);
Expand Down Expand Up @@ -552,4 +581,4 @@ float UAirBlueprintLib::GetDisplayGamma()
void UAirBlueprintLib::EnableInput(AActor* actor)
{
actor->EnableInput(actor->GetWorld()->GetFirstPlayerController());
}
}

0 comments on commit d5008af

Please sign in to comment.