// Copyright Epic Games, Inc. All Rights Reserved. #pragma once #include "HighResScreenshot.h" #include "Slate/SceneViewport.h" #include "Widgets/Input/SCheckBox.h" #include "Widgets/Text/STextBlock.h" class SButton; class SHorizontalBox; class USkeletalMeshComponent; class SCustomizableObjectHighresScreenshot : public SCompoundWidget { public: SLATE_BEGIN_ARGS(SCustomizableObjectHighresScreenshot){} SLATE_END_ARGS() void Construct( const FArguments& InArgs ); SCustomizableObjectHighresScreenshot(); virtual ~SCustomizableObjectHighresScreenshot(); void SetWindow( TSharedPtr InWindow ) { Window = InWindow; } void SetCaptureRegion(const FIntRect& InCaptureRegion) { Config.UnscaledCaptureRegion = InCaptureRegion; TSharedPtr ConfigViewport = Config.TargetViewport.Pin(); if (ConfigViewport.IsValid()) { ConfigViewport->Invalidate(); } } FHighResScreenshotConfig& GetConfig() { return Config; } static TWeakPtr OpenDialog( TSharedPtr& InSceneViewport, TSharedPtr& InLevelViewportClient, USkeletalMeshComponent* SkeletalMeshComponentParameter, TSharedPtr PreviewScenePtr); void SetSkeletalMeshComponent(USkeletalMeshComponent* SkeletalMeshComponentParameter); TSharedPtr PreviewScenePtr; private: FReply OnCaptureClicked(); bool IsSetCameraSafeAreaCaptureRegionEnabled() const; void OnResolutionMultiplierChanged( float NewValue, ETextCommit::Type CommitInfo ) { NewValue = FMath::Clamp(NewValue, FHighResScreenshotConfig::MinResolutionMultipler, FHighResScreenshotConfig::MaxResolutionMultipler); Config.ResolutionMultiplier = NewValue; Config.ResolutionMultiplierScale = (NewValue - FHighResScreenshotConfig::MinResolutionMultipler) / (FHighResScreenshotConfig::MaxResolutionMultipler - FHighResScreenshotConfig::MinResolutionMultipler); } void OnResolutionMultiplierSliderChanged( float NewValue ) { Config.ResolutionMultiplierScale = NewValue; Config.ResolutionMultiplier = FMath::RoundToFloat(FMath::Lerp(FHighResScreenshotConfig::MinResolutionMultipler, FHighResScreenshotConfig::MaxResolutionMultipler, NewValue)); } void OnMaskEnabledChanged(ECheckBoxState NewValue); void OnHDREnabledChanged(ECheckBoxState NewValue) { Config.SetHDRCapture(NewValue == ECheckBoxState::Checked); TSharedPtr ConfigViewport = Config.TargetViewport.Pin(); if (ConfigViewport.IsValid()) { ConfigViewport->Invalidate(); } } void OnShowFloorChanged(ECheckBoxState NewValue); void OnForce128BitRenderingChanged(ECheckBoxState NewValue) { Config.SetForce128BitRendering(NewValue == ECheckBoxState::Checked); TSharedPtr ConfigViewport = Config.TargetViewport.Pin(); if (ConfigViewport.IsValid()) { ConfigViewport->Invalidate(); } } void OnBufferVisualizationDumpEnabledChanged(ECheckBoxState NewValue) { bool bEnabled = (NewValue == ECheckBoxState::Checked); Config.bDumpBufferVisualizationTargets = bEnabled; SetHDRUIEnableState(bEnabled); SetForce128BitRenderingState(bEnabled); } EVisibility GetSpecifyCaptureRegionVisibility() const { return bCaptureRegionControlsVisible ? EVisibility::Hidden : EVisibility::Visible; } EVisibility GetCaptureRegionControlsVisibility() const { return bCaptureRegionControlsVisible ? EVisibility::Visible : EVisibility::Hidden; } void SetCaptureRegionControlsVisibility(bool bVisible) { bCaptureRegionControlsVisible = bVisible; } TOptional GetResolutionMultiplier() const { return TOptional(Config.ResolutionMultiplier); } float GetResolutionMultiplierSlider() const { return Config.ResolutionMultiplierScale; } ECheckBoxState GetMaskEnabled() const { return Config.bMaskEnabled ? ECheckBoxState::Checked : ECheckBoxState::Unchecked; } ECheckBoxState GetHDRCheckboxUIState() const { return Config.bCaptureHDR ? ECheckBoxState::Checked : ECheckBoxState::Unchecked; } ECheckBoxState GetShowFloorState() const; ECheckBoxState GetForce128BitRenderingCheckboxUIState() const { return Config.bForce128BitRendering ? ECheckBoxState::Checked : ECheckBoxState::Unchecked; } ECheckBoxState GetBufferVisualizationDumpEnabled() const { return Config.bDumpBufferVisualizationTargets ? ECheckBoxState::Checked : ECheckBoxState::Unchecked; } void SetHDRUIEnableState(bool bEnable) { HDRCheckBox->SetEnabled(bEnable); HDRLabel->SetEnabled(bEnable); } void SetForce128BitRenderingState(bool bEnable) { Force128BitRenderingCheckBox->SetEnabled(bEnable); Force128BitRenderingLabel->SetEnabled(bEnable); } void RestoreViewportValues(); static void WindowClosedHandler(const TSharedRef& InWindow); TSharedPtr Window; TSharedPtr CaptureRegionButton; TSharedPtr RegionCaptureActiveControlRoot; TSharedPtr HDRCheckBox; TSharedPtr HDRLabel; TSharedPtr Force128BitRenderingCheckBox; TSharedPtr Force128BitRenderingLabel; TSharedPtr ShowFloor; FHighResScreenshotConfig& Config; bool bCaptureRegionControlsVisible; static TWeakPtr CurrentWindow; static TWeakPtr CurrentDialog; static bool bMaskVisualizationWasEnabled; TWeakPtr LevelViewportClient; int32 ExposureLogOffsetCached; bool ExposureLogFixedCached; bool FloorVisibilityCached; bool GridVisibilityCached; USkeletalMeshComponent* SkeletalMeshComponent; };