SubViewport

Inherits: Viewport < Node < Object

Creates a sub-view into the screen.

Enumerations

enum ClearMode:

  • CLEAR_MODE_ALWAYS = 0 --- Always clear the render target before drawing.

  • CLEAR_MODE_NEVER = 1 --- Never clear the render target.

  • CLEAR_MODE_ONCE = 2 --- Clear the render target on the next frame, then switch to CLEAR_MODE_NEVER.


enum UpdateMode:

  • UPDATE_DISABLED = 0 --- Do not update the render target.

  • UPDATE_ONCE = 1 --- Update the render target once, then switch to UPDATE_DISABLED.

  • UPDATE_WHEN_VISIBLE = 2 --- Update the render target only when it is visible. This is the default value.

  • UPDATE_WHEN_PARENT_VISIBLE = 3 --- Update the render target only when its parent is visible.

  • UPDATE_ALWAYS = 4 --- Always update the render target.

Property Descriptions

Default

0

Setter

set_clear_mode(value)

Getter

get_clear_mode()

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

Note: This property is intended for 2D usage.


Default

2

Setter

set_update_mode(value)

Getter

get_update_mode()

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


Default

Vector2i(512, 512)

Setter

set_size(value)

Getter

get_size()

The width and height of the sub-viewport.


Default

Vector2i(0, 0)

Setter

set_size_2d_override(value)

Getter

get_size_2d_override()

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


  • bool size_2d_override_stretch

Default

false

Setter

set_size_2d_override_stretch(value)

Getter

is_size_2d_override_stretch_enabled()

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