mirror of
https://github.com/godotengine/godot-docs.git
synced 2025-12-31 17:49:03 +03:00
258 lines
9.9 KiB
ReStructuredText
258 lines
9.9 KiB
ReStructuredText
:github_url: hide
|
|
|
|
.. DO NOT EDIT THIS FILE!!!
|
|
.. Generated automatically from Godot engine sources.
|
|
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
|
|
.. XML source: https://github.com/godotengine/godot/tree/master/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 Viewport Demo <https://godotengine.org/asset-library/asset/2807>`__
|
|
|
|
- `3D in 2D Viewport Demo <https://godotengine.org/asset-library/asset/2804>`__
|
|
|
|
- `2D in 3D Viewport Demo <https://godotengine.org/asset-library/asset/2803>`__
|
|
|
|
- `Screen Capture Demo <https://godotengine.org/asset-library/asset/2808>`__
|
|
|
|
- `Dynamic Split Screen Demo <https://godotengine.org/asset-library/asset/2806>`__
|
|
|
|
- `3D Resolution Scaling Demo <https://godotengine.org/asset-library/asset/2805>`__
|
|
|
|
.. 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**: :ref:`🔗<enum_SubViewport_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**: :ref:`🔗<enum_SubViewport_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`` :ref:`🔗<class_SubViewport_property_render_target_clear_mode>`
|
|
|
|
.. rst-class:: classref-property-setget
|
|
|
|
- |void| **set_clear_mode**\ (\ value\: :ref:`ClearMode<enum_SubViewport_ClearMode>`\ )
|
|
- :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`` :ref:`🔗<class_SubViewport_property_render_target_update_mode>`
|
|
|
|
.. rst-class:: classref-property-setget
|
|
|
|
- |void| **set_update_mode**\ (\ value\: :ref:`UpdateMode<enum_SubViewport_UpdateMode>`\ )
|
|
- :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)`` :ref:`🔗<class_SubViewport_property_size>`
|
|
|
|
.. rst-class:: classref-property-setget
|
|
|
|
- |void| **set_size**\ (\ value\: :ref:`Vector2i<class_Vector2i>`\ )
|
|
- :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)`` :ref:`🔗<class_SubViewport_property_size_2d_override>`
|
|
|
|
.. rst-class:: classref-property-setget
|
|
|
|
- |void| **set_size_2d_override**\ (\ value\: :ref:`Vector2i<class_Vector2i>`\ )
|
|
- :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`` :ref:`🔗<class_SubViewport_property_size_2d_override_stretch>`
|
|
|
|
.. rst-class:: classref-property-setget
|
|
|
|
- |void| **set_size_2d_override_stretch**\ (\ value\: :ref:`bool<class_bool>`\ )
|
|
- :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.)`
|
|
.. |void| replace:: :abbr:`void (No return value.)`
|