bPreviewSelectedCameras

bPreviewSelectedCameras

#Overview

name: bPreviewSelectedCameras

The value of this variable can be defined or overridden in .ini config files. 1 .ini config file referencing this setting variable.

It is referenced in 3 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of bPreviewSelectedCameras is to enable a live ‘picture in picture’ preview of selected camera actors within the current editor viewport. This setting is part of the Level Editor’s viewport functionality and is used to enhance the camera positioning and configuration workflow.

This setting variable is primarily used by the Level Editor subsystem, specifically within the viewport components. It’s referenced in the SLevelViewport class, which is responsible for rendering and managing the Level Editor’s viewport.

The value of this variable is set in the ULevelEditorViewportSettings class, which is a configuration class for Level Editor viewport settings. It’s defined as a UPROPERTY with the EditAnywhere and config specifiers, allowing it to be edited in the editor’s project settings and saved to configuration files.

This variable interacts with other variables and systems:

  1. It’s used in conjunction with GCurrentLevelEditingViewportClient to determine if the current viewport should display camera previews.
  2. It’s related to the CameraPreviewSize variable, which affects the size of the ‘picture in picture’ previews.
  3. It’s used alongside IVREditorModule to determine if previews should be shown in desktop viewports.

Developers should be aware of the following when using this variable:

  1. Enabling this feature may reduce application performance, as stated in the comment.
  2. It only affects the currently active viewport client.
  3. It’s designed to work with camera actors specifically.

Best practices when using this variable include:

  1. Use it judiciously, as it can impact performance.
  2. Combine it with appropriate camera preview sizing (CameraPreviewSize) for optimal visibility.
  3. Be aware of its interaction with VR editor mode, as it behaves differently in desktop vs. VR viewports.
  4. Consider disabling it when not actively working with camera positioning to maintain performance.
  5. Utilize this feature to fine-tune camera settings without needing to possess the camera, improving workflow efficiency.

#Setting Variables

#References In INI files

Location: <Workspace>/Engine/Config/BaseEditorPerProjectUserSettings.ini:454, section: [/Script/UnrealEd.LevelEditorViewportSettings]

#References in C++ code

#Callsites

This variable is referenced in the following C++ source code:

#Loc: <Workspace>/Engine/Source/Editor/LevelEditor/Private/SLevelViewport.cpp:1230

Scope (from outer to inner):

file
function     void SLevelViewport::Tick

Source code excerpt:

	{
		const bool bPreviewInDesktopViewport = !IVREditorModule::Get().IsVREditorModeActive();
		if (GetDefault<ULevelEditorViewportSettings>()->bPreviewSelectedCameras && GCurrentLevelEditingViewportClient == LevelViewportClient.Get())
		{
			PreviewSelectedCameraActors(bPreviewInDesktopViewport);
		}
		else
		{
			// We're no longer the active viewport client, so remove any existing previewed actors

#Loc: <Workspace>/Engine/Source/Editor/LevelEditor/Private/SLevelViewport.cpp:3882

Scope (from outer to inner):

file
function     void SLevelViewport::OnPreviewSelectedCamerasChange

Source code excerpt:

	const bool bPreviewInDesktopViewport = !IVREditorModule::Get().IsVREditorModeActive();
	// Check to see if previewing selected cameras is enabled and if we're the active level viewport client.
	if (GetDefault<ULevelEditorViewportSettings>()->bPreviewSelectedCameras && GCurrentLevelEditingViewportClient == LevelViewportClient.Get())
	{
		PreviewSelectedCameraActors(bPreviewInDesktopViewport);
	}
	else
	{
		// We're either not the active viewport client or preview selected cameras option is disabled, so remove any existing previewed actors

#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Classes/Settings/LevelEditorViewportSettings.h:537

Scope (from outer to inner):

file
class        class ULevelEditorViewportSettings : public UObject

Source code excerpt:

	/** When enabled, selecting a camera actor will display a live 'picture in picture' preview from the camera's perspective within the current editor view port.  This can be used to easily tweak camera positioning, post-processing and other settings without having to possess the camera itself.  This feature may reduce application performance when enabled. */
	UPROPERTY(EditAnywhere, config, Category=LookAndFeel)
	uint32 bPreviewSelectedCameras:1;

	/** Affects the size of 'picture in picture' previews if they are enabled */
	UPROPERTY(EditAnywhere, config, Category=LookAndFeel, meta=(ClampMin = "1", UIMin = "1", UIMax = "10"))
	float CameraPreviewSize;

	/** Distance from the camera to place actors which are dropped on nothing in the view port. */