FSceneViewport

A viewport for use with Slate[SViewport](API\Runtime\Slate\Widgets\SViewport) widgets.

Windows
MacOS
Linux

Inheritance Hierarchy

References

Module

Engine

Header

/Engine/Source/Runtime/Engine/Public/Slate/SceneViewport.h

Include

#include "Slate/SceneViewport.h"

Syntax

class FSceneViewport :
    public FViewportFrame,
    public FViewport,
    public ISlateViewport,
    public IViewportRenderTargetProvider

Remarks

A viewport for use with SlateSViewport widgets.

Constructors

Name Description

Public function

FSceneViewport

(
    FViewportClient* InViewportCli...,
    TSharedPtr< SViewport > InViewportW...
)

Destructors

Name Description

Public function

~FSceneViewport()

Functions

Name Description

Public function

TSharedPtr< ...

 

FindWindow()

Public function Const

const FGeome...

 

GetCachedGeometry()

Get the cached viewport geometry.

Public function Const

bool

 

GetPlayInEditorIsSimulate()

Public function Const

TWeakPtr< SV...

 

GetViewportWidget()

Public function Const

bool

 

HasFixedSize()

Does the viewport has a fixed size

Public function

void

 

OnPlayWorldViewportSwapped

(
    const FSceneViewport& OtherViewpor...
)

Performs a resize when in swapping viewports while viewing the play world.

Public function Const

void

 

PaintDebugCanvas

(
    const FGeometry& AllottedGeometry,
    FSlateWindowElementList& OutDrawEl...,
    int32 LayerId
)

Adds a draw element for the debug canvas.

Public function

void

 

SetDebugCanvas

(
    TSharedPtr< class SDebugCanvas > In...
)

Sets the debug canvas used to display FCanvas on top of this viewport

Public function

void

 

SetFixedViewportSize

(
    uint32 NewSizeX,
    uint32 NewSizeY
)

Public function

void

 

SetGammaOverride

(
    const float InGammaOverride
)

Set an optional display gamma to use for this viewport

Public function

void

 

SetOnSceneViewportResizeDel

(
    FOnSceneViewportResize InOnSceneVie...
)

Sets the Viewport resize delegate.

Public function

void

 

SetPlayInEditorGetsMouseControl

(
    const bool bGetsMouseControl
)

Sets whether a PIE viewport takes mouse control on startup.

Public function

void

 

SetPlayInEditorIsSimulate

(
    const bool bIsSimulate
)

Public function Virtual

void

 

SetRenderTargetTextureRenderThread

(
    FTexture2DRHIRef& RT
)

Public function

void

 

SetViewportSize

(
    uint32 NewSizeX,
    uint32 NewSizeY
)

Public function

void

 

SwapStatCommands

(
    const FSceneViewport& OtherViewpor...
)

Swaps the active stats with another viewports

Overridden from FViewportFrame

Name Description

Public function Virtual

FViewport &#...

 

GetViewport()

FViewportFrame interface

Public function Virtual

void

 

ResizeFrame

(
    uint32 NewSizeX,
    uint32 NewSizeY,
    EWindowMode::Type NewWindowMode
)

Called to resize the actual window where this viewport resides

Overridden from FViewport

Name Description

Public function Virtual

void

 

BeginRenderFrame

(
    FRHICommandListImmediate& RHICmdLi...
)

Called when a frame starts to render

Public function Virtual

void

 

CaptureMouse

(
    bool bCapture
)

Public function Virtual

void

 

DeferInvalidateHitProxy()

Invalidates the viewport's cached hit proxies at the end of the frame.

Public function Virtual

void

 

EndRenderFrame

(
    FRHICommandListImmediate& RHICmdLi...,
    bool bPresent,
    bool bLockToVsync
)

Called when a frame is done rendering

Public function Virtual

void

 

EnqueueBeginRenderFrame

(
    const bool bShouldPresent
)

Called before BeginRenderFrame is enqueued

Public function Virtual

void

 

EnqueueEndRenderFrame

(
    const bool bLockToVsync,
    const bool bShouldPresent
)

Ends a rendering frame. Called from the game thread.

Public function Virtual

FCanvas *...

 

GetDebugCanvas()

Public function Virtual

void

 

GetMousePos

(
    FIntPoint& MousePosition,
    const bool bLocalPosition
)

Sets MousePosition to the current mouse position

Public function Virtual Const

int32

 

GetMouseX()

Public function Virtual Const

int32

 

GetMouseY()

Public function Virtual Const

FIntPoint

 

GetRenderTargetTextureSizeXY()

Returns dimensions of RenderTarget texture. Can be called on a game thread.

Public function Virtual

FViewportFra...

 

GetViewportFrame()

Retrieves the interface to the viewport's frame, if it has one.

Public function Virtual

void *

 

GetWindow()

Public function Virtual Const

bool

 

HasFocus()

Public function Virtual Const

bool

 

HasMouseCapture()

New MouseCapture/MouseLock API.

