mirror of
https://github.com/godotengine/godot-docs.git
synced 2026-01-03 05:48:42 +03:00
580 lines
47 KiB
ReStructuredText
580 lines
47 KiB
ReStructuredText
.. Generated automatically by doc/tools/makerst.py in Godot's source tree.
|
|
.. DO NOT EDIT THIS FILE, but the doc/base/classes.xml source instead.
|
|
|
|
.. _class_Viewport:
|
|
|
|
Viewport
|
|
========
|
|
|
|
**Inherits:** :ref:`Node<class_node>` **<** :ref:`Object<class_object>`
|
|
|
|
**Category:** Core
|
|
|
|
Brief Description
|
|
-----------------
|
|
|
|
Creates a sub-view into the screen.
|
|
|
|
Member Functions
|
|
----------------
|
|
|
|
+------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| void | :ref:`clear<class_Viewport_clear>` **(** **)** |
|
|
+------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`World<class_world>` | :ref:`find_world<class_Viewport_find_world>` **(** **)** const |
|
|
+------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`World2D<class_world2d>` | :ref:`find_world_2d<class_Viewport_find_world_2d>` **(** **)** const |
|
|
+------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`Camera<class_camera>` | :ref:`get_camera<class_Viewport_get_camera>` **(** **)** const |
|
|
+------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`Transform2D<class_transform2d>` | :ref:`get_canvas_transform<class_Viewport_get_canvas_transform>` **(** **)** const |
|
|
+------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`bool<class_bool>` | :ref:`get_clear_on_new_frame<class_Viewport_get_clear_on_new_frame>` **(** **)** const |
|
|
+------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`int<class_int>` | :ref:`get_debug_draw<class_Viewport_get_debug_draw>` **(** **)** const |
|
|
+------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`Transform2D<class_transform2d>` | :ref:`get_final_transform<class_Viewport_get_final_transform>` **(** **)** const |
|
|
+------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`Transform2D<class_transform2d>` | :ref:`get_global_canvas_transform<class_Viewport_get_global_canvas_transform>` **(** **)** const |
|
|
+------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`bool<class_bool>` | :ref:`get_hdr<class_Viewport_get_hdr>` **(** **)** const |
|
|
+------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`Vector2<class_vector2>` | :ref:`get_mouse_position<class_Viewport_get_mouse_position>` **(** **)** const |
|
|
+------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`int<class_int>` | :ref:`get_msaa<class_Viewport_get_msaa>` **(** **)** const |
|
|
+------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`bool<class_bool>` | :ref:`get_physics_object_picking<class_Viewport_get_physics_object_picking>` **(** **)** |
|
|
+------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`int<class_int>` | :ref:`get_render_info<class_Viewport_get_render_info>` **(** :ref:`int<class_int>` info **)** |
|
|
+------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`int<class_int>` | :ref:`get_shadow_atlas_quadrant_subdiv<class_Viewport_get_shadow_atlas_quadrant_subdiv>` **(** :ref:`int<class_int>` quadrant **)** const |
|
|
+------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`int<class_int>` | :ref:`get_shadow_atlas_size<class_Viewport_get_shadow_atlas_size>` **(** **)** const |
|
|
+------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`Vector2<class_vector2>` | :ref:`get_size<class_Viewport_get_size>` **(** **)** const |
|
|
+------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`Vector2<class_vector2>` | :ref:`get_size_override<class_Viewport_get_size_override>` **(** **)** const |
|
|
+------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`ViewportTexture<class_viewporttexture>` | :ref:`get_texture<class_Viewport_get_texture>` **(** **)** const |
|
|
+------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`int<class_int>` | :ref:`get_update_mode<class_Viewport_get_update_mode>` **(** **)** const |
|
|
+------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`int<class_int>` | :ref:`get_usage<class_Viewport_get_usage>` **(** **)** const |
|
|
+------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`bool<class_bool>` | :ref:`get_vflip<class_Viewport_get_vflip>` **(** **)** const |
|
|
+------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`RID<class_rid>` | :ref:`get_viewport_rid<class_Viewport_get_viewport_rid>` **(** **)** const |
|
|
+------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`Rect2<class_rect2>` | :ref:`get_visible_rect<class_Viewport_get_visible_rect>` **(** **)** const |
|
|
+------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`World<class_world>` | :ref:`get_world<class_Viewport_get_world>` **(** **)** const |
|
|
+------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`World2D<class_world2d>` | :ref:`get_world_2d<class_Viewport_get_world_2d>` **(** **)** const |
|
|
+------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`Variant<class_variant>` | :ref:`gui_get_drag_data<class_Viewport_gui_get_drag_data>` **(** **)** const |
|
|
+------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`bool<class_bool>` | :ref:`gui_has_modal_stack<class_Viewport_gui_has_modal_stack>` **(** **)** const |
|
|
+------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`bool<class_bool>` | :ref:`has_transparent_background<class_Viewport_has_transparent_background>` **(** **)** const |
|
|
+------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| void | :ref:`input<class_Viewport_input>` **(** :ref:`Object<class_object>` local_event **)** |
|
|
+------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`bool<class_bool>` | :ref:`is_3d_disabled<class_Viewport_is_3d_disabled>` **(** **)** const |
|
|
+------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`bool<class_bool>` | :ref:`is_audio_listener<class_Viewport_is_audio_listener>` **(** **)** const |
|
|
+------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`bool<class_bool>` | :ref:`is_audio_listener_2d<class_Viewport_is_audio_listener_2d>` **(** **)** const |
|
|
+------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`bool<class_bool>` | :ref:`is_input_disabled<class_Viewport_is_input_disabled>` **(** **)** const |
|
|
+------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`bool<class_bool>` | :ref:`is_size_override_enabled<class_Viewport_is_size_override_enabled>` **(** **)** const |
|
|
+------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`bool<class_bool>` | :ref:`is_size_override_stretch_enabled<class_Viewport_is_size_override_stretch_enabled>` **(** **)** const |
|
|
+------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`bool<class_bool>` | :ref:`is_using_own_world<class_Viewport_is_using_own_world>` **(** **)** const |
|
|
+------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| void | :ref:`set_as_audio_listener<class_Viewport_set_as_audio_listener>` **(** :ref:`bool<class_bool>` enable **)** |
|
|
+------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| void | :ref:`set_as_audio_listener_2d<class_Viewport_set_as_audio_listener_2d>` **(** :ref:`bool<class_bool>` enable **)** |
|
|
+------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| void | :ref:`set_attach_to_screen_rect<class_Viewport_set_attach_to_screen_rect>` **(** :ref:`Rect2<class_rect2>` rect **)** |
|
|
+------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| void | :ref:`set_canvas_transform<class_Viewport_set_canvas_transform>` **(** :ref:`Transform2D<class_transform2d>` xform **)** |
|
|
+------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| void | :ref:`set_clear_on_new_frame<class_Viewport_set_clear_on_new_frame>` **(** :ref:`bool<class_bool>` enable **)** |
|
|
+------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| void | :ref:`set_debug_draw<class_Viewport_set_debug_draw>` **(** :ref:`int<class_int>` debug_draw **)** |
|
|
+------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| void | :ref:`set_disable_3d<class_Viewport_set_disable_3d>` **(** :ref:`bool<class_bool>` disable **)** |
|
|
+------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| void | :ref:`set_disable_input<class_Viewport_set_disable_input>` **(** :ref:`bool<class_bool>` disable **)** |
|
|
+------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| void | :ref:`set_global_canvas_transform<class_Viewport_set_global_canvas_transform>` **(** :ref:`Transform2D<class_transform2d>` xform **)** |
|
|
+------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| void | :ref:`set_hdr<class_Viewport_set_hdr>` **(** :ref:`bool<class_bool>` enable **)** |
|
|
+------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| void | :ref:`set_msaa<class_Viewport_set_msaa>` **(** :ref:`int<class_int>` msaa **)** |
|
|
+------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| void | :ref:`set_physics_object_picking<class_Viewport_set_physics_object_picking>` **(** :ref:`bool<class_bool>` enable **)** |
|
|
+------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| void | :ref:`set_shadow_atlas_quadrant_subdiv<class_Viewport_set_shadow_atlas_quadrant_subdiv>` **(** :ref:`int<class_int>` quadrant, :ref:`int<class_int>` subdiv **)** |
|
|
+------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| void | :ref:`set_shadow_atlas_size<class_Viewport_set_shadow_atlas_size>` **(** :ref:`int<class_int>` size **)** |
|
|
+------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| void | :ref:`set_size<class_Viewport_set_size>` **(** :ref:`Vector2<class_vector2>` size **)** |
|
|
+------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| void | :ref:`set_size_override<class_Viewport_set_size_override>` **(** :ref:`bool<class_bool>` enable, :ref:`Vector2<class_vector2>` size=Vector2(-1, -1), :ref:`Vector2<class_vector2>` margin=Vector2(0, 0) **)** |
|
|
+------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| void | :ref:`set_size_override_stretch<class_Viewport_set_size_override_stretch>` **(** :ref:`bool<class_bool>` enabled **)** |
|
|
+------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| void | :ref:`set_transparent_background<class_Viewport_set_transparent_background>` **(** :ref:`bool<class_bool>` enable **)** |
|
|
+------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| void | :ref:`set_update_mode<class_Viewport_set_update_mode>` **(** :ref:`int<class_int>` mode **)** |
|
|
+------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| void | :ref:`set_usage<class_Viewport_set_usage>` **(** :ref:`int<class_int>` usage **)** |
|
|
+------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| void | :ref:`set_use_own_world<class_Viewport_set_use_own_world>` **(** :ref:`bool<class_bool>` enable **)** |
|
|
+------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| void | :ref:`set_vflip<class_Viewport_set_vflip>` **(** :ref:`bool<class_bool>` enable **)** |
|
|
+------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| void | :ref:`set_world<class_Viewport_set_world>` **(** :ref:`World<class_world>` world **)** |
|
|
+------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| void | :ref:`set_world_2d<class_Viewport_set_world_2d>` **(** :ref:`World2D<class_world2d>` world_2d **)** |
|
|
+------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| void | :ref:`unhandled_input<class_Viewport_unhandled_input>` **(** :ref:`Object<class_object>` local_event **)** |
|
|
+------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| void | :ref:`update_worlds<class_Viewport_update_worlds>` **(** **)** |
|
|
+------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| void | :ref:`warp_mouse<class_Viewport_warp_mouse>` **(** :ref:`Vector2<class_vector2>` to_pos **)** |
|
|
+------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
|
|
Signals
|
|
-------
|
|
|
|
- **size_changed** **(** **)**
|
|
Emitted when the size of the viewport is changed, whether by :ref:`set_size_override<class_Viewport_set_size_override>`, resize of window, or some other means.
|
|
|
|
|
|
Member Variables
|
|
----------------
|
|
|
|
- :ref:`bool<class_bool>` **audio_listener_enable_2d**
|
|
- :ref:`bool<class_bool>` **audio_listener_enable_3d**
|
|
- :ref:`int<class_int>` **debug_draw**
|
|
- :ref:`bool<class_bool>` **disable_3d**
|
|
- :ref:`bool<class_bool>` **gui_disable_input**
|
|
- :ref:`bool<class_bool>` **hdr**
|
|
- :ref:`int<class_int>` **msaa**
|
|
- :ref:`bool<class_bool>` **own_world**
|
|
- :ref:`bool<class_bool>` **physics_object_picking**
|
|
- :ref:`bool<class_bool>` **render_target_clear_on_new_frame**
|
|
- :ref:`int<class_int>` **render_target_update_mode**
|
|
- :ref:`bool<class_bool>` **render_target_v_flip**
|
|
- :ref:`int<class_int>` **shadow_atlas_quad_0**
|
|
- :ref:`int<class_int>` **shadow_atlas_quad_1**
|
|
- :ref:`int<class_int>` **shadow_atlas_quad_2**
|
|
- :ref:`int<class_int>` **shadow_atlas_quad_3**
|
|
- :ref:`int<class_int>` **shadow_atlas_size**
|
|
- :ref:`Rect2<class_rect2>` **size**
|
|
- :ref:`bool<class_bool>` **transparent_bg**
|
|
- :ref:`int<class_int>` **usage**
|
|
- :ref:`World<class_world>` **world**
|
|
|
|
Numeric Constants
|
|
-----------------
|
|
|
|
- **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_ALWAYS** = **3**
|
|
- **SHADOW_ATLAS_QUADRANT_SUBDIV_DISABLED** = **0**
|
|
- **SHADOW_ATLAS_QUADRANT_SUBDIV_1** = **1**
|
|
- **SHADOW_ATLAS_QUADRANT_SUBDIV_4** = **2**
|
|
- **SHADOW_ATLAS_QUADRANT_SUBDIV_16** = **3**
|
|
- **SHADOW_ATLAS_QUADRANT_SUBDIV_64** = **4**
|
|
- **SHADOW_ATLAS_QUADRANT_SUBDIV_256** = **5**
|
|
- **SHADOW_ATLAS_QUADRANT_SUBDIV_1024** = **6**
|
|
- **SHADOW_ATLAS_QUADRANT_SUBDIV_MAX** = **7**
|
|
- **RENDER_INFO_OBJECTS_IN_FRAME** = **0**
|
|
- **RENDER_INFO_VERTICES_IN_FRAME** = **1**
|
|
- **RENDER_INFO_MATERIAL_CHANGES_IN_FRAME** = **2**
|
|
- **RENDER_INFO_SHADER_CHANGES_IN_FRAME** = **3**
|
|
- **RENDER_INFO_SURFACE_CHANGES_IN_FRAME** = **4**
|
|
- **RENDER_INFO_DRAW_CALLS_IN_FRAME** = **5**
|
|
- **RENDER_INFO_MAX** = **6**
|
|
- **DEBUG_DRAW_DISABLED** = **0**
|
|
- **DEBUG_DRAW_UNSHADED** = **1**
|
|
- **DEBUG_DRAW_OVERDRAW** = **2**
|
|
- **DEBUG_DRAW_WIREFRAME** = **3**
|
|
- **MSAA_DISABLED** = **0**
|
|
- **MSAA_2X** = **1**
|
|
- **MSAA_4X** = **2**
|
|
- **MSAA_8X** = **3**
|
|
- **MSAA_16X** = **4**
|
|
|
|
Description
|
|
-----------
|
|
|
|
A Viewport creates a different view into the screen, or a sub-view inside another viewport. Children 2D Nodes will display on it, and children Camera 3D nodes will render on it too.
|
|
|
|
Optionally, a viewport can have its own 2D or 3D world, so they don't share what they draw with other viewports.
|
|
|
|
If a viewport is a child of a :ref:`Control<class_control>`, it will automatically take up its same rect and position, otherwise they must be set manually.
|
|
|
|
Viewports can also choose to be audio listeners, so they generate positional audio depending on a 2D or 3D camera child of it.
|
|
|
|
Also, viewports can be assigned to different screens in case the devices have multiple screens.
|
|
|
|
Finally, viewports can also behave as render targets, in which case they will not be visible unless the associated texture is used to draw.
|
|
|
|
Member Function Description
|
|
---------------------------
|
|
|
|
.. _class_Viewport_clear:
|
|
|
|
- void **clear** **(** **)**
|
|
|
|
Clear the viewport manually.
|
|
|
|
.. _class_Viewport_find_world:
|
|
|
|
- :ref:`World<class_world>` **find_world** **(** **)** const
|
|
|
|
Return the 3D world of the viewport, or if no such present, the one of the parent viewport.
|
|
|
|
.. _class_Viewport_find_world_2d:
|
|
|
|
- :ref:`World2D<class_world2d>` **find_world_2d** **(** **)** const
|
|
|
|
Return the 2D world of the viewport.
|
|
|
|
.. _class_Viewport_get_camera:
|
|
|
|
- :ref:`Camera<class_camera>` **get_camera** **(** **)** const
|
|
|
|
Return the active 3D camera.
|
|
|
|
.. _class_Viewport_get_canvas_transform:
|
|
|
|
- :ref:`Transform2D<class_transform2d>` **get_canvas_transform** **(** **)** const
|
|
|
|
Get the canvas transform of the viewport.
|
|
|
|
.. _class_Viewport_get_clear_on_new_frame:
|
|
|
|
- :ref:`bool<class_bool>` **get_clear_on_new_frame** **(** **)** const
|
|
|
|
Return whether automatic clearing of the render target on each frame is enabled.
|
|
|
|
.. _class_Viewport_get_debug_draw:
|
|
|
|
- :ref:`int<class_int>` **get_debug_draw** **(** **)** const
|
|
|
|
.. _class_Viewport_get_final_transform:
|
|
|
|
- :ref:`Transform2D<class_transform2d>` **get_final_transform** **(** **)** const
|
|
|
|
Get the total transform of the viewport.
|
|
|
|
.. _class_Viewport_get_global_canvas_transform:
|
|
|
|
- :ref:`Transform2D<class_transform2d>` **get_global_canvas_transform** **(** **)** const
|
|
|
|
Get the global canvas transform of the viewport.
|
|
|
|
.. _class_Viewport_get_hdr:
|
|
|
|
- :ref:`bool<class_bool>` **get_hdr** **(** **)** const
|
|
|
|
Get whether the rendered texture has filters enabled.
|
|
|
|
.. _class_Viewport_get_mouse_position:
|
|
|
|
- :ref:`Vector2<class_vector2>` **get_mouse_position** **(** **)** const
|
|
|
|
Get the mouse position, relative to the viewport.
|
|
|
|
.. _class_Viewport_get_msaa:
|
|
|
|
- :ref:`int<class_int>` **get_msaa** **(** **)** const
|
|
|
|
.. _class_Viewport_get_physics_object_picking:
|
|
|
|
- :ref:`bool<class_bool>` **get_physics_object_picking** **(** **)**
|
|
|
|
Get whether picking for all physics objects inside the viewport is enabled.
|
|
|
|
.. _class_Viewport_get_render_info:
|
|
|
|
- :ref:`int<class_int>` **get_render_info** **(** :ref:`int<class_int>` info **)**
|
|
|
|
.. _class_Viewport_get_shadow_atlas_quadrant_subdiv:
|
|
|
|
- :ref:`int<class_int>` **get_shadow_atlas_quadrant_subdiv** **(** :ref:`int<class_int>` quadrant **)** const
|
|
|
|
.. _class_Viewport_get_shadow_atlas_size:
|
|
|
|
- :ref:`int<class_int>` **get_shadow_atlas_size** **(** **)** const
|
|
|
|
.. _class_Viewport_get_size:
|
|
|
|
- :ref:`Vector2<class_vector2>` **get_size** **(** **)** const
|
|
|
|
Return the viewport rect. If the viewport is child of a control, it will use the same rect as the parent. Otherwise, if the rect is empty, the viewport will use all the allowed space.
|
|
|
|
.. _class_Viewport_get_size_override:
|
|
|
|
- :ref:`Vector2<class_vector2>` **get_size_override** **(** **)** const
|
|
|
|
Get the size override set with :ref:`set_size_override<class_Viewport_set_size_override>`.
|
|
|
|
.. _class_Viewport_get_texture:
|
|
|
|
- :ref:`ViewportTexture<class_viewporttexture>` **get_texture** **(** **)** const
|
|
|
|
Get the viewport's texture, for use with various objects that you want to texture with the viewport.
|
|
|
|
.. _class_Viewport_get_update_mode:
|
|
|
|
- :ref:`int<class_int>` **get_update_mode** **(** **)** const
|
|
|
|
Get when the viewport would be updated, will be one of the ``UPDATE\_\*`` constants.
|
|
|
|
.. _class_Viewport_get_usage:
|
|
|
|
- :ref:`int<class_int>` **get_usage** **(** **)** const
|
|
|
|
.. _class_Viewport_get_vflip:
|
|
|
|
- :ref:`bool<class_bool>` **get_vflip** **(** **)** const
|
|
|
|
Set whether the render target is flipped on the Y axis.
|
|
|
|
.. _class_Viewport_get_viewport_rid:
|
|
|
|
- :ref:`RID<class_rid>` **get_viewport_rid** **(** **)** const
|
|
|
|
Get the viewport RID from the :ref:`VisualServer<class_visualserver>`.
|
|
|
|
.. _class_Viewport_get_visible_rect:
|
|
|
|
- :ref:`Rect2<class_rect2>` **get_visible_rect** **(** **)** const
|
|
|
|
Return the final, visible rect in global screen coordinates.
|
|
|
|
.. _class_Viewport_get_world:
|
|
|
|
- :ref:`World<class_world>` **get_world** **(** **)** const
|
|
|
|
Return the 3D world of the viewport.
|
|
|
|
.. _class_Viewport_get_world_2d:
|
|
|
|
- :ref:`World2D<class_world2d>` **get_world_2d** **(** **)** const
|
|
|
|
Return the 2D world of the viewport.
|
|
|
|
.. _class_Viewport_gui_get_drag_data:
|
|
|
|
- :ref:`Variant<class_variant>` **gui_get_drag_data** **(** **)** const
|
|
|
|
Returs the drag data from the GUI, that was previously returned by :ref:`Control.get_drag_data<class_Control_get_drag_data>`.
|
|
|
|
.. _class_Viewport_gui_has_modal_stack:
|
|
|
|
- :ref:`bool<class_bool>` **gui_has_modal_stack** **(** **)** const
|
|
|
|
Returs whether there are shown modals on-screen.
|
|
|
|
.. _class_Viewport_has_transparent_background:
|
|
|
|
- :ref:`bool<class_bool>` **has_transparent_background** **(** **)** const
|
|
|
|
Return whether the viewport lets whatever is behind it to show.
|
|
|
|
.. _class_Viewport_input:
|
|
|
|
- void **input** **(** :ref:`Object<class_object>` local_event **)**
|
|
|
|
.. _class_Viewport_is_3d_disabled:
|
|
|
|
- :ref:`bool<class_bool>` **is_3d_disabled** **(** **)** const
|
|
|
|
.. _class_Viewport_is_audio_listener:
|
|
|
|
- :ref:`bool<class_bool>` **is_audio_listener** **(** **)** const
|
|
|
|
Returns whether the viewport sends sounds to the speakers.
|
|
|
|
.. _class_Viewport_is_audio_listener_2d:
|
|
|
|
- :ref:`bool<class_bool>` **is_audio_listener_2d** **(** **)** const
|
|
|
|
Returns whether the viewport sends soundsfrom 2D emitters to the speakers.
|
|
|
|
.. _class_Viewport_is_input_disabled:
|
|
|
|
- :ref:`bool<class_bool>` **is_input_disabled** **(** **)** const
|
|
|
|
Return whether input to the viewport is disabled.
|
|
|
|
.. _class_Viewport_is_size_override_enabled:
|
|
|
|
- :ref:`bool<class_bool>` **is_size_override_enabled** **(** **)** const
|
|
|
|
Get the enabled status of the size override set with :ref:`set_size_override<class_Viewport_set_size_override>`.
|
|
|
|
.. _class_Viewport_is_size_override_stretch_enabled:
|
|
|
|
- :ref:`bool<class_bool>` **is_size_override_stretch_enabled** **(** **)** const
|
|
|
|
Get the enabled status of the size strech override set with :ref:`set_size_override_stretch<class_Viewport_set_size_override_stretch>`.
|
|
|
|
.. _class_Viewport_is_using_own_world:
|
|
|
|
- :ref:`bool<class_bool>` **is_using_own_world** **(** **)** const
|
|
|
|
Return whether the viewport is using a world separate from the parent viewport's world.
|
|
|
|
.. _class_Viewport_set_as_audio_listener:
|
|
|
|
- void **set_as_audio_listener** **(** :ref:`bool<class_bool>` enable **)**
|
|
|
|
Makes the viewport send sounds to the speakers.
|
|
|
|
.. _class_Viewport_set_as_audio_listener_2d:
|
|
|
|
- void **set_as_audio_listener_2d** **(** :ref:`bool<class_bool>` enable **)**
|
|
|
|
Makes the viewport send sounds from 2D emitters to the speakers.
|
|
|
|
.. _class_Viewport_set_attach_to_screen_rect:
|
|
|
|
- void **set_attach_to_screen_rect** **(** :ref:`Rect2<class_rect2>` rect **)**
|
|
|
|
.. _class_Viewport_set_canvas_transform:
|
|
|
|
- void **set_canvas_transform** **(** :ref:`Transform2D<class_transform2d>` xform **)**
|
|
|
|
Set the canvas transform of the viewport, useful for changing the on-screen positions of all child :ref:`CanvasItem<class_canvasitem>`\ s. This is relative to the global canvas transform of the viewport.
|
|
|
|
.. _class_Viewport_set_clear_on_new_frame:
|
|
|
|
- void **set_clear_on_new_frame** **(** :ref:`bool<class_bool>` enable **)**
|
|
|
|
.. _class_Viewport_set_debug_draw:
|
|
|
|
- void **set_debug_draw** **(** :ref:`int<class_int>` debug_draw **)**
|
|
|
|
.. _class_Viewport_set_disable_3d:
|
|
|
|
- void **set_disable_3d** **(** :ref:`bool<class_bool>` disable **)**
|
|
|
|
.. _class_Viewport_set_disable_input:
|
|
|
|
- void **set_disable_input** **(** :ref:`bool<class_bool>` disable **)**
|
|
|
|
Set whether input to the viewport is disabled.
|
|
|
|
.. _class_Viewport_set_global_canvas_transform:
|
|
|
|
- void **set_global_canvas_transform** **(** :ref:`Transform2D<class_transform2d>` xform **)**
|
|
|
|
Set the global canvas transform of the viewport. The canvas transform is relative to this.
|
|
|
|
.. _class_Viewport_set_hdr:
|
|
|
|
- void **set_hdr** **(** :ref:`bool<class_bool>` enable **)**
|
|
|
|
.. _class_Viewport_set_msaa:
|
|
|
|
- void **set_msaa** **(** :ref:`int<class_int>` msaa **)**
|
|
|
|
.. _class_Viewport_set_physics_object_picking:
|
|
|
|
- void **set_physics_object_picking** **(** :ref:`bool<class_bool>` enable **)**
|
|
|
|
Enable/disable picking for all physics objects inside the viewport.
|
|
|
|
.. _class_Viewport_set_shadow_atlas_quadrant_subdiv:
|
|
|
|
- void **set_shadow_atlas_quadrant_subdiv** **(** :ref:`int<class_int>` quadrant, :ref:`int<class_int>` subdiv **)**
|
|
|
|
.. _class_Viewport_set_shadow_atlas_size:
|
|
|
|
- void **set_shadow_atlas_size** **(** :ref:`int<class_int>` size **)**
|
|
|
|
.. _class_Viewport_set_size:
|
|
|
|
- void **set_size** **(** :ref:`Vector2<class_vector2>` size **)**
|
|
|
|
Set the size of the viewport.
|
|
|
|
.. _class_Viewport_set_size_override:
|
|
|
|
- void **set_size_override** **(** :ref:`bool<class_bool>` enable, :ref:`Vector2<class_vector2>` size=Vector2(-1, -1), :ref:`Vector2<class_vector2>` margin=Vector2(0, 0) **)**
|
|
|
|
Set the size override of the viewport. If the enable parameter is true, it would use the override, otherwise it would use the default size. If the size parameter is equal to ``(-1, -1)``, it won't update the size.
|
|
|
|
.. _class_Viewport_set_size_override_stretch:
|
|
|
|
- void **set_size_override_stretch** **(** :ref:`bool<class_bool>` enabled **)**
|
|
|
|
Set whether the size override affects stretch as well.
|
|
|
|
.. _class_Viewport_set_transparent_background:
|
|
|
|
- void **set_transparent_background** **(** :ref:`bool<class_bool>` enable **)**
|
|
|
|
If this viewport is a child of another viewport, keep the previously drawn background visible.
|
|
|
|
.. _class_Viewport_set_update_mode:
|
|
|
|
- void **set_update_mode** **(** :ref:`int<class_int>` mode **)**
|
|
|
|
Set when the render target would be updated, using the ``UPDATE\_\*`` constants
|
|
|
|
.. _class_Viewport_set_usage:
|
|
|
|
- void **set_usage** **(** :ref:`int<class_int>` usage **)**
|
|
|
|
.. _class_Viewport_set_use_own_world:
|
|
|
|
- void **set_use_own_world** **(** :ref:`bool<class_bool>` enable **)**
|
|
|
|
Make the viewport use a world separate from the parent viewport's world.
|
|
|
|
.. _class_Viewport_set_vflip:
|
|
|
|
- void **set_vflip** **(** :ref:`bool<class_bool>` enable **)**
|
|
|
|
Set whether the viewport is flipped on the Y axis.
|
|
|
|
.. _class_Viewport_set_world:
|
|
|
|
- void **set_world** **(** :ref:`World<class_world>` world **)**
|
|
|
|
Change the 3D world of the viewport.
|
|
|
|
.. _class_Viewport_set_world_2d:
|
|
|
|
- void **set_world_2d** **(** :ref:`World2D<class_world2d>` world_2d **)**
|
|
|
|
.. _class_Viewport_unhandled_input:
|
|
|
|
- void **unhandled_input** **(** :ref:`Object<class_object>` local_event **)**
|
|
|
|
.. _class_Viewport_update_worlds:
|
|
|
|
- void **update_worlds** **(** **)**
|
|
|
|
Force update of the 2D and 3D worlds.
|
|
|
|
.. _class_Viewport_warp_mouse:
|
|
|
|
- void **warp_mouse** **(** :ref:`Vector2<class_vector2>` to_pos **)**
|
|
|
|
Warp the mouse to a position, relative to the viewport.
|
|
|
|
|