MinViewRange

MinViewRange

#Overview

name: MinViewRange

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 10 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of MinViewRange is to set a minimum threshold for the viewable range in various curve editing tools within Unreal Engine 5. It is primarily used in the context of curve editors and ease curve tools to ensure that the view doesn’t zoom in too close, maintaining a minimum level of context for the user.

This setting variable is mainly utilized by the following Unreal Engine subsystems and modules:

  1. Avalanche Sequencer Plugin (Experimental)
  2. Distribution Curve Editor
  3. Curve Editor Options

The value of this variable is typically set in the UCurveEdOptions class, which is part of the engine’s preferences system. It’s defined as an UPROPERTY, making it configurable through the engine’s configuration files or the editor interface.

MinViewRange often interacts with other variables such as:

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

  1. It affects the zoom level in curve editors, preventing users from zooming in too close.
  2. It’s used in “fit to view” operations to ensure a minimum visible area.
  3. Changing this value will affect the behavior of curve editing tools across the engine.

Best practices when using this variable include:

  1. Ensure it’s set to a value that provides enough context for users working with curves.
  2. Consider the types of curves your project typically uses when setting this value.
  3. Balance it with MaxViewRange to provide a good range of zoom levels.
  4. If modifying, test thoroughly in all curve editing contexts to ensure it doesn’t negatively impact usability.
  5. Consider exposing this as a user preference if your project heavily relies on curve editing.

#Setting Variables

#References In INI files

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

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Plugins/Experimental/Avalanche/Source/AvalancheSequencer/Private/EaseCurveTool/Widgets/SAvaEaseCurveEditor.cpp:44

Scope (from outer to inner):

file
namespace    UE::EaseCurveTool::Private

Source code excerpt:


	static constexpr float FitMargin = 0.1f;
	static constexpr float MinViewRange = 0.5f;
	static constexpr float HalfMinViewRange = MinViewRange * 0.5f;

	static constexpr float NormalBoundsThickness = 1.f;
	static constexpr float TangentHandleLineThickness = 2.f;
}

using namespace UE::EaseCurveTool::Private;

#Loc: <Workspace>/Engine/Plugins/Experimental/Avalanche/Source/AvalancheSequencer/Private/EaseCurveTool/Widgets/SAvaEaseCurveEditor.cpp:1036

Scope (from outer to inner):

file
function     void SAvaEaseCurveEditor::ZoomToFit

Source code excerpt:

		// Clamp the minimum size
		float SizeX = InMaxX - InMinX;
		if (SizeX < MinViewRange)
		{
			InMinX -= HalfMinViewRange;
			InMaxX += HalfMinViewRange;
			SizeX = InMaxX - InMinX;
		}

#Loc: <Workspace>/Engine/Plugins/Experimental/Avalanche/Source/AvalancheSequencer/Private/EaseCurveTool/Widgets/SAvaEaseCurveEditor.cpp:1077

Scope (from outer to inner):

file
function     void SAvaEaseCurveEditor::ZoomToFit

Source code excerpt:

		// Clamp the minimum size
		float SizeY = InMaxY - InMinY;
		if (SizeY < MinViewRange)
		{
			SetDefaultOutput(MinViewRange);

			InMinY = ViewMinOutput;
			InMaxY = ViewMaxOutput;
			SizeY = InMaxY - InMinY;
		}

#Loc: <Workspace>/Engine/Source/Editor/DistCurveEditor/Private/CurveEditorSharedData.cpp:15

Scope (from outer to inner):

file
function     FCurveEditorSharedData::FCurveEditorSharedData

Source code excerpt:

	EditorOptions = NewObject<UCurveEdOptions>(GetTransientPackage(), MakeUniqueObjectName(GetTransientPackage(), UCurveEdOptions::StaticClass(), FName(TEXT("EditorOptions"))));
	check(EditorOptions);
	MinViewRange = EditorOptions->MinViewRange;
	MaxViewRange = EditorOptions->MaxViewRange;

	EdSetup = InEdSetup;

	LabelContentBoxHeight = 0;

#Loc: <Workspace>/Engine/Source/Editor/DistCurveEditor/Private/CurveEditorSharedData.cpp:59

Scope (from outer to inner):

file
function     void FCurveEditorSharedData::SetCurveView

Source code excerpt:

	float InSize = InEndIn - InStartIn;
	float OutSize = InEndOut - InStartOut;
	if(InSize < MinViewRange  || InSize > MaxViewRange || OutSize < MinViewRange || OutSize > MaxViewRange)
	{
		return;
	}

	StartIn		= EdSetup->Tabs[ EdSetup->ActiveTab ].ViewStartInput	= InStartIn;
	EndIn		= EdSetup->Tabs[ EdSetup->ActiveTab ].ViewEndInput		= InEndIn;

#Loc: <Workspace>/Engine/Source/Editor/DistCurveEditor/Private/CurveEditorSharedData.h:137

Scope (from outer to inner):

file
class        class FCurveEditorSharedData

Source code excerpt:

	float EndOut;
	float MaxViewRange;
	float MinViewRange;
	bool bShowPositionMarker;
	float MarkerPosition;
	FColor MarkerColor;
	bool bShowEndMarker;
	float EndMarkerPosition;
	bool bShowRegionMarker;

#Loc: <Workspace>/Engine/Source/Editor/DistCurveEditor/Private/SDistributionCurveEditor.cpp:901

Scope (from outer to inner):

file
function     void SDistributionCurveEditor::OnFitToSelected

Source code excerpt:


	// Clamp the minimum size
	if(SizeOut < SharedData->MinViewRange)
	{
		MinOut -= SharedData->MinViewRange * 0.5f;
		MaxOut += SharedData->MinViewRange * 0.5f;
		SizeOut = MaxOut - MinOut;
	}
	if(SizeIn < SharedData->MinViewRange)
	{
		MinIn -= SharedData->MinViewRange * 0.5f;
		MaxIn += SharedData->MinViewRange * 0.5f;
		SizeIn = MaxIn - MinIn;
	}

	SharedData->SetCurveView(
		MinIn - FitMargin * SizeIn,
		MaxIn + FitMargin * SizeIn,

#Loc: <Workspace>/Engine/Source/Editor/DistCurveEditor/Private/SDistributionCurveEditor.cpp:1505

Scope (from outer to inner):

file
function     void SDistributionCurveEditor::FitViewHorizontally

Source code excerpt:


	// Clamp the minimum size
	if(Size < SharedData->MinViewRange)
	{
		MinIn -= 0.005f;
		MaxIn += 0.005f;
		Size = MaxIn - MinIn;
	}

#Loc: <Workspace>/Engine/Source/Editor/DistCurveEditor/Private/SDistributionCurveEditor.cpp:1580

Scope (from outer to inner):

file
function     void SDistributionCurveEditor::FitViewVertically

Source code excerpt:


	// Clamp the minimum size
	if(Size < SharedData->MinViewRange)
	{
		MinOut -= 0.005f;
		MaxOut += 0.005f;
		Size = MaxOut - MinOut;
	}

#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Classes/Preferences/CurveEdOptions.h:20

Scope (from outer to inner):

file
class        class UCurveEdOptions : public UObject

Source code excerpt:


	UPROPERTY(EditAnywhere, config, Category=Options)
	float MinViewRange;

	UPROPERTY(EditAnywhere, config, Category=Options)
	float MaxViewRange;

	UPROPERTY(EditAnywhere, config, Category=Options)
	FLinearColor BackgroundColor;