Public function Virtual

void

 

InvalidateDisplay()

Called when the viewport should be invalidated and redrawn

Public function Virtual Const

bool

 

IsCursorVisible()

Returns true if the mouse cursor is currently visible

Public function Virtual Const

bool

 

IsForegroundWindow()

Public function Virtual Const

bool

 

IsSoftwareCursorVisible()

Public function Virtual Const

bool

 

IsStereoRenderingAllowed()

Should return true, if stereo rendering is allowed in this viewport

Public function Virtual Const

bool

 

KeyState

(
    FKey Key
)

Returns the state of the provided key.

Public function Virtual

void

 

LockMouseToViewport

(
    bool bLock
)

Public function Virtual

void

 

MoveWindow

(
    int32 NewPosX,
    int32 NewPosY,
    int32 NewSizeX,
    int32 NewSizeY
)

FViewport interface

Public function Virtual

void

 

ProcessInput

(
    float DeltaTime
)

Additional input processing that happens every frame

Public function Virtual

void

 

SetMouse

(
    int32 X,
    int32 Y
)

Not implemented

Public function Virtual

void

 

SetPreCaptureMousePosFromSlateCursor()

Sets PreCapture coordinates from the current position of the slate cursor.

Public function Virtual

void

 

SetRequiresVsync

(
    bool bShouldVsync
)

Indicate that the viewport should be block for vsync.

Public function Virtual

void

 

SetSoftwareCursorPosition

(
    FVector2D Position
)

Public function Virtual

bool

 

SetUserFocus

(
    bool bFocus
)

Captures or uncaptures the joystick

Public function Virtual

void

 

ShowCursor

(
    bool bVisible
)

Public function Virtual

void

 

ShowSoftwareCursor

(
    bool bVisible
)

Public function Virtual

void

 

UpdateViewportRHI

(
    bool bDestroyed,
    uint32 NewSizeX,
    uint32 NewSizeY,
    EWindowMode::Type NewWindowMode,
    EPixelFormat PreferredPixelFormat
)

Updates the viewport RHI with a new size and fullscreen flag

Public function Virtual Const

FIntPoint

 

ViewportToVirtualDesktopPixel

(
    FVector2D ViewportCoordinate
)

Transforms a coordinate in the local space of this viewport into a virtual desktop pixel.

Public function Virtual Const

FVector2D

 

VirtualDesktopPixelToViewport

(
    FIntPoint VirtualDesktopPointPx
)

