Search Results for

    Show / Hide Table of Contents

    Class EditorViewport

    Editor viewports base class.

    Inheritance
    System.Object
    Control
    ContainerControl
    FlaxEngine.GUI.RenderOutputControl
    EditorViewport
    EditorGizmoViewport
    AssetPreview
    Implements
    System.IComparable
    IDrawable
    Inherited Members
    ContainerControl._children
    ContainerControl._containsFocus
    ContainerControl._isLayoutLocked
    ContainerControl.LockChildrenRecursive()
    ContainerControl.UnlockChildrenRecursive()
    ContainerControl.RemoveChildren()
    ContainerControl.DisposeChildren()
    ContainerControl.AddChild<T>()
    ContainerControl.AddChild<T>(T)
    ContainerControl.RemoveChild(Control)
    ContainerControl.GetChild(Int32)
    ContainerControl.GetChild<T>()
    ContainerControl.GetChildIndex(Control)
    ContainerControl.GetChildIndexAt(Float2)
    ContainerControl.GetChildAt(Float2)
    ContainerControl.GetChildAt(Float2, Func<Control, Boolean>)
    ContainerControl.GetChildAtRecursive(Float2)
    ContainerControl.GetClientArea()
    ContainerControl.SortChildren()
    ContainerControl.SortChildrenRecursive()
    ContainerControl.OnChildrenChanged()
    ContainerControl.GetDesireClientArea(Rectangle)
    ContainerControl.IntersectsChildContent(Control, Float2, Float2)
    ContainerControl.OnNavigate(NavDirection, Float2, Control, List<Control>)
    ContainerControl.CanNavigateChild(Control)
    ContainerControl.NavigationWrap(NavDirection, Float2, List<Control>, Float2)
    ContainerControl.UpdateContainsFocus()
    ContainerControl.UpdateChildrenBounds()
    ContainerControl.PerformLayoutAfterChildren()
    ContainerControl.ClearState()
    ContainerControl.DrawSelf()
    ContainerControl.DrawChildren()
    ContainerControl.ContainsPoint(Float2, Boolean)
    ContainerControl.PerformLayout(Boolean)
    ContainerControl.RayCast(Float2, Control)
    ContainerControl.OnMouseEnter(Float2)
    ContainerControl.OnMouseMove(Float2)
    ContainerControl.OnMouseLeave()
    ContainerControl.OnMouseUp(Float2, MouseButton)
    ContainerControl.OnMouseDoubleClick(Float2, MouseButton)
    ContainerControl.IsTouchPointerOver(Int32)
    ContainerControl.OnTouchEnter(Float2, Int32)
    ContainerControl.OnTouchDown(Float2, Int32)
    ContainerControl.OnTouchMove(Float2, Int32)
    ContainerControl.OnTouchUp(Float2, Int32)
    ContainerControl.OnTouchLeave(Int32)
    ContainerControl.OnCharInput(Char)
    ContainerControl.OnKeyUp(KeyboardKeys)
    ContainerControl.OnDragEnter(Float2, DragData)
    ContainerControl.OnDragMove(Float2, DragData)
    ContainerControl.OnDragLeave()
    ContainerControl.OnDragDrop(Float2, DragData)
    ContainerControl.OnSizeChanged()
    ContainerControl.Children
    ContainerControl.ChildrenCount
    ContainerControl.HasChildren
    ContainerControl.ContainsFocus
    ContainerControl.ClipChildren
    ContainerControl.CullChildren
    ContainerControl.IsTouchOver
    Control.Resize(Float2)
    Control.UpdateBounds()
    Control.UpdateTransform()
    Control.SetAnchorPreset(AnchorPresets, Boolean, Boolean)
    Control.Dispose()
    Control.Focus()
    Control.Defocus()
    Control.OnGotFocus()
    Control.OnStartContainsFocus()
    Control.OnEndContainsFocus()
    Control.Focus(Control)
    Control.StartMouseCapture(Boolean)
    Control.EndMouseCapture()
    Control.OnEndMouseCapture()
    Control.GetNavTarget(NavDirection)
    Control.GetNavOrigin(NavDirection)
    Control.NavigationFocus()
    Control.OnSubmit()
    Control.OnTouchLeave()
    Control.DoDragDrop(DragData)
    Control.LinkTooltip(String, Tooltip)
    Control.UnlinkTooltip()
    Control.OnShowTooltip(String, Float2, Rectangle)
    Control.OnTooltipShown(Tooltip)
    Control.OnTestTooltipOverControl(Float2)
    Control.IntersectsContent(Float2, Float2)
    Control.PointToParent(ContainerControl, Float2)
    Control.PointToParent(Float2)
    Control.PointToParent(Float2)
    Control.PointFromParent(Float2)
    Control.PointFromParent(Float2)
    Control.PointFromParent(ContainerControl, Float2)
    Control.PointToWindow(Float2)
    Control.PointFromWindow(Float2)
    Control.PointToScreen(Float2)
    Control.PointFromScreen(Float2)
    Control.OnLocationChanged()
    Control.SetScaleInternal(Float2)
    Control.SetPivotInternal(Float2)
    Control.SetShearInternal(Float2)
    Control.SetRotationInternal(Single)
    Control.OnVisibleChanged()
    Control.OnParentChangedInternal()
    Control.AddUpdateCallbacks(RootControl)
    Control.RemoveUpdateCallbacks(RootControl)
    Control.SetUpdate(Control.UpdateDelegate, Control.UpdateDelegate)
    Control.OnParentResized()
    Control.CompareTo(Object)
    Control.Compare(Control)
    Control.Top
    Control.Bottom
    Control.Left
    Control.Right
    Control.UpperLeft
    Control.UpperRight
    Control.BottomRight
    Control.BottomLeft
    Control.Scale
    Control.Pivot
    Control.Shear
    Control.Rotation
    Control.HasParent
    Control.BackgroundColor
    Control.BackgroundBrush
    Control.Enabled
    Control.EnabledInHierarchy
    Control.Visible
    Control.VisibleInHierarchy
    Control.IsDisposing
    Control.Root
    Control.RootWindow
    Control.DpiScale
    Control.ScreenPos
    Control.AutoFocus
    Control.IsFocused
    Control.IsNavFocused
    Control.IsMouseOver
    Control.IsDragOver
    Control.Tooltip
    Control.ShowTooltip
    Control.EditorBounds
    Control.LocationChanged
    Control.SizeChanged
    Control.ParentChanged
    Control.VisibleChanged
    Namespace: FlaxEditor.Viewport
    Assembly: FlaxEngine.CSharp.dll
    Syntax
    public class EditorViewport : RenderOutputControl, IComparable, IDrawable

    Constructors

    EditorViewport(SceneRenderTask, ViewportCamera, Boolean)

    Initializes a new instance of the EditorViewport class.

    Declaration
    public EditorViewport(SceneRenderTask task, ViewportCamera camera, bool useWidgets)
    Parameters
    SceneRenderTask task

    The task.

    FlaxEditor.Viewport.Cameras.ViewportCamera camera

    The camera controller.

    System.Boolean useWidgets

    Enable/disable viewport widgets.

    Fields

    _cameraButton

    The camera settings widget button.

    Declaration
    protected ViewportWidgetButton _cameraButton
    Field Value
    FlaxEditor.Viewport.Widgets.ViewportWidgetButton

    _cameraWidget

    The camera settings widget.

    Declaration
    protected ViewportWidgetsContainer _cameraWidget
    Field Value
    FlaxEditor.Viewport.Widgets.ViewportWidgetsContainer

    _input

    The input data (from the current frame).

    Declaration
    protected EditorViewport.Input _input
    Field Value
    EditorViewport.Input

    _mouseDelta

    The mouse position delta.

    Declaration
    protected Float2 _mouseDelta
    Field Value
    Float2

    _orthographicModeButton

    The orthographic mode widget button.

    Declaration
    protected ViewportWidgetButton _orthographicModeButton
    Field Value
    FlaxEditor.Viewport.Widgets.ViewportWidgetButton

    _prevInput

    The previous input (from the previous update).

    Declaration
    protected EditorViewport.Input _prevInput
    Field Value
    EditorViewport.Input

    _viewMousePos

    The view mouse position.

    Declaration
    protected Float2 _viewMousePos
    Field Value
    Float2

    FpsCameraFilteringFrames

    The FPS camera filtering frames count (how much frames we want to keep in the buffer to calculate the avg. delta currently hardcoded).

    Declaration
    public const int FpsCameraFilteringFrames = 3
    Field Value
    System.Int32

    InputActions

    The input actions collection to processed during user input.

    Declaration
    public InputActionsContainer InputActions
    Field Value
    InputActionsContainer

    MouseSpeed

    Speed of the mouse.

    Declaration
    public float MouseSpeed
    Field Value
    System.Single

    MouseWheelZoomSpeedFactor

    Speed of the mouse wheel zooming.

    Declaration
    public float MouseWheelZoomSpeedFactor
    Field Value
    System.Single

    ViewWidgetButtonMenu

    The 'View' widget button context menu.

    Declaration
    public ContextMenu ViewWidgetButtonMenu
    Field Value
    FlaxEditor.GUI.ContextMenu.ContextMenu

    ViewWidgetShowMenu

    The 'View' widget 'Show' category context menu.

    Declaration
    public ContextMenu ViewWidgetShowMenu
    Field Value
    FlaxEditor.GUI.ContextMenu.ContextMenu

    Properties

    EulerAngles

    Gets or sets the euler angles (pitch, yaw, roll).

    Declaration
    public Float3 EulerAngles { get; set; }
    Property Value
    Float3

    FarPlane

    Gets or sets the camera far clipping plane.

    Declaration
    public float FarPlane { get; set; }
    Property Value
    System.Single

    FieldOfView

    Gets or sets the camera field of view (in degrees).

    Declaration
    public float FieldOfView { get; set; }
    Property Value
    System.Single

    HasLoadedAssets

    Gets a value indicating whether this viewport has loaded dependant assets.

    Declaration
    public virtual bool HasLoadedAssets { get; }
    Property Value
    System.Boolean

    InvertPanning

    Gets or sets if the panning direction is inverted.

    Declaration
    public bool InvertPanning { get; set; }
    Property Value
    System.Boolean

    IsControllingMouse

    Gets a value indicating whether this viewport is using mouse currently (eg. user moving objects).

    Declaration
    protected virtual bool IsControllingMouse { get; }
    Property Value
    System.Boolean

    MaxMovementSpeed

    Gets or sets the maximum camera movement speed.

    Declaration
    public float MaxMovementSpeed { get; set; }
    Property Value
    System.Single

    MinMovementSpeed

    Gets or sets the minimum camera movement speed.

    Declaration
    public float MinMovementSpeed { get; set; }
    Property Value
    System.Single

    MousePositionDelta

    Gets the mouse movement position delta (user press and move).

    Declaration
    public Float2 MousePositionDelta { get; }
    Property Value
    Float2

    MouseRay

    Gets the mouse ray.

    Declaration
    public Ray MouseRay { get; }
    Property Value
    Ray

    MovementSpeed

    Gets or sets the camera movement speed.

    Declaration
    public float MovementSpeed { get; set; }
    Property Value
    System.Single

    NearPlane

    Gets or sets the camera near clipping plane.

    Declaration
    public float NearPlane { get; set; }
    Property Value
    System.Single

    OrthographicScale

    Gets or sets the camera orthographic size scale (if camera uses orthographic mode).

    Declaration
    public float OrthographicScale { get; set; }
    Property Value
    System.Single

    PanningSpeed

    Gets or sets the camera panning speed.

    Declaration
    public float PanningSpeed { get; set; }
    Property Value
    System.Single

    Pitch

    Gets or sets the pitch angle (in degrees).

    Declaration
    public float Pitch { get; set; }
    Property Value
    System.Single

    RelativePanning

    Gets or sets if the panning speed should be relative to the camera target.

    Declaration
    public bool RelativePanning { get; set; }
    Property Value
    System.Boolean

    ShowFpsCounter

    Gets or sets a value indicating whether show or hide FPS counter.

    Declaration
    public bool ShowFpsCounter { get; set; }
    Property Value
    System.Boolean

    UseCameraEasing

    Gets or sets the camera easing mode.

    Declaration
    public bool UseCameraEasing { get; set; }
    Property Value
    System.Boolean

    UseOrthographicProjection

    Gets or sets the camera orthographic mode (otherwise uses perspective projection).

    Declaration
    public bool UseOrthographicProjection { get; set; }
    Property Value
    System.Boolean

    ViewDirection

    Gets or sets the view direction vector.

    Declaration
    public Float3 ViewDirection { get; set; }
    Property Value
    Float3

    ViewFrustum

    Gets the bounding frustum of the current viewport camera.

    Declaration
    public BoundingFrustum ViewFrustum { get; }
    Property Value
    BoundingFrustum

    ViewOrientation

    Gets or sets the view orientation.

    Declaration
    public Quaternion ViewOrientation { get; set; }
    Property Value
    Quaternion

    ViewportCamera

    Gets or sets the viewport camera controller.

    Declaration
    public ViewportCamera ViewportCamera { get; set; }
    Property Value
    FlaxEditor.Viewport.Cameras.ViewportCamera

    ViewPosition

    Gets or sets the view position.

    Declaration
    public Vector3 ViewPosition { get; set; }
    Property Value
    Vector3

    ViewRay

    Gets or sets the view ray (position and direction).

    Declaration
    public Ray ViewRay { get; set; }
    Property Value
    Ray

    ViewTransform

    Gets the view transform.

    Declaration
    public Transform ViewTransform { get; set; }
    Property Value
    Transform

    Yaw

    Gets or sets the yaw angle (in degrees).

    Declaration
    public float Yaw { get; set; }
    Property Value
    System.Single

    YawPitch

    Gets or sets the absolute mouse position (normalized, not in pixels). Yaw is X, Pitch is Y.

    Declaration
    public Float2 YawPitch { get; set; }
    Property Value
    Float2

    Methods

    AdjustCameraMoveSpeed(Int32)

    Increases or decreases the camera movement speed.

    Declaration
    protected void AdjustCameraMoveSpeed(int step)
    Parameters
    System.Int32 step

    The stepping direction for speed adjustment.

    ConvertMouseToRay(ref Float2)

    Converts the mouse position to the ray (in world space of the viewport).

    Declaration
    public Ray ConvertMouseToRay(ref Float2 mousePosition)
    Parameters
    Float2 mousePosition

    The mouse position (in UI space of the viewport [0; Size]).

    Returns
    Ray

    The result ray.

    CopyViewData(ref RenderView)

    Copies the render view data to RenderView structure.

    Declaration
    public void CopyViewData(ref RenderView view)
    Parameters
    RenderView view

    The view.

    CreateProjectionMatrix(out Matrix)

    Creates the projection matrix.

    Declaration
    protected virtual void CreateProjectionMatrix(out Matrix result)
    Parameters
    Matrix result

    The result.

    CreateViewMatrix(Float3, out Matrix)

    Creates the view matrix.

    Declaration
    protected virtual void CreateViewMatrix(Float3 position, out Matrix result)
    Parameters
    Float3 position

    The view position.

    Matrix result

    The result.

    Draw()

    Declaration
    public override void Draw()
    Overrides
    FlaxEngine.GUI.RenderOutputControl.Draw()

    GetInput(out EditorViewport.Input)

    Gets the input state data.

    Declaration
    public void GetInput(out EditorViewport.Input input)
    Parameters
    EditorViewport.Input input

    The input.

    GetPrevInput(out EditorViewport.Input)

    Gets the input state data (from the previous update).

    Declaration
    public void GetPrevInput(out EditorViewport.Input input)
    Parameters
    EditorViewport.Input input

    The input.

    OnChildResized(Control)

    Called when child control gets resized.

    Declaration
    public override void OnChildResized(Control control)
    Parameters
    Control control

    The resized control.

    Overrides
    ContainerControl.OnChildResized(Control)

    OnControlMouseBegin(Window)

    Called when mouse control begins.

    Declaration
    protected virtual void OnControlMouseBegin(Window win)
    Parameters
    Window win

    The parent window.

    OnControlMouseEnd(Window)

    Called when mouse control ends.

    Declaration
    protected virtual void OnControlMouseEnd(Window win)
    Parameters
    Window win

    The parent window.

    OnDestroy()

    Declaration
    public override void OnDestroy()
    Overrides
    FlaxEngine.GUI.RenderOutputControl.OnDestroy()

    OnKeyDown(KeyboardKeys)

    When key goes down

    Declaration
    public override bool OnKeyDown(KeyboardKeys key)
    Parameters
    KeyboardKeys key

    Key value

    Returns
    System.Boolean

    True if event has been handled, otherwise false

    Overrides
    ContainerControl.OnKeyDown(KeyboardKeys)

    OnLeftMouseButtonDown()

    Called when left mouse button goes down (on press).

    Declaration
    protected virtual void OnLeftMouseButtonDown()

    OnLeftMouseButtonUp()

    Called when left mouse button goes up (on release).

    Declaration
    protected virtual void OnLeftMouseButtonUp()

    OnLostFocus()

    When control losts input focus

    Declaration
    public override void OnLostFocus()
    Overrides
    Control.OnLostFocus()

    OnMiddleMouseButtonDown()

    Called when middle mouse button goes down (on press).

    Declaration
    protected virtual void OnMiddleMouseButtonDown()

    OnMiddleMouseButtonUp()

    Called when middle mouse button goes up (on release).

    Declaration
    protected virtual void OnMiddleMouseButtonUp()

    OnMouseDown(Float2, MouseButton)

    When mouse goes down over control's area

    Declaration
    public override bool OnMouseDown(Float2 location, MouseButton button)
    Parameters
    Float2 location

    Mouse location in Control Space

    MouseButton button

    Mouse buttons state (flags)

    Returns
    System.Boolean

    True if event has been handled, otherwise false

    Overrides
    ContainerControl.OnMouseDown(Float2, MouseButton)

    OnMouseWheel(Float2, Single)

    When mouse wheel moves

    Declaration
    public override bool OnMouseWheel(Float2 location, float delta)
    Parameters
    Float2 location

    Mouse location in Control Space

    System.Single delta

    Mouse wheel move delta. A positive value indicates that the wheel was rotated forward, away from the user; a negative value indicates that the wheel was rotated backward, toward the user. Normalized to [-1;1] range.

    Returns
    System.Boolean

    True if event has been handled

    Overrides
    ContainerControl.OnMouseWheel(Float2, Single)

    OnRightMouseButtonDown()

    Called when right mouse button goes down (on press).

    Declaration
    protected virtual void OnRightMouseButtonDown()

    OnRightMouseButtonUp()

    Called when right mouse button goes up (on release).

    Declaration
    protected virtual void OnRightMouseButtonUp()

    OrientViewport(Quaternion)

    Orients the viewport.

    Declaration
    protected void OrientViewport(Quaternion orientation)
    Parameters
    Quaternion orientation

    The orientation.

    OrientViewport(ref Quaternion)

    Orients the viewport.

    Declaration
    protected virtual void OrientViewport(ref Quaternion orientation)
    Parameters
    Quaternion orientation

    The orientation.

    PerformLayoutBeforeChildren()

    Perform layout for that container control before performing it for child controls.

    Declaration
    protected override void PerformLayoutBeforeChildren()
    Overrides
    ContainerControl.PerformLayoutBeforeChildren()

    ProjectPoint(Vector3, out Float2)

    Projects the point from 3D world-space to viewport coordinates.

    Declaration
    public void ProjectPoint(Vector3 worldSpaceLocation, out Float2 viewportSpaceLocation)
    Parameters
    Vector3 worldSpaceLocation

    The input world-space location (XYZ in world).

    Float2 viewportSpaceLocation

    The output viewport window coordinates (XY in screen pixels).

    TakeScreenshot(String)

    Takes the screenshot of the current viewport.

    Declaration
    public void TakeScreenshot(string path = null)
    Parameters
    System.String path

    The output file path. Set null to use default value.

    Update(Single)

    Perform control update and all its children

    Declaration
    public override void Update(float deltaTime)
    Parameters
    System.Single deltaTime

    Delta time in seconds

    Overrides
    ContainerControl.Update(Single)

    UpdateView(Single, ref Vector3, ref Float2, out Boolean)

    Updates the view.

    Declaration
    protected virtual void UpdateView(float dt, ref Vector3 moveDelta, ref Float2 mouseDelta, out bool centerMouse)
    Parameters
    System.Single dt

    The delta time (in seconds).

    Vector3 moveDelta

    The move delta (scaled).

    Float2 mouseDelta

    The mouse delta (scaled).

    System.Boolean centerMouse

    True if center mouse after the update.

    Extension Methods

    Extensions.ReflectiveCompare<T>(T, T)
    Extensions.RawClone<T>(T)

    See Also

    FlaxEngine.GUI.RenderOutputControl
    In This Article
    Back to top Copyright © 2012-2024 Wojciech Figat