Pow2GridSizes

Pow2GridSizes

#Overview

name: Pow2GridSizes

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

It is referenced in 3 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of Pow2GridSizes is to define a set of power-of-2 grid sizes used for translation snapping and grid rendering in the Unreal Engine editor’s viewport.

This setting variable is primarily used by the Unreal Editor’s viewport system, specifically within the LevelEditorViewportSettings module. It is part of the grid snapping and rendering functionality, which helps developers align objects in the scene with precision.

The value of this variable is set through the UPROPERTY macro in the ULevelEditorViewportSettings class, which allows it to be configured in the editor’s settings menu. It is defined as an array of floats, representing different grid size options.

Pow2GridSizes interacts with several other variables:

  1. bUsePowerOf2SnapSize: Determines whether to use Pow2GridSizes or DecimalGridSizes.
  2. DecimalGridSizes: An alternative array of grid sizes used when not using power-of-2 sizes.
  3. Pow2GridIntervals: Defines the number of lines between each major line interval for pow2 grids.

Developers should be aware that:

  1. This variable affects both the visual grid rendering and the snapping behavior in the viewport.
  2. Changing these values will impact the precision and usability of the grid system in the editor.
  3. The values should be actual powers of 2 (e.g., 1, 2, 4, 8, 16, etc.) to maintain consistency with the naming and expected behavior.

Best practices when using this variable include:

  1. Provide a range of values that cover both fine-grained and larger-scale adjustments.
  2. Ensure the values are appropriate for the scale of your project to maintain usability.
  3. Consider the relationship between Pow2GridSizes and Pow2GridIntervals to create a visually coherent grid system.
  4. Test any changes thoroughly to ensure they don’t negatively impact workflow or precision in the editor.

#Setting Variables

#References In INI files

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

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

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

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

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

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

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

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

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

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

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

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

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

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

#References in C++ code

#Callsites

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

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

Scope (from outer to inner):

file
class        class ULevelEditorViewportSettings : public UObject

Source code excerpt:

	/** Power of 2 grid sizes (for translation snapping and grid rendering) */
	UPROPERTY(EditAnywhere, config, AdvancedDisplay, Category=GridSnapping)
	TArray<float> Pow2GridSizes;

	/** The number of lines between each major line interval for pow2 grids */
	UPROPERTY(EditAnywhere, config, AdvancedDisplay, Category=GridSnapping)
	TArray<float> Pow2GridIntervals;

	/** User defined grid intervals for rotations */

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

Scope (from outer to inner):

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

Source code excerpt:


	return (ViewportSettings->bUsePowerOf2SnapSize) ?
			ViewportSettings->Pow2GridSizes :
			ViewportSettings->DecimalGridSizes;
}

const TArray<float>& UEditorEngine::GetCurrentIntervalGridArray() const
{
	const ULevelEditorViewportSettings* ViewportSettings = GetDefault<ULevelEditorViewportSettings>();

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

Scope (from outer to inner):

file
function     TSharedRef<SWidget> STransformViewportToolBar::FillLocationGridSnapMenu

Source code excerpt:

	const ULevelEditorViewportSettings* ViewportSettings = GetDefault<ULevelEditorViewportSettings>();

	return BuildLocationGridCheckBoxList("Snap", LOCTEXT("LocationSnapText", "Snap Sizes"), ViewportSettings->bUsePowerOf2SnapSize ? ViewportSettings->Pow2GridSizes : ViewportSettings->DecimalGridSizes );
}

TSharedRef<SWidget> STransformViewportToolBar::BuildLocationGridCheckBoxList(FName InExtentionHook, const FText& InHeading, const TArray<float>& InGridSizes) const
{
	const ULevelEditorViewportSettings* ViewportSettings = GetDefault<ULevelEditorViewportSettings>();