Attention: Here be dragons

This is the latest (unstable) version of this documentation, which may document features not available in or compatible with released stable versions of Godot.

SubViewportContainer

繼承: Container < Control < CanvasItem < Node < Object

用於顯示 SubViewport 內容的容器。

說明

A container that displays the contents of underlying SubViewport child nodes. It uses the combined size of the SubViewports as minimum size, unless stretch is enabled.

Note: Changing a SubViewportContainer's Control.scale will cause its contents to appear distorted. To change its visual size without causing distortion, adjust the node's offset properties instead (if it's not already in a container).

Note: The SubViewportContainer forwards mouse-enter and mouse-exit notifications to its sub-viewports.

屬性

FocusMode

focus_mode

1 (overrides Control)

bool

mouse_target

false

bool

stretch

false

int

stretch_shrink

1

方法

bool

_propagate_input_event(event: InputEvent) virtual const


屬性說明

bool mouse_target = false 🔗

  • void set_mouse_target(value: bool)

  • bool is_mouse_target_enabled()

設定 SubViewportContainer 或其 SubViewport 子節點中的 Control 節點是否應作為滑鼠相關功能的目標,例如在拖放操作中識別放置目標或懸停的 Control 節點的游標形狀。

如果為 false,則視其 SubViewport 子節點中的 Control 節點為目標。

如果為 true,則視 SubViewportContainer 本身為目標。


bool stretch = false 🔗

  • void set_stretch(value: bool)

  • bool is_stretch_enabled()

如果為 true,子視埠將自動調整為該控制項的大小。

注意:如果為 true,則會禁止手動改變其子節點的 SubViewport.size。


int stretch_shrink = 1 🔗

  • void set_stretch_shrink(value: int)

  • int get_stretch_shrink()

將子視埠的有效解析度除以該值,同時保持比例。可以用來加速渲染。

例如子視埠的大小為 1280×720,當 stretch_shrink 被設定為 2 時,將以 640×360 渲染,同時在該容器中佔據相同大小。

注意:stretch 必須為 true,才能使此屬性生效。


方法說明

bool _propagate_input_event(event: InputEvent) virtual const 🔗

實驗性: 此方法可能在未來版本中變更或移除。

由使用者實作的虛方法。如果它回傳 true,則 event 將被傳播到 SubViewport 子級。如果回傳 false,則傳播不會發生。如果未實作該功能,則所有事件都會被傳播到子視埠。