CurrentRotGridMode
CurrentRotGridMode
#Overview
name: CurrentRotGridMode
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 6
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of CurrentRotGridMode is to control which array of rotation grid values is being used in the Unreal Engine editor’s viewport. It is part of the editor’s settings system, specifically for managing rotation snapping behavior in the level editor viewport.
This setting variable is primarily used by the UnrealEd module, which is responsible for the Unreal Engine editor’s functionality. It’s also referenced in the Mutable plugin’s CustomizableObjectEditor and the VREditor module, indicating its relevance to various editor-related systems.
The value of this variable is set in the UEditorEngine::SetRotGridSize function, which is called when the user changes the rotation grid settings in the editor. It’s stored in the ULevelEditorViewportSettings class, which is a config-based settings class.
CurrentRotGridMode interacts closely with CurrentRotGridSize, another setting variable that determines the index of the currently selected grid size within the chosen grid mode array. Together, these variables control the rotation snapping behavior in the editor.
Developers should be aware that this variable is an enumeration (TEnumAsByte
Best practices when using this variable include:
- Always use the getter methods provided by the UEditorEngine class (like GetCurrentRotationGridArray()) instead of accessing the variable directly.
- When changing this setting, make sure to update both CurrentRotGridMode and CurrentRotGridSize to ensure consistent behavior.
- Be aware of how this setting affects user interaction in the editor, especially when developing custom editor tools or extensions that involve rotation.
- If modifying this setting programmatically, remember to call PostEditChange() on the ULevelEditorViewportSettings object to ensure all necessary updates occur.
- Consider the implications on VR editing when changing this setting, as it’s also referenced in the VR editor module.
#Setting Variables
#References In INI files
Location: <Workspace>/Engine/Config/BaseEditorPerProjectUserSettings.ini:431, section: [/Script/UnrealEd.LevelEditorViewportSettings]
- INI Section:
/Script/UnrealEd.LevelEditorViewportSettings
- Raw value:
GridMode_Common
- Is Array:
False
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Plugins/Experimental/Mutable/Source/CustomizableObjectEditor/Private/MuCOE/SCustomizableObjectEditorViewport.cpp:924
Scope (from outer to inner):
file
function bool SCustomizableObjectEditorViewportTabBody::IsRotationGridSizeChecked
Source code excerpt:
{
const ULevelEditorViewportSettings* ViewportSettings = GetDefault<ULevelEditorViewportSettings>();
return (ViewportSettings->CurrentRotGridSize == GridSizeIndex) && (ViewportSettings->CurrentRotGridMode == GridMode);
}
void SCustomizableObjectEditorViewportTabBody::OnSetLODModel(int32 LODSelectionType)
{
LODSelection = LODSelectionType;
#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Classes/Settings/LevelEditorViewportSettings.h:491
Scope (from outer to inner):
file
class class ULevelEditorViewportSettings : public UObject
Source code excerpt:
/** Controls which array of rotation grid values we are using */
UPROPERTY(config)
TEnumAsByte<ERotationGridMode> CurrentRotGridMode;
public:
/** How to constrain perspective view port FOV */
UPROPERTY(EditAnywhere, config, Category=LookAndFeel)
TEnumAsByte<enum EAspectRatioAxisConstraint> AspectRatioAxisConstraint;
#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/EditorConstraints.cpp:93
Scope (from outer to inner):
file
function void UEditorEngine::SetRotGridSize
Source code excerpt:
ULevelEditorViewportSettings* ViewportSettings = GetMutableDefault<ULevelEditorViewportSettings>();
ViewportSettings->CurrentRotGridMode = InGridMode;
ViewportSettings->CurrentRotGridSize = FMath::Clamp<int32>( InIndex, 0, RotGridSizes.Num() - 1 );
ViewportSettings->PostEditChange();
RedrawLevelEditingViewports();
FEditorSupportDelegates::UpdateUI.Broadcast();
}
#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/EditorConstraints.cpp:104
Scope (from outer to inner):
file
function void UEditorEngine::RotGridSizeIncrement
Source code excerpt:
{
const ULevelEditorViewportSettings* ViewportSettings = GetDefault<ULevelEditorViewportSettings>();
SetRotGridSize(ViewportSettings->CurrentRotGridSize + 1, ViewportSettings->CurrentRotGridMode );
}
void UEditorEngine::RotGridSizeDecrement( )
{
const ULevelEditorViewportSettings* ViewportSettings = GetDefault<ULevelEditorViewportSettings>();
SetRotGridSize(ViewportSettings->CurrentRotGridSize - 1, ViewportSettings->CurrentRotGridMode );
}
const TArray<float>& UEditorEngine::GetCurrentRotationGridArray() const
{
const ULevelEditorViewportSettings* ViewportSettings = GetDefault<ULevelEditorViewportSettings>();
return (ViewportSettings->CurrentRotGridMode == GridMode_Common) ?
ViewportSettings->CommonRotGridSizes :
ViewportSettings->DivisionsOf360RotGridSizes;
}
float UEditorEngine::GetScaleGridSize()
{
#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/STransformViewportToolbar.cpp:748
Scope (from outer to inner):
file
function bool STransformViewportToolBar::IsRotationGridSizeChecked
Source code excerpt:
{
const ULevelEditorViewportSettings* ViewportSettings = GetDefault<ULevelEditorViewportSettings>();
return (ViewportSettings->CurrentRotGridSize == GridSizeIndex) && (ViewportSettings->CurrentRotGridMode == GridMode);
}
/**
* Checks to see if the specified scale grid size is the current scale grid size
*
#Loc: <Workspace>/Engine/Source/Editor/VREditor/Private/VREditorActions.cpp:81
Scope (from outer to inner):
file
function void FVREditorActionCallbacks::OnRotationSnapSizeButtonClicked
Source code excerpt:
const TArray<float>& GridSizes = GEditor->GetCurrentRotationGridArray();
const int32 CurrentGridSize = GetDefault<ULevelEditorViewportSettings>()->CurrentRotGridSize;
const ERotationGridMode CurrentGridMode = GetDefault<ULevelEditorViewportSettings>()->CurrentRotGridMode;
int32 NewGridSize = CurrentGridSize + 1;
if (NewGridSize >= GridSizes.Num())
{
NewGridSize = 0;
}