Skip to content
Snippets Groups Projects
Commit 50403963 authored by David Gilbert's avatar David Gilbert :bug:
Browse files

Replace deprecated GetComponentsByClass function

parent 97513198
No related branches found
No related tags found
1 merge request!10Replace deprecated GetComponentsByClass function
......@@ -95,18 +95,19 @@ void UVAAbstractSourceComponent::UpdateSkeletalMeshIfAttachToBone()
bool bFoundSkelMesh = false;
while (!bFoundSkelMesh && Owner != nullptr)
{
TArray<UActorComponent*> MeshComponents = Owner->GetComponentsByClass(USkeletalMeshComponent::StaticClass());
for (UActorComponent* Component : MeshComponents)
TArray<USkeletalMeshComponent*> MeshComponents;
Owner->GetComponents(MeshComponents);
for (USkeletalMeshComponent* Component : MeshComponents)
{
USkeletalMeshComponent* MeshComp = Cast<USkeletalMeshComponent>(Component);
if (MeshComp && MeshComp->DoesSocketExist(FName(*BoneName)))
if (Component && Component->DoesSocketExist(FName(*BoneName)))
{
//found the right mesh component
SkeletalMeshComponent = MeshComp;
SkeletalMeshComponent = Component;
bFoundSkelMesh = true;
break;
}
}
Owner = Owner->GetAttachParentActor();
}
......@@ -138,7 +139,8 @@ void UVAAbstractSourceComponent::Initialize()
// If no Rec Actor found spawn one with default parameters
if (ReceiverActorTmp == nullptr)
{
FVAUtils::LogStuff("[UVASourceComponent::BeginPlay()]: No AVAReceiver found! Spawning one with default values", false);
FVAUtils::LogStuff(
"[UVASourceComponent::BeginPlay()]: No AVAReceiver found! Spawning one with default values", false);
ReceiverActorTmp = this->GetWorld()->SpawnActor<AVAReceiverActor>(AVAReceiverActor::StaticClass());
}
}
......@@ -151,8 +153,12 @@ void UVAAbstractSourceComponent::Initialize()
{
FVAPlugin::SetUseVA(false);
FVAUtils::OpenMessageBox("There are more than 1 Receiver Actors in the world. Stopping VAPlugin. Make sure to remove the wrong one.", true);
FVAUtils::LogStuff("[UVASourceComponent::BeginPlay()]: More than 1 Receiver found! Stopping VAPlugin. Make sure to remove the wrong one", true);
FVAUtils::OpenMessageBox(
"There are more than 1 Receiver Actors in the world. Stopping VAPlugin. Make sure to remove the wrong one.",
true);
FVAUtils::LogStuff(
"[UVASourceComponent::BeginPlay()]: More than 1 Receiver found! Stopping VAPlugin. Make sure to remove the wrong one",
true);
return;
}
......@@ -169,9 +175,11 @@ void UVAAbstractSourceComponent::Initialize()
SpawnRotation = GetOwner()->GetTransform().GetRotation().Rotator();
const std::string ExplicitRendererID = bRendererExplicit ? std::string( TCHAR_TO_UTF8(*RendererID) ): ""; // Empty ID => general source
const std::string ExplicitRendererID = bRendererExplicit ? std::string(TCHAR_TO_UTF8(*RendererID)) : "";
// Empty ID => general source
const std::string SoundSourceName = std::string(TCHAR_TO_UTF8(*GetName()));
SoundSource = MakeShared<FVASoundSource>(GetWorld(), GetPosition(), GetRotation(), SoundPower, SoundSourceName, ExplicitRendererID);
SoundSource = MakeShared<FVASoundSource>(GetWorld(), GetPosition(), GetRotation(), SoundPower, SoundSourceName,
ExplicitRendererID);
if (UVirtualRealityUtilities::IsMaster())
{
......@@ -234,7 +242,8 @@ bool UVAAbstractSourceComponent::SetSignalSourceID(const std::string& SignalSour
{
if (!SoundSource.IsValid())
{
FVAUtils::OpenMessageBox(FString("[UVASourceComponent::SetSignalSourceID]: VA sound source not initialized"), true);
FVAUtils::OpenMessageBox(FString("[UVASourceComponent::SetSignalSourceID]: VA sound source not initialized"),
true);
return false;
}
if (!SoundSource->SetSignalSource(SignalSourceID))
......@@ -309,7 +318,6 @@ bool UVAAbstractSourceComponent::GetHandleReflections() const
}
// ****************************************************************** //
// ******* Sound Pose *********************************************** //
// ****************************************************************** //
......@@ -451,7 +459,6 @@ bool UVAAbstractSourceComponent::SetOffsetRotation(const FRotator Rot)
}
// ****************************************************************** //
// ******* Directivity stuff **************************************** //
// ****************************************************************** //
......@@ -516,7 +523,6 @@ FString UVAAbstractSourceComponent::GetDirectivityFileName() const
}
// ****************************************************************** //
// ******* Graphical Representation ********************************* //
// ****************************************************************** //
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment