Files
UnrealEngineUWP/Engine/Source/Editor/VREditor/VREditorCameraWidgetComponent.cpp
richard graham 46c53b1c0f Updated VREditorWidgetComponent and VREditorCameraWidgetComponent to use materials that ignore pre-exposure so VR menus have same brightness regardless of scene lighting setup.
Added new materials to VREditorAssetContainer to avoid modifying the default materials used for WidgetComponents

#rb zach.brockway, jason.walter#preflight 62d5c4b3d54af4b9a23b6111  #jira UE-157937

[CL 21152798 by richard graham in ue5-main branch]
2022-07-18 17:11:50 -04:00

37 lines
1004 B
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#include "VREditorCameraWidgetComponent.h"
#include "IVREditorModule.h"
#include "VREditorAssetContainer.h"
#include "VREditorMode.h"
UVREditorCameraWidgetComponent::UVREditorCameraWidgetComponent()
: Super()
{
// Override this shader for VR camera viewfinders so that we get color-correct images.
//This shader does an sRGB -> Linear conversion and doesn't apply the "UI Brightness" setting .
if (UNLIKELY(IsRunningDedicatedServer()) || HasAnyFlags(RF_ClassDefaultObject)) // @todo vreditor: early out to avoid loading font assets in the cooker on Linux
{
return;
}
if (!IsRunningCommandlet())
{
if (IVREditorModule::IsAvailable())
{
IVREditorModule& VRModule = IVREditorModule::Get();
if (UVREditorMode* VRMode = VRModule.GetVRMode())
{
const UVREditorAssetContainer& VRAssetContainer = VRMode->GetAssetContainer();
{
OpaqueMaterial_OneSided = VRAssetContainer.CameraWidgetMaterial;
}
}
}
}
}