You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
#jira UE-184889 #jira UE-184890 #jira UE-185531 #rb none #preflight https://horde.devtools.epicgames.com/job/645b7add6534a4f50496b4e3 #fyi Jason.Walter [CL 25401997 by Dominik Peacock in ue5-main branch]
58 lines
1.9 KiB
C++
58 lines
1.9 KiB
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
#include "VCamBaseActorWithPreset.h"
|
|
|
|
#include "VCamComponent.h"
|
|
#include "BuiltinProviders/VCamPixelStreamingSession.h"
|
|
#include "Interfaces/IPluginManager.h"
|
|
#include "Output/VCamOutputRemoteSession.h"
|
|
|
|
namespace UE::VCamExtensions::Private
|
|
{
|
|
static bool IsPixelStreamingEnabledPlatform()
|
|
{
|
|
// Instead of #if directives look up the .uplugin file once so this code automatically updates when support changes
|
|
static bool bCache = []()
|
|
{
|
|
IPluginManager& PluginManager = IPluginManager::Get();
|
|
if (const TSharedPtr<IPlugin> Plugin = PluginManager.FindPlugin(TEXT("VirtualCameraCore")))
|
|
{
|
|
const FModuleDescriptor* PixelStreamingModule = Plugin->GetDescriptor().Modules.FindByPredicate([](const FModuleDescriptor& Module)
|
|
{
|
|
return Module.Name.IsEqual(TEXT("PixelStreamingVCam"));
|
|
});
|
|
return PixelStreamingModule && PixelStreamingModule->IsLoadedInCurrentConfiguration();
|
|
}
|
|
return false;
|
|
}();
|
|
return bCache;
|
|
}
|
|
}
|
|
|
|
void AVCamBaseActorWithPreset::PostActorCreated()
|
|
{
|
|
Super::PostActorCreated();
|
|
|
|
// Do not do this for actors drag and dropped into the level editor
|
|
if (HasAnyFlags(RF_Transient))
|
|
{
|
|
return;
|
|
}
|
|
|
|
// We expect the child Blueprint to create the output providers
|
|
TArray<UVCamOutputProviderBase*> PixelStreamingSessions;
|
|
TArray<UVCamOutputProviderBase*> RemoteSessions;
|
|
GetVCamComponent()->GetOutputProvidersByClass(UVCamPixelStreamingSession::StaticClass(), PixelStreamingSessions);
|
|
GetVCamComponent()->GetOutputProvidersByClass(UVCamOutputRemoteSession::StaticClass(), RemoteSessions);
|
|
|
|
const bool bEnablePixelStreaming = UE::VCamExtensions::Private::IsPixelStreamingEnabledPlatform();
|
|
for (UVCamOutputProviderBase* PixelStreamer : PixelStreamingSessions)
|
|
{
|
|
PixelStreamer->SetActive(bEnablePixelStreaming);
|
|
}
|
|
for (UVCamOutputProviderBase* RemoteSession : RemoteSessions)
|
|
{
|
|
RemoteSession->SetActive(!bEnablePixelStreaming);
|
|
}
|
|
}
|