Inheritance #

SubViewport
Table of contents

SubViewport #

is_instantiable, Node, core, not_builtin_classes

An interface to a game world that doesn't create a window or draw to the screen directly.

SubViewport Isolates a rectangular region of a scene to be displayed independently. This can be used, for example, to display UI in 3D space.

Note: SubViewport is a Viewport that isn't a Window, i.e. it doesn't draw anything by itself. To display anything, SubViewport must have a non-zero size and be either put inside a SubViewportContainer or assigned to a ViewportTexture.

Note: InputEvents are not passed to a standalone SubViewport by default. To ensure InputEvent propagation, a SubViewport can be placed inside of a SubViewportContainer.

Members #

var render_target_clear_mode = CLEAR_MODE_ALWAYS#

The clear mode when the sub-viewport is used as a render target.

Note: This property is intended for 2D usage.

var render_target_update_mode = UPDATE_WHEN_VISIBLE#

The update mode when the sub-viewport is used as a render target.

var size: Vector2i = Vector2i(512, 512)#

The width and height of the sub-viewport. Must be set to a value greater than or equal to 2 pixels on both dimensions. Otherwise, nothing will be displayed.

Note: If the parent node is a SubViewportContainer and its SubViewportContainer.stretch is true, the viewport size cannot be changed manually.

var size_2d_override: Vector2i = Vector2i(0, 0)#

The 2D size override of the sub-viewport. If either the width or height is 0, the override is disabled.

var size_2d_override_stretch: bool = false#

If true, the 2D size override affects stretch as well.

Methods #

Annotations #

Constants #

const CLEAR_MODE_ALWAYS = 0 enum ClearMode#

Always clear the render target before drawing.

const CLEAR_MODE_NEVER = 1 enum ClearMode#

Never clear the render target.

const CLEAR_MODE_ONCE = 2 enum ClearMode#

Clear the render target on the next frame, then switch to CLEAR_MODE_NEVER.

const UPDATE_DISABLED = 0 enum UpdateMode#

Do not update the render target.

const UPDATE_ONCE = 1 enum UpdateMode#

Update the render target once, then switch to UPDATE_DISABLED.

const UPDATE_WHEN_VISIBLE = 2 enum UpdateMode#

Update the render target only when it is visible. This is the default value.

const UPDATE_WHEN_PARENT_VISIBLE = 3 enum UpdateMode#

Update the render target only when its parent is visible.

const UPDATE_ALWAYS = 4 enum UpdateMode#

Always update the render target.

Constructors #

Enums #

ClearMode#

enum ClearMode { CLEAR_MODE_ALWAYS = 0, CLEAR_MODE_NEVER = 1, CLEAR_MODE_ONCE = 2, }

UpdateMode#

enum UpdateMode { UPDATE_DISABLED = 0, UPDATE_ONCE = 1, UPDATE_WHEN_VISIBLE = 2, UPDATE_WHEN_PARENT_VISIBLE = 3, UPDATE_ALWAYS = 4, }

Operators #

Signals #

Theme Items #

Tutorials #