Transforms a virtual desktop pixel (the origin is in the primary screen's top left corner) to the local space of this viewport

Overridden from FRenderTarget

Name Description

Public function Virtual Const

float

 

GetDisplayGamma()

Public function Virtual Const

const FTextu...

 

GetRenderTargetTexture()

Gets the proper RenderTarget based on the current thread

Overridden from ISlateViewport

Name Description

Public function Virtual Const

FIntPoint

 

GetSize()

Returns the size of the viewport

Public function Virtual Const

FVector2D

 

GetSoftwareCursorPosition()

Returns the current position of the software cursor

Public function Virtual Const

FSlateShader...

 

GetViewportRenderTargetTexture()

ISlateViewport interface

Public function Virtual

TWeakPtr< SW...

 

GetWidget()

Gets the SWidget associated with this viewport

Public function Virtual

bool

 

HandleNavigation

(
    const uint32 InUserIndex,
    TSharedPtr< SWidget > InDestination
)

Give the viewport an opportunity to override the navigation behavior.

Public function Virtual

FReply

 

OnAnalogValueChanged

(
    const FGeometry& MyGeometry,
    const FAnalogInputEvent& InAnalogI...
)

Called when an analog value changes on a button that supports analog

Public function Virtual

FCursorReply

 

OnCursorQuery

(
    const FGeometry& MyGeometry,
    const FPointerEvent& CursorEvent
)

Called when Slate needs to know what the mouse cursor should be.

Public function Virtual

void

 

OnDrawViewport

(
    const FGeometry& AllottedGeometry,
    const FSlateRect& MyCullingRect,
    FSlateWindowElementList& OutDrawEl...,
    int32 LayerId,
    const FWidgetStyle& InWidgetStyle,
    bool bParentEnabled
)

Called by Slate when the viewport widget is drawn Implementers of this interface can use this method to perform custom per draw functionality.

Public function Virtual

void

 

OnFinishedPointerInput()

Called after all input for this frame is processed.

Public function Virtual

void

 

OnFocusLost

(
    const FFocusEvent& InFocusEvent
)

Called when the viewport loses keyboard focus.

Public function Virtual

FReply

 

OnFocusReceived

(
    const FFocusEvent& InFocusEvent
)

Called when the viewport gains keyboard focus.

Public function Virtual

FReply

 

OnKeyChar

(
    const FGeometry& MyGeometry,
    const FCharacterEvent& InCharacter...
)

Called by Slate when a character key is pressed while the viewport has focus

Public function Virtual

FReply

 

OnKeyDown

(
    const FGeometry& MyGeometry,
    const FKeyEvent& InKeyEvent
)

Called by Slate when a key is pressed inside the viewport

Public function Virtual

FReply

 

OnKeyUp

(
    const FGeometry& MyGeometry,
    const FKeyEvent& InKeyEvent
)

Called by Slate when a key is released inside the viewport

Public function Virtual

TOptional< T...

 

OnMapCursor

(
    const FCursorReply& CursorReply
)

After OnCursorQuery has specified a cursor type the system asks each widget under the mouse to map that cursor to a widget.

Public function Virtual

FReply

 

OnMotionDetected

(
    const FGeometry& MyGeometry,
    const FMotionEvent& InMotionEvent
)

Called when motion is detected (controller or device) e.g. Someone tilts or shakes their controller.

Public function Virtual

FReply

 

OnMouseButtonDoubleClick

(
    const FGeometry& InMyGeometry,
    const FPointerEvent& InMouseEvent
)

Called by Slate when the mouse wheel is used inside the viewport

Public function Virtual

FReply

 

OnMouseButtonDown

(
    const FGeometry& MyGeometry,
    const FPointerEvent& MouseEvent
)

Called by Slate when a mouse button is pressed inside the viewport

Public function Virtual

FReply

 

OnMouseButtonUp

(
    const FGeometry& MyGeometry,
    const FPointerEvent& MouseEvent
)

Called by Slate when a mouse button is released inside the viewport

Public function Virtual

void

 

OnMouseEnter

(
    const FGeometry& MyGeometry,
    const FPointerEvent& MouseEvent
)

Public function Virtual

void

 

OnMouseLeave

(
    const FPointerEvent& MouseEvent
)

Public function Virtual

FReply

 

OnMouseMove

(
    const FGeometry& MyGeometry,
    const FPointerEvent& MouseEvent
)

Called by Slate when a mouse button is released inside the viewport

Public function Virtual

FReply

 

OnMouseWheel

(
    const FGeometry& MyGeometry,
    const FPointerEvent& MouseEvent
)

Called by Slate when the mouse wheel is used inside the viewport

Public function Virtual Const

FPopupMethod...

 

OnQueryPopupMethod()

Called to figure out whether we can make new windows for popups within this viewport.

Public function Virtual Const

TOptional< b...

 

OnQueryShowFocus

(
    const EFocusCause InFocusCause
)

Called to determine if we should render the focus brush.

Public function Virtual

FReply

 

OnRequestWindowClose()

Called when the top level window associated with the viewport has been requested to close.

Public function Virtual

FReply

 

OnTouchEnded

(
    const FGeometry& MyGeometry,
    const FPointerEvent& InTouchEvent
)

Called when a touchpad touch is ended (finger lifted)

Public function Virtual

FReply

 

OnTouchFirstMove

(
    const FGeometry& MyGeometry,
    const FPointerEvent& InTouchEvent
)

Called when a touchpad touch has first moved after initial press

Public function Virtual

FReply

 

OnTouchForceChanged

(
    const FGeometry& MyGeometry,
    const FPointerEvent& InTouchEvent
)

Called when a touchpad touch force changes, but may or may not have moved

Public function Virtual

FReply

 

OnTouchGesture

(
    const FGeometry& MyGeometry,
    const FPointerEvent& InGestureEven...
)

Called on a touchpad gesture event

Public function Virtual

FReply

 

OnTouchMoved

(
    const FGeometry& MyGeometry,
    const FPointerEvent& InTouchEvent
)

Called when a touchpad touch is moved (finger moved)

Public function Virtual

FReply

 

OnTouchStarted

(
    const FGeometry& MyGeometry,
    const FPointerEvent& InTouchEvent
)

Called when a touchpad touch is started (finger down)

Public function Virtual

FReply

 

OnViewportActivated

(
    const FWindowActivateEvent& InActi...
)

Called when the viewports top level window is being Activated

Public function Virtual

void

 

OnViewportClosed()

Called when the viewport has been requested to close.

Public function Virtual

void

 

OnViewportDeactivated

(
    const FWindowActivateEvent& InActi...
)

Called when the viewports top level window is being Deactivated

Public function Virtual Const

bool

 

RequiresVsync()

Returns true if the viewport should be vsynced.

Public function Virtual

void

 

Tick

(
    const FGeometry& AllottedGeometry,
    double InCurrentTime,
    float InDeltaTime
)

Ticks the viewport

Overridden from IViewportRenderTargetProvider

Deprecated Functions

Name Description

Public function

void

 

ResizeFrame

(
    uint32 NewSizeX,
    uint32 NewSizeY,
    EWindowMode::Type NewWindowMode,
    int32,
    int32
)

The version of FSceneViewport::ResizeFrame that takes a position is deprecated (the position was never used). Please use the version that doesn't take a position instead.

Help shape the future of Unreal Engine documentation! Tell us how we're doing so we can serve you better.
Take our survey
Dismiss