Skip to content
Snippets Groups Projects
Commit 1286801f authored by Philipp Schäfer's avatar Philipp Schäfer
Browse files

VAImageSourceModel: now uses shared ref for parent sound source

VASourceComponent: fixed bug where visibility of image sources was not updated
parent 4ef2f2fb
No related branches found
No related tags found
No related merge requests found
......@@ -14,14 +14,14 @@
// ******* Initialization ******************************************* //
// ****************************************************************** //
FVAImageSourceModel::FVAImageSourceModel(UWorld* World, FVASoundSource* ParentSource, const TArray<AVAReflectionWall*>& ReflectionWalls)
FVAImageSourceModel::FVAImageSourceModel(UWorld* World, TSharedRef<FVASoundSource> ParentSource, const TArray<AVAReflectionWall*>& ReflectionWalls)
: ParentSource(ParentSource)
{
if (!ParentSource)
{
FVAUtils::LogStuff("[FVAImageSourceModel::FVAImageSourceModel()]: Trying to initialize IS model based on invalid sound source (nullptr)", true);
return;
}
//if (!ParentSource)
//{
// FVAUtils::LogStuff("[FVAImageSourceModel::FVAImageSourceModel()]: Trying to initialize IS model based on invalid sound source (nullptr)", true);
// return;
//}
for (auto Wall : ReflectionWalls)
{
std::string WallName(TCHAR_TO_UTF8(*Wall->GetName()));
......
......@@ -20,7 +20,7 @@ public:
// ---Initialization---
FVAImageSourceModel(UWorld* World, FVASoundSource* ParentSource, const TArray<AVAReflectionWall*>& ReflectionWalls);
FVAImageSourceModel(UWorld* World, TSharedRef<FVASoundSource> ParentSource, const TArray<AVAReflectionWall*>& ReflectionWalls);
// ---Setter---
......@@ -62,7 +62,7 @@ private:
AVAReflectionWall* Wall;
};
FVASoundSource* ParentSource;
TSharedRef<FVASoundSource> ParentSource;
TArray<TSharedRef<FVAImageSource>> ImageSources;
};
......@@ -182,7 +182,7 @@ void UVASourceComponent::Initialize()
if (bHandleReflections)
{
TArray<AVAReflectionWall*> ReflWalls = CurrentReceiverActor->GetReflectionWalls();
ImageSourceModel = MakeShared<FVAImageSourceModel>(GetWorld(), SoundSource.Get(), ReflWalls);
ImageSourceModel = MakeShared<FVAImageSourceModel>(GetWorld(), SoundSource.ToSharedRef(), ReflWalls);
}
if (SignalSource)
......@@ -580,6 +580,10 @@ bool UVASourceComponent::SetVisibility(const bool bVis)
}
SoundSource->SetVisibility(bVis);
if (bHandleReflections && ImageSourceModel.IsValid())
{
ImageSourceModel->SetISVisibility(bVis);
}
return true;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment