UVREditorMode

VR Editor Mode. Extends editor viewports with functionality for VR controls and object manipulation

Choose your operating system:

Windows

macOS

Linux

Inheritance Hierarchy

References

Module

VREditor

Header

/Engine/Source/Editor/VREditor/Public/VREditorMode.h

Include

#include "VREditorMode.h"

Syntax

class UVREditorMode : public UEditorWorldExtension

Remarks

VR Editor Mode. Extends editor viewports with functionality for VR controls and object manipulation

Variables

Name Description

Protected variable

FTimespan

 

AppTimeModeEntered

App time that we entered this mode

Protected variable

TObjectPtr< cla...

 

AutoScalerSystem

Automatic scale system

Protected variable

TObjectPtr< cla...

 

AvatarActor

Avatar visualsActor with components to represent the VR avatar in the world, including motion controller meshes

Protected variable

bool

 

bActuallyUsingVR

True if we're in using an actual HMD in this mode, or false if we're "faking" VR mode for testing

Protected variable

bool

 

bIsFlashlightOn

If there is currently a flashlight in the scene

Protected variable

bool

 

bIsFullyInitialized

True if VR mode is fully initialized and ready to render

Protected variable

bool

 

bWantsToExitMode

True if we currently want to exit VR mode.

Protected variable

EGizmoHandleTyp...

 

CurrentGizmoType

The current Gizmo type that is used for the TransformGizmo Actor

Protected variable

USpotLightCompo...

 

FlashlightComponent

FlashlightSpotlight for the flashlight

Protected variable

TArray< TObject...

 

Interactors

Interactors

Protected variable

int32

 

MotionControllerID

InputThe Unreal controller ID for the motion controllers we're using

Protected variable

FOnPlaceDragged...

 

OnPlaceDraggedMaterialEvent

Event broadcast when a material is placed

Protected variable

FOnPlacePreview...

 

OnPlacePreviewActorEvent

Event broadcast when a preview actor is placed

Public variable

FOnVREditingMod...

 

OnVREditingModeExit_Handler

Used to override dockable area restoration behavior

Protected variable

TObjectPtr< cla...

 

PlacementSystem

Protected variable

FSavedEditorSta...

 

SavedEditorState

Saved information about the editor and viewport we possessed, so we can restore it after exiting VR mode

Protected variable

TObjectPtr< cla...

 

TeleportActor

Teleporter system

Protected variable

FOnVRTickHandle

 

TickHandle

Subsystems registered

Protected variable

TObjectPtr< cla...

 

UISystem

SubsystemsVR UI system

Protected variable

TWeakPtr< class...

 

VREditorLevelViewportWeakPtr

The VR level viewport, if we're in VR mode

Protected variable

TWeakPtr< class...

 

VREditorWindowWeakPtr

Startup/ShutdownThe VR editor window, if it's open right now

Protected variable

TObjectPtr< cla...

 

WorldInteraction

World interactionWorld interaction manager

Constructors

Name Description

Public function

UVREditorMode()

Default constructor

Functions

Name Description

Public function

void

 

AllocateInteractors()

Public function

UStaticMeshC...

 

CreateMesh

(
    AActor* OwningActor,
    UStaticMesh* Mesh,
    USceneComponent* AttachmentToC...
)

Helper functions to create a static mesh

Public function

UStaticMeshC...

 

CreateMesh

(
    AActor* OwningActor,
    const FString& MeshName,
    USceneComponent* AttachmentToC...
)

Helper functions to create a static mesh

Public function

UStaticMeshC...

 

CreateMotionControllerMesh

(
    AActor* OwningActor,
    USceneComponent* AttachmentToC...,
    UStaticMesh* OptionalControlle...
)

Create a static motion controller mesh for the current HMD platform

Public function

void

 

CycleTransformGizmoHandleType()

Will update the TransformGizmo Actor with the next Gizmo type

Public function

void

 

Enter()

When the user actually enters the VR Editor mode

Public function

void

 

Exit

(
    const bool bShouldDisableStereo
)

When the user leaves the VR Editor mode

Public function Const

const UVREdi...

 

GetAssetContainer()

Gets the container for all the assets of VREditor.

Public function Const

FLinearColor

 

GetColor

(
    const EColors Color
)

Gets the color.

Public function Const

EGizmoHandle...

 

GetCurrentGizmoType()

Gets the current Gizmo handle type

Public function

ISequencer &...

 

GetCurrentSequencer()

Returns the currently active sequencer

Public function Const

float

 

GetDefaultVRNearClipPlane()

Get the default near clipping plane for VR editing.

Public function Const

UVREditorInt...

 

GetHandInteractor

(
    const EControllerHand ControllerHan...
)

Gets the hand interactor

Public function Const

FTransform

 

GetHeadTransform()

Gets the world space transform of the HMD (head)

Public function Const

FName

 

GetHMDDeviceType()

Public function Const

const SLevel...

 

GetLevelViewportPossessedForVR()

Gets the viewport that VR Mode is activated in.

Public function

SLevelViewpo...

 

GetLevelViewportPossessedForVR()

Mutable version of above.

Public function Const

int32

 

GetMotionControllerID()

Returns the Unreal controller ID for the motion controllers we're using

Public function Const

FTransform

 

GetRoomSpaceHeadTransform()

Gets the transform of the user's HMD in room space

Public function Const

FTransform

 

GetRoomTransform()

Gets the world space transform of the calibrated VR room origin.

Public function Const

const FSaved...

 

GetSavedEditorState()

Gets the saved editor state from entering the mode

Public function

AVREditorTel...

 

GetTeleportActor()

Get Teleporter

Public function Const

FTimespan

 

GetTimeSinceModeEntered()

Returns the time since the VR Editor mode was last entered

Public function

UVREditorUIS...

 

GetUISystem()

Gets access to the VR UI system

Public function Const

const UVREdi...

 

GetUISystem()

Gets access to the VR UI system (const)

Public function Const

const TArray...

 

GetVRInteractors()

Public function Const

const UViewp...

 

GetWorldInteraction()

Gets access to the world interaction system (const)

Public function

UViewportWor...

 

GetWorldInteraction()

Gets access to the world interaction system

Public function Const

float

 

GetWorldScaleFactor()

Gets the world scale factor, which can be multiplied by a scale vector to convert to room space

Public function Const

bool

 

IsActuallyUsingVR()

Returns true if we're actually using VR, or false if we're faking it

Public function Const

bool

 

IsAimingTeleport()

Return true if currently aiming to teleport.

Public function Static

bool

 

IsDebugModeEnabled()

Returns if the VR Mode is in debug mode.

Public function Const

bool

 

IsFlashlightOn()

Returns whether or not the flashlight is visible

Public function Const

bool

 

IsFullyInitialized()

If the mode was completely initialized

Public function Const

bool

 

IsHandAimingTowardsCapsule

(
    UViewportInteractor* Interacto...,
    const FTransform& CapsuleTransform,
    const FVector CapsuleStart,
    const FVector CapsuleEnd,
    const float CapsuleRadius,
    const float MinDistanceToCapsule,
    const FVector CapsuleFrontDirection,
    const float MinDotForAimingAtCapsul...
)

Public function Const

bool

 

IsShowingRadialMenu

(
    const UVREditorInteractor* Int...
)

Lets other modules know if the radial menu is visible on a given interactor so input should be handled differently

Public function Const

bool

 

IsTeleporting()

Public function Static

UVREditorAss...

 

LoadAssetContainer()

Loads and returns the container for all the assets of VREditor.

Public function

FOnPlaceDrag...

 

OnPlaceDraggedMaterial()

Public function

FOnPlacePrev...

 

OnPlacePreviewActor()

Public function

FOnVRTickHan...

 

OnTickHandle()

Public function

FOnToggleVRM...

 

OnToggleDebugMode()

Public function Static

T

 

OvershootEaseOut

(
    T Alpha,
    const float OvershootAmount
)

Public function

void

 

PlaySound

(
    USoundBase* SoundBase,
    const FVector& InWorldLocation,
    const float InVolume
)

Plays sound at location.

Public function

void

 

PostTick

(
    const float DeltaTime
)

Tick after the ViewportWorldInteraction is ticked

Public function

void

 

PreTick

(
    const float DeltaTime
)

Tick before the ViewportWorldInteraction is ticked

Public function

void

 

RefreshActorPreviewWidget

(
    TSharedRef< SWidget > InWidget,
    int32 Index,
    AActor* Actor,
    bool bIsPanelDetached
)

Refresh the current actor preview widget on an in-world UI panel

Public function

void

 

RefreshVREditorSequencer

(
    ISequencer* InCurrentSequencer
)

Runtime and plugin modules can force VR Editor to refresh using this function

Public function

void

 

SaveSequencerSettings

(
    bool bInKeyAllEnabled,
    EAutoChangeMode InAutoChangeMode,
    const USequencerSettings& InSequen...
)

Public function

void

 

SetActuallyUsingVR

(
    const bool bShouldActuallyUseVR
)

Static: Sets whether we should actually use an HMD. Call this before activating VR mode

Public function

void

 

SetRoomTransform

(
    const FTransform& NewRoomTransform
)

Sets a new transform for the room, in world space.

Public function

void

 

SnapSelectedActorsToGround()

Snaps the current selected actor to the ground

Public function

void

 

StartExitingVRMode()

Call this to start exiting VR mode

Public function Static

void

 

ToggleDebugMode()

Toggles the debug mode.

Public function

void

 

ToggleFlashlight

(
    UVREditorInteractor* Interacto...
)

Spawns a flashlight on the specified hand

Public function Const

bool

 

UISystemIsActive()

Check whether the UISystem exists

Public function

void

 

UpdateExternalSlateUI

(
    TSharedRef< SWidget > InWidget,
    FName Name,
    FVector2D InSize
)

General way to spawn an external SlateUI from a radial menu

Public function

void

 

UpdateExternalUMGUI

(
    const FVREditorFloatingUICreationCo...
)

General way to spawn an external UMG UI from a radial menu

Public function Const

bool

 

WantsToExitMode()

Returns true if the user wants to exit this mode

Overridden from UEditorWorldExtension

Name Description

Public function Virtual

void

 

Init()

Initialize the VREditor

Public function Virtual

void

 

Shutdown()

Shutdown the VREditor

Protected function Virtual

void

 

TransitionWorld

(
    UWorld* NewWorld,
    EEditorWorldExtensionTransitionStat...
)

Reparent actors to a new world

Classes

Name

Description

Public class

FOnPlaceDraggedMaterial

Delegate to be called when a material is placed

Public class

FOnPlacePreviewActor

Delegate to be called when a preview actor is placed

Public class

FOnToggleVRModeDebug

Delegate to be called when the debug mode is toggled.

Public class

FOnVRTickHandle

  • Gets the tick handle to give external systems the change to be ticked right after the ViewportWorldInteraction is ticked

Public struct

FSavedEditorState

Saved information about the editor and viewport we possessed, so we can restore it after exiting VR mode

Enums

Name

Description

Public enum

EColors

Color types.

Typedefs

Name

Description

FOnVREditingModeExit

Constants

Name

Description

AssetContainerPath

The asset container path

bDebugModeEnabled

Whether currently in debug mode or not.