123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257 |
- :github_url: hide
- .. DO NOT EDIT THIS FILE!!!
- .. Generated automatically from Godot engine sources.
- .. Generator: https://github.com/godotengine/godot/tree/4.2/doc/tools/make_rst.py.
- .. XML source: https://github.com/godotengine/godot/tree/4.2/doc/classes/SubViewport.xml.
- .. _class_SubViewport:
- SubViewport
- ===========
- **Inherits:** :ref:`Viewport<class_Viewport>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
- An interface to a game world that doesn't create a window or draw to the screen directly.
- .. rst-class:: classref-introduction-group
- Description
- -----------
- **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 :ref:`Viewport<class_Viewport>` that isn't a :ref:`Window<class_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 :ref:`SubViewportContainer<class_SubViewportContainer>` or assigned to a :ref:`ViewportTexture<class_ViewportTexture>`.
- .. rst-class:: classref-introduction-group
- Tutorials
- ---------
- - :doc:`Using Viewports <../tutorials/rendering/viewports>`
- - :doc:`Viewport and canvas transforms <../tutorials/2d/2d_transforms>`
- - `GUI in 3D Demo <https://godotengine.org/asset-library/asset/127>`__
- - `3D in 2D Demo <https://godotengine.org/asset-library/asset/128>`__
- - `2D in 3D Demo <https://godotengine.org/asset-library/asset/129>`__
- - `Screen Capture Demo <https://godotengine.org/asset-library/asset/130>`__
- - `Dynamic Split Screen Demo <https://godotengine.org/asset-library/asset/541>`__
- - `3D Viewport Scaling Demo <https://godotengine.org/asset-library/asset/586>`__
- .. rst-class:: classref-reftable-group
- Properties
- ----------
- .. table::
- :widths: auto
- +------------------------------------------------+----------------------------------------------------------------------------------------+------------------------+
- | :ref:`ClearMode<enum_SubViewport_ClearMode>` | :ref:`render_target_clear_mode<class_SubViewport_property_render_target_clear_mode>` | ``0`` |
- +------------------------------------------------+----------------------------------------------------------------------------------------+------------------------+
- | :ref:`UpdateMode<enum_SubViewport_UpdateMode>` | :ref:`render_target_update_mode<class_SubViewport_property_render_target_update_mode>` | ``2`` |
- +------------------------------------------------+----------------------------------------------------------------------------------------+------------------------+
- | :ref:`Vector2i<class_Vector2i>` | :ref:`size<class_SubViewport_property_size>` | ``Vector2i(512, 512)`` |
- +------------------------------------------------+----------------------------------------------------------------------------------------+------------------------+
- | :ref:`Vector2i<class_Vector2i>` | :ref:`size_2d_override<class_SubViewport_property_size_2d_override>` | ``Vector2i(0, 0)`` |
- +------------------------------------------------+----------------------------------------------------------------------------------------+------------------------+
- | :ref:`bool<class_bool>` | :ref:`size_2d_override_stretch<class_SubViewport_property_size_2d_override_stretch>` | ``false`` |
- +------------------------------------------------+----------------------------------------------------------------------------------------+------------------------+
- .. rst-class:: classref-section-separator
- ----
- .. rst-class:: classref-descriptions-group
- Enumerations
- ------------
- .. _enum_SubViewport_ClearMode:
- .. rst-class:: classref-enumeration
- enum **ClearMode**:
- .. _class_SubViewport_constant_CLEAR_MODE_ALWAYS:
- .. rst-class:: classref-enumeration-constant
- :ref:`ClearMode<enum_SubViewport_ClearMode>` **CLEAR_MODE_ALWAYS** = ``0``
- Always clear the render target before drawing.
- .. _class_SubViewport_constant_CLEAR_MODE_NEVER:
- .. rst-class:: classref-enumeration-constant
- :ref:`ClearMode<enum_SubViewport_ClearMode>` **CLEAR_MODE_NEVER** = ``1``
- Never clear the render target.
- .. _class_SubViewport_constant_CLEAR_MODE_ONCE:
- .. rst-class:: classref-enumeration-constant
- :ref:`ClearMode<enum_SubViewport_ClearMode>` **CLEAR_MODE_ONCE** = ``2``
- Clear the render target on the next frame, then switch to :ref:`CLEAR_MODE_NEVER<class_SubViewport_constant_CLEAR_MODE_NEVER>`.
- .. rst-class:: classref-item-separator
- ----
- .. _enum_SubViewport_UpdateMode:
- .. rst-class:: classref-enumeration
- enum **UpdateMode**:
- .. _class_SubViewport_constant_UPDATE_DISABLED:
- .. rst-class:: classref-enumeration-constant
- :ref:`UpdateMode<enum_SubViewport_UpdateMode>` **UPDATE_DISABLED** = ``0``
- Do not update the render target.
- .. _class_SubViewport_constant_UPDATE_ONCE:
- .. rst-class:: classref-enumeration-constant
- :ref:`UpdateMode<enum_SubViewport_UpdateMode>` **UPDATE_ONCE** = ``1``
- Update the render target once, then switch to :ref:`UPDATE_DISABLED<class_SubViewport_constant_UPDATE_DISABLED>`.
- .. _class_SubViewport_constant_UPDATE_WHEN_VISIBLE:
- .. rst-class:: classref-enumeration-constant
- :ref:`UpdateMode<enum_SubViewport_UpdateMode>` **UPDATE_WHEN_VISIBLE** = ``2``
- Update the render target only when it is visible. This is the default value.
- .. _class_SubViewport_constant_UPDATE_WHEN_PARENT_VISIBLE:
- .. rst-class:: classref-enumeration-constant
- :ref:`UpdateMode<enum_SubViewport_UpdateMode>` **UPDATE_WHEN_PARENT_VISIBLE** = ``3``
- Update the render target only when its parent is visible.
- .. _class_SubViewport_constant_UPDATE_ALWAYS:
- .. rst-class:: classref-enumeration-constant
- :ref:`UpdateMode<enum_SubViewport_UpdateMode>` **UPDATE_ALWAYS** = ``4``
- Always update the render target.
- .. rst-class:: classref-section-separator
- ----
- .. rst-class:: classref-descriptions-group
- Property Descriptions
- ---------------------
- .. _class_SubViewport_property_render_target_clear_mode:
- .. rst-class:: classref-property
- :ref:`ClearMode<enum_SubViewport_ClearMode>` **render_target_clear_mode** = ``0``
- .. rst-class:: classref-property-setget
- - void **set_clear_mode** **(** :ref:`ClearMode<enum_SubViewport_ClearMode>` value **)**
- - :ref:`ClearMode<enum_SubViewport_ClearMode>` **get_clear_mode** **(** **)**
- The clear mode when the sub-viewport is used as a render target.
- \ **Note:** This property is intended for 2D usage.
- .. rst-class:: classref-item-separator
- ----
- .. _class_SubViewport_property_render_target_update_mode:
- .. rst-class:: classref-property
- :ref:`UpdateMode<enum_SubViewport_UpdateMode>` **render_target_update_mode** = ``2``
- .. rst-class:: classref-property-setget
- - void **set_update_mode** **(** :ref:`UpdateMode<enum_SubViewport_UpdateMode>` value **)**
- - :ref:`UpdateMode<enum_SubViewport_UpdateMode>` **get_update_mode** **(** **)**
- The update mode when the sub-viewport is used as a render target.
- .. rst-class:: classref-item-separator
- ----
- .. _class_SubViewport_property_size:
- .. rst-class:: classref-property
- :ref:`Vector2i<class_Vector2i>` **size** = ``Vector2i(512, 512)``
- .. rst-class:: classref-property-setget
- - void **set_size** **(** :ref:`Vector2i<class_Vector2i>` value **)**
- - :ref:`Vector2i<class_Vector2i>` **get_size** **(** **)**
- 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 :ref:`SubViewportContainer<class_SubViewportContainer>` and its :ref:`SubViewportContainer.stretch<class_SubViewportContainer_property_stretch>` is ``true``, the viewport size cannot be changed manually.
- .. rst-class:: classref-item-separator
- ----
- .. _class_SubViewport_property_size_2d_override:
- .. rst-class:: classref-property
- :ref:`Vector2i<class_Vector2i>` **size_2d_override** = ``Vector2i(0, 0)``
- .. rst-class:: classref-property-setget
- - void **set_size_2d_override** **(** :ref:`Vector2i<class_Vector2i>` value **)**
- - :ref:`Vector2i<class_Vector2i>` **get_size_2d_override** **(** **)**
- The 2D size override of the sub-viewport. If either the width or height is ``0``, the override is disabled.
- .. rst-class:: classref-item-separator
- ----
- .. _class_SubViewport_property_size_2d_override_stretch:
- .. rst-class:: classref-property
- :ref:`bool<class_bool>` **size_2d_override_stretch** = ``false``
- .. rst-class:: classref-property-setget
- - void **set_size_2d_override_stretch** **(** :ref:`bool<class_bool>` value **)**
- - :ref:`bool<class_bool>` **is_size_2d_override_stretch_enabled** **(** **)**
- If ``true``, the 2D size override affects stretch as well.
- .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
- .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
- .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
- .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
- .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
- .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
- .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`
|