DivisionsOf360RotGridSizes

DivisionsOf360RotGridSizes

#Overview

name: DivisionsOf360RotGridSizes

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

It is referenced in 5 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of DivisionsOf360RotGridSizes is to provide preset grid intervals for rotations in the Unreal Engine editor. This setting variable is used to define snap points for rotating objects in the viewport, specifically as divisions of 360 degrees.

This setting variable is primarily used in the Unreal Engine’s editor subsystem, particularly in the viewport and transform tools. It’s referenced in the following modules and plugins:

  1. UVEditor plugin
  2. CustomizableObjectEditor (experimental Mutable plugin)
  3. UnrealEd module

The value of this variable is set in the LevelEditorViewportSettings class, which is part of the UnrealEd module. It’s defined as a UPROPERTY with the EditAnywhere, config, and AdvancedDisplay attributes, allowing it to be edited in the editor’s project settings.

This variable interacts with other rotation-related settings, such as CommonRotGridSizes and CurrentRotGridMode. The GetCurrentRotationGridArray function in EditorConstraints.cpp uses these variables to determine which rotation grid array to use.

Developers should be aware that this variable affects the rotation snapping behavior in the editor viewport. It provides a set of predefined rotation intervals that objects can snap to when being rotated, which can be particularly useful for precise alignments.

Best practices when using this variable include:

  1. Configuring appropriate values that make sense for your project’s needs. Common divisions might include 45, 90, or 15 degrees.
  2. Ensuring that the values in this array complement those in CommonRotGridSizes to provide a comprehensive set of rotation snap options.
  3. Considering the typical use cases in your project when setting these values. For example, if your game frequently uses octagonal structures, including a 45-degree division would be beneficial.
  4. Documenting any custom settings for your team to ensure consistent usage across the project.
  5. Being mindful of performance if adding a large number of divisions, as this could potentially impact the editor’s responsiveness when rotating objects.

#Setting Variables

#References In INI files

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

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

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

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

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Plugins/Editor/UVEditor/Source/UVEditor/Private/SUVEditor2DViewportToolBar.cpp:361

Scope (from outer to inner):

file
function     TSharedRef<SWidget> SUVEditor2DViewportToolBar::FillRotationGridSnapMenu

Source code excerpt:

	+ SUniformGridPanel::Slot(1, 0)
		[
			BuildRotationGridCheckBoxList("Div360", LOCTEXT("RotationDivisions360DegreesText", "Divisions of 360\u00b0"), ViewportSettings->DivisionsOf360RotGridSizes)
		];
}

TSharedRef<SWidget> SUVEditor2DViewportToolBar::BuildRotationGridCheckBoxList(FName InExtentionHook, const FText& InHeading, const TArray<float>& InGridSizes) const
{
	const bool bShouldCloseWindowAfterMenuSelection = true;

#Loc: <Workspace>/Engine/Plugins/Experimental/Mutable/Source/CustomizableObjectEditor/Private/MuCOE/SCustomizableObjectEditorViewportToolBar.cpp:653

Scope (from outer to inner):

file
function     TSharedRef<SWidget> SCustomizableObjectEditorViewportToolBar::FillRotationGridSnapMenu

Source code excerpt:

		+ SUniformGridPanel::Slot(1, 0)
		[
			BuildRotationGridCheckBoxList("Div360", LOCTEXT("RotationDivisions360DegreesText", "Divisions of 360\u00b0"), ViewportSettings->DivisionsOf360RotGridSizes, GridMode_DivisionsOf360)
		];
}


TSharedRef<SWidget> SCustomizableObjectEditorViewportToolBar::BuildRotationGridCheckBoxList(FName InExtentionHook, const FText& InHeading, const TArray<float>& InGridSizes, ERotationGridMode InGridMode) const
{

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

Scope (from outer to inner):

file
class        class ULevelEditorViewportSettings : public UObject

Source code excerpt:

	/** Preset grid intervals for rotations */
	UPROPERTY(EditAnywhere, config, AdvancedDisplay, Category=GridSnapping)
	TArray<float> DivisionsOf360RotGridSizes;

	/** Grid sizes for scaling */
	UPROPERTY(EditAnywhere, config, AdvancedDisplay, Category=GridSnapping)
	TArray<float> ScalingGridSizes;

	/** If enabled, actor positions will snap to the grid. */

#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/EditorConstraints.cpp:119

Scope (from outer to inner):

file
function     const TArray<float>& UEditorEngine::GetCurrentRotationGridArray

Source code excerpt:

	return (ViewportSettings->CurrentRotGridMode == GridMode_Common) ?
			ViewportSettings->CommonRotGridSizes :
			ViewportSettings->DivisionsOf360RotGridSizes;
}

float UEditorEngine::GetScaleGridSize()
{
	const ULevelEditorViewportSettings* ViewportSettings = GetDefault<ULevelEditorViewportSettings>();
	float ScaleVal = 0.0001f;

#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/STransformViewportToolbar.cpp:829

Scope (from outer to inner):

file
function     TSharedRef<SWidget> STransformViewportToolBar::FillRotationGridSnapMenu

Source code excerpt:

	+ SUniformGridPanel::Slot(1, 0)
		[
			BuildRotationGridCheckBoxList("Div360", LOCTEXT("RotationDivisions360DegreesText", "Divisions of 360\u00b0"), ViewportSettings->DivisionsOf360RotGridSizes, GridMode_DivisionsOf360)
		];
}

TSharedRef<SWidget> STransformViewportToolBar::FillLayer2DSnapMenu()
{
	const ULevelEditorViewportSettings* ViewportSettings = GetDefault<ULevelEditorViewportSettings>();