12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028 |
- :github_url: hide
- .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
- .. DO NOT EDIT THIS FILE, but the Viewport.xml source instead.
- .. The source is found in doc/classes or modules/<name>/doc_classes.
- .. _class_Viewport:
- Viewport
- ========
- **Inherits:** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
- Creates a sub-view into the screen.
- 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:`ViewportContainer<class_ViewportContainer>`, it will automatically take up its size, otherwise it 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.
- Tutorials
- ---------
- - :doc:`../tutorials/2d/2d_transforms`
- - :doc:`../tutorials/rendering/viewports`
- Properties
- ----------
- +-------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+---------------------+
- | :ref:`bool<class_bool>` | :ref:`arvr<class_Viewport_property_arvr>` | ``false`` |
- +-------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+---------------------+
- | :ref:`bool<class_bool>` | :ref:`audio_listener_enable_2d<class_Viewport_property_audio_listener_enable_2d>` | ``false`` |
- +-------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+---------------------+
- | :ref:`bool<class_bool>` | :ref:`audio_listener_enable_3d<class_Viewport_property_audio_listener_enable_3d>` | ``false`` |
- +-------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+---------------------+
- | :ref:`DefaultCanvasItemTextureFilter<enum_Viewport_DefaultCanvasItemTextureFilter>` | :ref:`canvas_item_default_texture_filter<class_Viewport_property_canvas_item_default_texture_filter>` | ``1`` |
- +-------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+---------------------+
- | :ref:`DefaultCanvasItemTextureRepeat<enum_Viewport_DefaultCanvasItemTextureRepeat>` | :ref:`canvas_item_default_texture_repeat<class_Viewport_property_canvas_item_default_texture_repeat>` | ``0`` |
- +-------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+---------------------+
- | :ref:`Transform2D<class_Transform2D>` | :ref:`canvas_transform<class_Viewport_property_canvas_transform>` | |
- +-------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+---------------------+
- | :ref:`DebugDraw<enum_Viewport_DebugDraw>` | :ref:`debug_draw<class_Viewport_property_debug_draw>` | ``0`` |
- +-------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+---------------------+
- | :ref:`Transform2D<class_Transform2D>` | :ref:`global_canvas_transform<class_Viewport_property_global_canvas_transform>` | |
- +-------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+---------------------+
- | :ref:`bool<class_bool>` | :ref:`gui_disable_input<class_Viewport_property_gui_disable_input>` | ``false`` |
- +-------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+---------------------+
- | :ref:`bool<class_bool>` | :ref:`gui_snap_controls_to_pixels<class_Viewport_property_gui_snap_controls_to_pixels>` | ``true`` |
- +-------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+---------------------+
- | :ref:`bool<class_bool>` | :ref:`handle_input_locally<class_Viewport_property_handle_input_locally>` | ``true`` |
- +-------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+---------------------+
- | :ref:`MSAA<enum_Viewport_MSAA>` | :ref:`msaa<class_Viewport_property_msaa>` | ``0`` |
- +-------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+---------------------+
- | :ref:`bool<class_bool>` | :ref:`own_world<class_Viewport_property_own_world>` | ``false`` |
- +-------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+---------------------+
- | :ref:`bool<class_bool>` | :ref:`physics_object_picking<class_Viewport_property_physics_object_picking>` | ``false`` |
- +-------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+---------------------+
- | :ref:`bool<class_bool>` | :ref:`render_direct_to_screen<class_Viewport_property_render_direct_to_screen>` | ``false`` |
- +-------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+---------------------+
- | :ref:`ClearMode<enum_Viewport_ClearMode>` | :ref:`render_target_clear_mode<class_Viewport_property_render_target_clear_mode>` | ``0`` |
- +-------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+---------------------+
- | :ref:`UpdateMode<enum_Viewport_UpdateMode>` | :ref:`render_target_update_mode<class_Viewport_property_render_target_update_mode>` | ``2`` |
- +-------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+---------------------+
- | :ref:`ShadowAtlasQuadrantSubdiv<enum_Viewport_ShadowAtlasQuadrantSubdiv>` | :ref:`shadow_atlas_quad_0<class_Viewport_property_shadow_atlas_quad_0>` | ``2`` |
- +-------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+---------------------+
- | :ref:`ShadowAtlasQuadrantSubdiv<enum_Viewport_ShadowAtlasQuadrantSubdiv>` | :ref:`shadow_atlas_quad_1<class_Viewport_property_shadow_atlas_quad_1>` | ``2`` |
- +-------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+---------------------+
- | :ref:`ShadowAtlasQuadrantSubdiv<enum_Viewport_ShadowAtlasQuadrantSubdiv>` | :ref:`shadow_atlas_quad_2<class_Viewport_property_shadow_atlas_quad_2>` | ``3`` |
- +-------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+---------------------+
- | :ref:`ShadowAtlasQuadrantSubdiv<enum_Viewport_ShadowAtlasQuadrantSubdiv>` | :ref:`shadow_atlas_quad_3<class_Viewport_property_shadow_atlas_quad_3>` | ``4`` |
- +-------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+---------------------+
- | :ref:`int<class_int>` | :ref:`shadow_atlas_size<class_Viewport_property_shadow_atlas_size>` | ``0`` |
- +-------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+---------------------+
- | :ref:`Vector2<class_Vector2>` | :ref:`size<class_Viewport_property_size>` | ``Vector2( 0, 0 )`` |
- +-------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+---------------------+
- | :ref:`bool<class_bool>` | :ref:`size_override_stretch<class_Viewport_property_size_override_stretch>` | ``false`` |
- +-------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+---------------------+
- | :ref:`bool<class_bool>` | :ref:`transparent_bg<class_Viewport_property_transparent_bg>` | ``false`` |
- +-------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+---------------------+
- | :ref:`World<class_World>` | :ref:`world<class_Viewport_property_world>` | |
- +-------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+---------------------+
- | :ref:`World2D<class_World2D>` | :ref:`world_2d<class_Viewport_property_world_2d>` | |
- +-------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+---------------------+
- Methods
- -------
- +---------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`World<class_World>` | :ref:`find_world<class_Viewport_method_find_world>` **(** **)** const |
- +---------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`World2D<class_World2D>` | :ref:`find_world_2d<class_Viewport_method_find_world_2d>` **(** **)** const |
- +---------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`Camera<class_Camera>` | :ref:`get_camera<class_Viewport_method_get_camera>` **(** **)** const |
- +---------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`Transform2D<class_Transform2D>` | :ref:`get_final_transform<class_Viewport_method_get_final_transform>` **(** **)** const |
- +---------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`Control<class_Control>` | :ref:`get_modal_stack_top<class_Viewport_method_get_modal_stack_top>` **(** **)** const |
- +---------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`Vector2<class_Vector2>` | :ref:`get_mouse_position<class_Viewport_method_get_mouse_position>` **(** **)** const |
- +---------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`int<class_int>` | :ref:`get_render_info<class_Viewport_method_get_render_info>` **(** :ref:`RenderInfo<enum_Viewport_RenderInfo>` info **)** |
- +---------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`ShadowAtlasQuadrantSubdiv<enum_Viewport_ShadowAtlasQuadrantSubdiv>` | :ref:`get_shadow_atlas_quadrant_subdiv<class_Viewport_method_get_shadow_atlas_quadrant_subdiv>` **(** :ref:`int<class_int>` quadrant **)** const |
- +---------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`Vector2<class_Vector2>` | :ref:`get_size_override<class_Viewport_method_get_size_override>` **(** **)** const |
- +---------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`ViewportTexture<class_ViewportTexture>` | :ref:`get_texture<class_Viewport_method_get_texture>` **(** **)** const |
- +---------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`RID<class_RID>` | :ref:`get_viewport_rid<class_Viewport_method_get_viewport_rid>` **(** **)** const |
- +---------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`Rect2<class_Rect2>` | :ref:`get_visible_rect<class_Viewport_method_get_visible_rect>` **(** **)** const |
- +---------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`Variant<class_Variant>` | :ref:`gui_get_drag_data<class_Viewport_method_gui_get_drag_data>` **(** **)** const |
- +---------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`bool<class_bool>` | :ref:`gui_has_modal_stack<class_Viewport_method_gui_has_modal_stack>` **(** **)** const |
- +---------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`bool<class_bool>` | :ref:`gui_is_dragging<class_Viewport_method_gui_is_dragging>` **(** **)** const |
- +---------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`input<class_Viewport_method_input>` **(** :ref:`InputEvent<class_InputEvent>` local_event **)** |
- +---------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`bool<class_bool>` | :ref:`is_input_handled<class_Viewport_method_is_input_handled>` **(** **)** const |
- +---------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`bool<class_bool>` | :ref:`is_size_override_enabled<class_Viewport_method_is_size_override_enabled>` **(** **)** const |
- +---------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`set_attach_to_screen_rect<class_Viewport_method_set_attach_to_screen_rect>` **(** :ref:`Rect2<class_Rect2>` rect **)** |
- +---------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`set_input_as_handled<class_Viewport_method_set_input_as_handled>` **(** **)** |
- +---------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`set_shadow_atlas_quadrant_subdiv<class_Viewport_method_set_shadow_atlas_quadrant_subdiv>` **(** :ref:`int<class_int>` quadrant, :ref:`ShadowAtlasQuadrantSubdiv<enum_Viewport_ShadowAtlasQuadrantSubdiv>` subdiv **)** |
- +---------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`set_size_override<class_Viewport_method_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:`unhandled_input<class_Viewport_method_unhandled_input>` **(** :ref:`InputEvent<class_InputEvent>` local_event **)** |
- +---------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`update_worlds<class_Viewport_method_update_worlds>` **(** **)** |
- +---------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`warp_mouse<class_Viewport_method_warp_mouse>` **(** :ref:`Vector2<class_Vector2>` to_position **)** |
- +---------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- Signals
- -------
- .. _class_Viewport_signal_gui_focus_changed:
- - **gui_focus_changed** **(** :ref:`Control<class_Control>` node **)**
- Emitted when a Control node grabs keyboard focus.
- ----
- .. _class_Viewport_signal_size_changed:
- - **size_changed** **(** **)**
- Emitted when the size of the viewport is changed, whether by :ref:`set_size_override<class_Viewport_method_set_size_override>`, resize of window, or some other means.
- Enumerations
- ------------
- .. _enum_Viewport_UpdateMode:
- .. _class_Viewport_constant_UPDATE_DISABLED:
- .. _class_Viewport_constant_UPDATE_ONCE:
- .. _class_Viewport_constant_UPDATE_WHEN_VISIBLE:
- .. _class_Viewport_constant_UPDATE_ALWAYS:
- enum **UpdateMode**:
- - **UPDATE_DISABLED** = **0** --- Do not update the render target.
- - **UPDATE_ONCE** = **1** --- Update the render target once, then switch to :ref:`UPDATE_DISABLED<class_Viewport_constant_UPDATE_DISABLED>`.
- - **UPDATE_WHEN_VISIBLE** = **2** --- Update the render target only when it is visible. This is the default value.
- - **UPDATE_ALWAYS** = **3** --- Always update the render target.
- ----
- .. _enum_Viewport_ShadowAtlasQuadrantSubdiv:
- .. _class_Viewport_constant_SHADOW_ATLAS_QUADRANT_SUBDIV_DISABLED:
- .. _class_Viewport_constant_SHADOW_ATLAS_QUADRANT_SUBDIV_1:
- .. _class_Viewport_constant_SHADOW_ATLAS_QUADRANT_SUBDIV_4:
- .. _class_Viewport_constant_SHADOW_ATLAS_QUADRANT_SUBDIV_16:
- .. _class_Viewport_constant_SHADOW_ATLAS_QUADRANT_SUBDIV_64:
- .. _class_Viewport_constant_SHADOW_ATLAS_QUADRANT_SUBDIV_256:
- .. _class_Viewport_constant_SHADOW_ATLAS_QUADRANT_SUBDIV_1024:
- .. _class_Viewport_constant_SHADOW_ATLAS_QUADRANT_SUBDIV_MAX:
- enum **ShadowAtlasQuadrantSubdiv**:
- - **SHADOW_ATLAS_QUADRANT_SUBDIV_DISABLED** = **0** --- This quadrant will not be used.
- - **SHADOW_ATLAS_QUADRANT_SUBDIV_1** = **1** --- This quadrant will only be used by one shadow map.
- - **SHADOW_ATLAS_QUADRANT_SUBDIV_4** = **2** --- This quadrant will be split in 4 and used by up to 4 shadow maps.
- - **SHADOW_ATLAS_QUADRANT_SUBDIV_16** = **3** --- This quadrant will be split 16 ways and used by up to 16 shadow maps.
- - **SHADOW_ATLAS_QUADRANT_SUBDIV_64** = **4** --- This quadrant will be split 64 ways and used by up to 64 shadow maps.
- - **SHADOW_ATLAS_QUADRANT_SUBDIV_256** = **5** --- This quadrant will be split 256 ways and used by up to 256 shadow maps. Unless the :ref:`shadow_atlas_size<class_Viewport_property_shadow_atlas_size>` is very high, the shadows in this quadrant will be very low resolution.
- - **SHADOW_ATLAS_QUADRANT_SUBDIV_1024** = **6** --- This quadrant will be split 1024 ways and used by up to 1024 shadow maps. Unless the :ref:`shadow_atlas_size<class_Viewport_property_shadow_atlas_size>` is very high, the shadows in this quadrant will be very low resolution.
- - **SHADOW_ATLAS_QUADRANT_SUBDIV_MAX** = **7** --- Represents the size of the :ref:`ShadowAtlasQuadrantSubdiv<enum_Viewport_ShadowAtlasQuadrantSubdiv>` enum.
- ----
- .. _enum_Viewport_RenderInfo:
- .. _class_Viewport_constant_RENDER_INFO_OBJECTS_IN_FRAME:
- .. _class_Viewport_constant_RENDER_INFO_VERTICES_IN_FRAME:
- .. _class_Viewport_constant_RENDER_INFO_MATERIAL_CHANGES_IN_FRAME:
- .. _class_Viewport_constant_RENDER_INFO_SHADER_CHANGES_IN_FRAME:
- .. _class_Viewport_constant_RENDER_INFO_SURFACE_CHANGES_IN_FRAME:
- .. _class_Viewport_constant_RENDER_INFO_DRAW_CALLS_IN_FRAME:
- .. _class_Viewport_constant_RENDER_INFO_MAX:
- enum **RenderInfo**:
- - **RENDER_INFO_OBJECTS_IN_FRAME** = **0** --- Amount of objects in frame.
- - **RENDER_INFO_VERTICES_IN_FRAME** = **1** --- Amount of vertices in frame.
- - **RENDER_INFO_MATERIAL_CHANGES_IN_FRAME** = **2** --- Amount of material changes in frame.
- - **RENDER_INFO_SHADER_CHANGES_IN_FRAME** = **3** --- Amount of shader changes in frame.
- - **RENDER_INFO_SURFACE_CHANGES_IN_FRAME** = **4** --- Amount of surface changes in frame.
- - **RENDER_INFO_DRAW_CALLS_IN_FRAME** = **5** --- Amount of draw calls in frame.
- - **RENDER_INFO_MAX** = **6** --- Represents the size of the :ref:`RenderInfo<enum_Viewport_RenderInfo>` enum.
- ----
- .. _enum_Viewport_DebugDraw:
- .. _class_Viewport_constant_DEBUG_DRAW_DISABLED:
- .. _class_Viewport_constant_DEBUG_DRAW_UNSHADED:
- .. _class_Viewport_constant_DEBUG_DRAW_OVERDRAW:
- .. _class_Viewport_constant_DEBUG_DRAW_WIREFRAME:
- .. _class_Viewport_constant_DEBUG_DRAW_GI_PROBE_ALBEDO:
- .. _class_Viewport_constant_DEBUG_DRAW_GI_PROBE_LIGHTING:
- .. _class_Viewport_constant_DEBUG_DRAW_GI_PROBE_EMISSION:
- .. _class_Viewport_constant_DEBUG_DRAW_SHADOW_ATLAS:
- .. _class_Viewport_constant_DEBUG_DRAW_DIRECTIONAL_SHADOW_ATLAS:
- .. _class_Viewport_constant_DEBUG_DRAW_SCENE_LUMINANCE:
- .. _class_Viewport_constant_DEBUG_DRAW_SSAO:
- enum **DebugDraw**:
- - **DEBUG_DRAW_DISABLED** = **0** --- Objects are displayed normally.
- - **DEBUG_DRAW_UNSHADED** = **1** --- Objects are displayed without light information.
- - **DEBUG_DRAW_OVERDRAW** = **3** --- Objected are displayed semi-transparent with additive blending so you can see where they intersect.
- - **DEBUG_DRAW_WIREFRAME** = **4** --- Objects are displayed in wireframe style.
- - **DEBUG_DRAW_GI_PROBE_ALBEDO** = **6**
- - **DEBUG_DRAW_GI_PROBE_LIGHTING** = **7**
- - **DEBUG_DRAW_GI_PROBE_EMISSION** = **8**
- - **DEBUG_DRAW_SHADOW_ATLAS** = **9**
- - **DEBUG_DRAW_DIRECTIONAL_SHADOW_ATLAS** = **10**
- - **DEBUG_DRAW_SCENE_LUMINANCE** = **11**
- - **DEBUG_DRAW_SSAO** = **12**
- ----
- .. _enum_Viewport_MSAA:
- .. _class_Viewport_constant_MSAA_DISABLED:
- .. _class_Viewport_constant_MSAA_2X:
- .. _class_Viewport_constant_MSAA_4X:
- .. _class_Viewport_constant_MSAA_8X:
- .. _class_Viewport_constant_MSAA_16X:
- enum **MSAA**:
- - **MSAA_DISABLED** = **0** --- Multisample anti-aliasing mode disabled. This is the default value.
- - **MSAA_2X** = **1** --- Use 2x Multisample Antialiasing.
- - **MSAA_4X** = **2** --- Use 4x Multisample Antialiasing.
- - **MSAA_8X** = **3** --- Use 8x Multisample Antialiasing. Likely unsupported on low-end and older hardware.
- - **MSAA_16X** = **4** --- Use 16x Multisample Antialiasing. Likely unsupported on medium and low-end hardware.
- ----
- .. _enum_Viewport_ClearMode:
- .. _class_Viewport_constant_CLEAR_MODE_ALWAYS:
- .. _class_Viewport_constant_CLEAR_MODE_NEVER:
- .. _class_Viewport_constant_CLEAR_MODE_ONLY_NEXT_FRAME:
- enum **ClearMode**:
- - **CLEAR_MODE_ALWAYS** = **0** --- Always clear the render target before drawing.
- - **CLEAR_MODE_NEVER** = **1** --- Never clear the render target.
- - **CLEAR_MODE_ONLY_NEXT_FRAME** = **2** --- Clear the render target next frame, then switch to :ref:`CLEAR_MODE_NEVER<class_Viewport_constant_CLEAR_MODE_NEVER>`.
- ----
- .. _enum_Viewport_DefaultCanvasItemTextureFilter:
- .. _class_Viewport_constant_DEFAULT_CANVAS_ITEM_TEXTURE_FILTER_NEAREST:
- .. _class_Viewport_constant_DEFAULT_CANVAS_ITEM_TEXTURE_FILTER_LINEAR:
- .. _class_Viewport_constant_DEFAULT_CANVAS_ITEM_TEXTURE_FILTER_LINEAR_WITH_MIPMAPS:
- .. _class_Viewport_constant_DEFAULT_CANVAS_ITEM_TEXTURE_FILTER_NEAREST_WITH_MIPMAPS:
- .. _class_Viewport_constant_DEFAULT_CANVAS_ITEM_TEXTURE_FILTER_MAX:
- enum **DefaultCanvasItemTextureFilter**:
- - **DEFAULT_CANVAS_ITEM_TEXTURE_FILTER_NEAREST** = **0**
- - **DEFAULT_CANVAS_ITEM_TEXTURE_FILTER_LINEAR** = **1**
- - **DEFAULT_CANVAS_ITEM_TEXTURE_FILTER_LINEAR_WITH_MIPMAPS** = **2**
- - **DEFAULT_CANVAS_ITEM_TEXTURE_FILTER_NEAREST_WITH_MIPMAPS** = **3**
- - **DEFAULT_CANVAS_ITEM_TEXTURE_FILTER_MAX** = **4**
- ----
- .. _enum_Viewport_DefaultCanvasItemTextureRepeat:
- .. _class_Viewport_constant_DEFAULT_CANVAS_ITEM_TEXTURE_REPEAT_DISABLED:
- .. _class_Viewport_constant_DEFAULT_CANVAS_ITEM_TEXTURE_REPEAT_ENABLED:
- .. _class_Viewport_constant_DEFAULT_CANVAS_ITEM_TEXTURE_REPEAT_MIRROR:
- .. _class_Viewport_constant_DEFAULT_CANVAS_ITEM_TEXTURE_REPEAT_MAX:
- enum **DefaultCanvasItemTextureRepeat**:
- - **DEFAULT_CANVAS_ITEM_TEXTURE_REPEAT_DISABLED** = **0**
- - **DEFAULT_CANVAS_ITEM_TEXTURE_REPEAT_ENABLED** = **1**
- - **DEFAULT_CANVAS_ITEM_TEXTURE_REPEAT_MIRROR** = **2**
- - **DEFAULT_CANVAS_ITEM_TEXTURE_REPEAT_MAX** = **3**
- Property Descriptions
- ---------------------
- .. _class_Viewport_property_arvr:
- - :ref:`bool<class_bool>` **arvr**
- +-----------+---------------------+
- | *Default* | ``false`` |
- +-----------+---------------------+
- | *Setter* | set_use_arvr(value) |
- +-----------+---------------------+
- | *Getter* | use_arvr() |
- +-----------+---------------------+
- If ``true``, the viewport will be used in AR/VR process.
- ----
- .. _class_Viewport_property_audio_listener_enable_2d:
- - :ref:`bool<class_bool>` **audio_listener_enable_2d**
- +-----------+---------------------------------+
- | *Default* | ``false`` |
- +-----------+---------------------------------+
- | *Setter* | set_as_audio_listener_2d(value) |
- +-----------+---------------------------------+
- | *Getter* | is_audio_listener_2d() |
- +-----------+---------------------------------+
- If ``true``, the viewport will process 2D audio streams.
- ----
- .. _class_Viewport_property_audio_listener_enable_3d:
- - :ref:`bool<class_bool>` **audio_listener_enable_3d**
- +-----------+------------------------------+
- | *Default* | ``false`` |
- +-----------+------------------------------+
- | *Setter* | set_as_audio_listener(value) |
- +-----------+------------------------------+
- | *Getter* | is_audio_listener() |
- +-----------+------------------------------+
- If ``true``, the viewport will process 3D audio streams.
- ----
- .. _class_Viewport_property_canvas_item_default_texture_filter:
- - :ref:`DefaultCanvasItemTextureFilter<enum_Viewport_DefaultCanvasItemTextureFilter>` **canvas_item_default_texture_filter**
- +-----------+-----------------------------------------------+
- | *Default* | ``1`` |
- +-----------+-----------------------------------------------+
- | *Setter* | set_default_canvas_item_texture_filter(value) |
- +-----------+-----------------------------------------------+
- | *Getter* | get_default_canvas_item_texture_filter() |
- +-----------+-----------------------------------------------+
- ----
- .. _class_Viewport_property_canvas_item_default_texture_repeat:
- - :ref:`DefaultCanvasItemTextureRepeat<enum_Viewport_DefaultCanvasItemTextureRepeat>` **canvas_item_default_texture_repeat**
- +-----------+-----------------------------------------------+
- | *Default* | ``0`` |
- +-----------+-----------------------------------------------+
- | *Setter* | set_default_canvas_item_texture_repeat(value) |
- +-----------+-----------------------------------------------+
- | *Getter* | get_default_canvas_item_texture_repeat() |
- +-----------+-----------------------------------------------+
- ----
- .. _class_Viewport_property_canvas_transform:
- - :ref:`Transform2D<class_Transform2D>` **canvas_transform**
- +----------+-----------------------------+
- | *Setter* | set_canvas_transform(value) |
- +----------+-----------------------------+
- | *Getter* | get_canvas_transform() |
- +----------+-----------------------------+
- 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_property_debug_draw:
- - :ref:`DebugDraw<enum_Viewport_DebugDraw>` **debug_draw**
- +-----------+-----------------------+
- | *Default* | ``0`` |
- +-----------+-----------------------+
- | *Setter* | set_debug_draw(value) |
- +-----------+-----------------------+
- | *Getter* | get_debug_draw() |
- +-----------+-----------------------+
- The overlay mode for test rendered geometry in debug purposes.
- ----
- .. _class_Viewport_property_global_canvas_transform:
- - :ref:`Transform2D<class_Transform2D>` **global_canvas_transform**
- +----------+------------------------------------+
- | *Setter* | set_global_canvas_transform(value) |
- +----------+------------------------------------+
- | *Getter* | get_global_canvas_transform() |
- +----------+------------------------------------+
- The global canvas transform of the viewport. The canvas transform is relative to this.
- ----
- .. _class_Viewport_property_gui_disable_input:
- - :ref:`bool<class_bool>` **gui_disable_input**
- +-----------+--------------------------+
- | *Default* | ``false`` |
- +-----------+--------------------------+
- | *Setter* | set_disable_input(value) |
- +-----------+--------------------------+
- | *Getter* | is_input_disabled() |
- +-----------+--------------------------+
- If ``true``, the viewport will not receive input event.
- ----
- .. _class_Viewport_property_gui_snap_controls_to_pixels:
- - :ref:`bool<class_bool>` **gui_snap_controls_to_pixels**
- +-----------+--------------------------------------+
- | *Default* | ``true`` |
- +-----------+--------------------------------------+
- | *Setter* | set_snap_controls_to_pixels(value) |
- +-----------+--------------------------------------+
- | *Getter* | is_snap_controls_to_pixels_enabled() |
- +-----------+--------------------------------------+
- If ``true``, the GUI controls on the viewport will lay pixel perfectly.
- ----
- .. _class_Viewport_property_handle_input_locally:
- - :ref:`bool<class_bool>` **handle_input_locally**
- +-----------+---------------------------------+
- | *Default* | ``true`` |
- +-----------+---------------------------------+
- | *Setter* | set_handle_input_locally(value) |
- +-----------+---------------------------------+
- | *Getter* | is_handling_input_locally() |
- +-----------+---------------------------------+
- ----
- .. _class_Viewport_property_msaa:
- - :ref:`MSAA<enum_Viewport_MSAA>` **msaa**
- +-----------+-----------------+
- | *Default* | ``0`` |
- +-----------+-----------------+
- | *Setter* | set_msaa(value) |
- +-----------+-----------------+
- | *Getter* | get_msaa() |
- +-----------+-----------------+
- The multisample anti-aliasing mode. A higher number results in smoother edges at the cost of significantly worse performance. A value of 4 is best unless targeting very high-end systems.
- ----
- .. _class_Viewport_property_own_world:
- - :ref:`bool<class_bool>` **own_world**
- +-----------+--------------------------+
- | *Default* | ``false`` |
- +-----------+--------------------------+
- | *Setter* | set_use_own_world(value) |
- +-----------+--------------------------+
- | *Getter* | is_using_own_world() |
- +-----------+--------------------------+
- If ``true``, the viewport will use :ref:`World<class_World>` defined in ``world`` property.
- ----
- .. _class_Viewport_property_physics_object_picking:
- - :ref:`bool<class_bool>` **physics_object_picking**
- +-----------+-----------------------------------+
- | *Default* | ``false`` |
- +-----------+-----------------------------------+
- | *Setter* | set_physics_object_picking(value) |
- +-----------+-----------------------------------+
- | *Getter* | get_physics_object_picking() |
- +-----------+-----------------------------------+
- If ``true``, the objects rendered by viewport become subjects of mouse picking process.
- ----
- .. _class_Viewport_property_render_direct_to_screen:
- - :ref:`bool<class_bool>` **render_direct_to_screen**
- +-----------+----------------------------------------+
- | *Default* | ``false`` |
- +-----------+----------------------------------------+
- | *Setter* | set_use_render_direct_to_screen(value) |
- +-----------+----------------------------------------+
- | *Getter* | is_using_render_direct_to_screen() |
- +-----------+----------------------------------------+
- If ``true``, renders the Viewport directly to the screen instead of to the root viewport. Only available in GLES2. This is a low-level optimization and should not be used in most cases. If used, reading from the Viewport or from ``SCREEN_TEXTURE`` becomes unavailable. For more information see :ref:`VisualServer.viewport_set_render_direct_to_screen<class_VisualServer_method_viewport_set_render_direct_to_screen>`.
- ----
- .. _class_Viewport_property_render_target_clear_mode:
- - :ref:`ClearMode<enum_Viewport_ClearMode>` **render_target_clear_mode**
- +-----------+-----------------------+
- | *Default* | ``0`` |
- +-----------+-----------------------+
- | *Setter* | set_clear_mode(value) |
- +-----------+-----------------------+
- | *Getter* | get_clear_mode() |
- +-----------+-----------------------+
- The clear mode when viewport used as a render target.
- ----
- .. _class_Viewport_property_render_target_update_mode:
- - :ref:`UpdateMode<enum_Viewport_UpdateMode>` **render_target_update_mode**
- +-----------+------------------------+
- | *Default* | ``2`` |
- +-----------+------------------------+
- | *Setter* | set_update_mode(value) |
- +-----------+------------------------+
- | *Getter* | get_update_mode() |
- +-----------+------------------------+
- The update mode when viewport used as a render target.
- ----
- .. _class_Viewport_property_shadow_atlas_quad_0:
- - :ref:`ShadowAtlasQuadrantSubdiv<enum_Viewport_ShadowAtlasQuadrantSubdiv>` **shadow_atlas_quad_0**
- +-----------+-----------------------------------------+
- | *Default* | ``2`` |
- +-----------+-----------------------------------------+
- | *Setter* | set_shadow_atlas_quadrant_subdiv(value) |
- +-----------+-----------------------------------------+
- | *Getter* | get_shadow_atlas_quadrant_subdiv() |
- +-----------+-----------------------------------------+
- The subdivision amount of the first quadrant on the shadow atlas.
- ----
- .. _class_Viewport_property_shadow_atlas_quad_1:
- - :ref:`ShadowAtlasQuadrantSubdiv<enum_Viewport_ShadowAtlasQuadrantSubdiv>` **shadow_atlas_quad_1**
- +-----------+-----------------------------------------+
- | *Default* | ``2`` |
- +-----------+-----------------------------------------+
- | *Setter* | set_shadow_atlas_quadrant_subdiv(value) |
- +-----------+-----------------------------------------+
- | *Getter* | get_shadow_atlas_quadrant_subdiv() |
- +-----------+-----------------------------------------+
- The subdivision amount of the second quadrant on the shadow atlas.
- ----
- .. _class_Viewport_property_shadow_atlas_quad_2:
- - :ref:`ShadowAtlasQuadrantSubdiv<enum_Viewport_ShadowAtlasQuadrantSubdiv>` **shadow_atlas_quad_2**
- +-----------+-----------------------------------------+
- | *Default* | ``3`` |
- +-----------+-----------------------------------------+
- | *Setter* | set_shadow_atlas_quadrant_subdiv(value) |
- +-----------+-----------------------------------------+
- | *Getter* | get_shadow_atlas_quadrant_subdiv() |
- +-----------+-----------------------------------------+
- The subdivision amount of the third quadrant on the shadow atlas.
- ----
- .. _class_Viewport_property_shadow_atlas_quad_3:
- - :ref:`ShadowAtlasQuadrantSubdiv<enum_Viewport_ShadowAtlasQuadrantSubdiv>` **shadow_atlas_quad_3**
- +-----------+-----------------------------------------+
- | *Default* | ``4`` |
- +-----------+-----------------------------------------+
- | *Setter* | set_shadow_atlas_quadrant_subdiv(value) |
- +-----------+-----------------------------------------+
- | *Getter* | get_shadow_atlas_quadrant_subdiv() |
- +-----------+-----------------------------------------+
- The subdivision amount of the fourth quadrant on the shadow atlas.
- ----
- .. _class_Viewport_property_shadow_atlas_size:
- - :ref:`int<class_int>` **shadow_atlas_size**
- +-----------+------------------------------+
- | *Default* | ``0`` |
- +-----------+------------------------------+
- | *Setter* | set_shadow_atlas_size(value) |
- +-----------+------------------------------+
- | *Getter* | get_shadow_atlas_size() |
- +-----------+------------------------------+
- The shadow atlas' resolution (used for omni and spot lights). The value will be rounded up to the nearest power of 2.
- **Note:** If this is set to 0, shadows won't be visible. Since user-created viewports default to a value of 0, this value must be set above 0 manually.
- ----
- .. _class_Viewport_property_size:
- - :ref:`Vector2<class_Vector2>` **size**
- +-----------+---------------------+
- | *Default* | ``Vector2( 0, 0 )`` |
- +-----------+---------------------+
- | *Setter* | set_size(value) |
- +-----------+---------------------+
- | *Getter* | get_size() |
- +-----------+---------------------+
- The width and height of viewport.
- ----
- .. _class_Viewport_property_size_override_stretch:
- - :ref:`bool<class_bool>` **size_override_stretch**
- +-----------+------------------------------------+
- | *Default* | ``false`` |
- +-----------+------------------------------------+
- | *Setter* | set_size_override_stretch(value) |
- +-----------+------------------------------------+
- | *Getter* | is_size_override_stretch_enabled() |
- +-----------+------------------------------------+
- If ``true``, the size override affects stretch as well.
- ----
- .. _class_Viewport_property_transparent_bg:
- - :ref:`bool<class_bool>` **transparent_bg**
- +-----------+-----------------------------------+
- | *Default* | ``false`` |
- +-----------+-----------------------------------+
- | *Setter* | set_transparent_background(value) |
- +-----------+-----------------------------------+
- | *Getter* | has_transparent_background() |
- +-----------+-----------------------------------+
- If ``true``, the viewport should render its background as transparent.
- ----
- .. _class_Viewport_property_world:
- - :ref:`World<class_World>` **world**
- +----------+------------------+
- | *Setter* | set_world(value) |
- +----------+------------------+
- | *Getter* | get_world() |
- +----------+------------------+
- The custom :ref:`World<class_World>` which can be used as 3D environment source.
- ----
- .. _class_Viewport_property_world_2d:
- - :ref:`World2D<class_World2D>` **world_2d**
- +----------+---------------------+
- | *Setter* | set_world_2d(value) |
- +----------+---------------------+
- | *Getter* | get_world_2d() |
- +----------+---------------------+
- The custom :ref:`World2D<class_World2D>` which can be used as 2D environment source.
- Method Descriptions
- -------------------
- .. _class_Viewport_method_find_world:
- - :ref:`World<class_World>` **find_world** **(** **)** const
- Returns the 3D world of the viewport, or if none the world of the parent viewport.
- ----
- .. _class_Viewport_method_find_world_2d:
- - :ref:`World2D<class_World2D>` **find_world_2d** **(** **)** const
- Returns the 2D world of the viewport.
- ----
- .. _class_Viewport_method_get_camera:
- - :ref:`Camera<class_Camera>` **get_camera** **(** **)** const
- Returns the active 3D camera.
- ----
- .. _class_Viewport_method_get_final_transform:
- - :ref:`Transform2D<class_Transform2D>` **get_final_transform** **(** **)** const
- Returns the total transform of the viewport.
- ----
- .. _class_Viewport_method_get_modal_stack_top:
- - :ref:`Control<class_Control>` **get_modal_stack_top** **(** **)** const
- Returns the topmost modal in the stack.
- ----
- .. _class_Viewport_method_get_mouse_position:
- - :ref:`Vector2<class_Vector2>` **get_mouse_position** **(** **)** const
- Returns the mouse position relative to the viewport.
- ----
- .. _class_Viewport_method_get_render_info:
- - :ref:`int<class_int>` **get_render_info** **(** :ref:`RenderInfo<enum_Viewport_RenderInfo>` info **)**
- Returns information about the viewport from the rendering pipeline.
- ----
- .. _class_Viewport_method_get_shadow_atlas_quadrant_subdiv:
- - :ref:`ShadowAtlasQuadrantSubdiv<enum_Viewport_ShadowAtlasQuadrantSubdiv>` **get_shadow_atlas_quadrant_subdiv** **(** :ref:`int<class_int>` quadrant **)** const
- Returns the :ref:`ShadowAtlasQuadrantSubdiv<enum_Viewport_ShadowAtlasQuadrantSubdiv>` of the specified quadrant.
- ----
- .. _class_Viewport_method_get_size_override:
- - :ref:`Vector2<class_Vector2>` **get_size_override** **(** **)** const
- Returns the size override set with :ref:`set_size_override<class_Viewport_method_set_size_override>`.
- ----
- .. _class_Viewport_method_get_texture:
- - :ref:`ViewportTexture<class_ViewportTexture>` **get_texture** **(** **)** const
- Returns the viewport's texture.
- **Note:** Due to the way OpenGL works, the resulting :ref:`ViewportTexture<class_ViewportTexture>` is flipped vertically. You can use :ref:`Image.flip_y<class_Image_method_flip_y>` on the result of :ref:`Texture2D.get_data<class_Texture2D_method_get_data>` to flip it back, for example:
- ::
- var img = get_viewport().get_texture().get_data()
- img.flip_y()
- ----
- .. _class_Viewport_method_get_viewport_rid:
- - :ref:`RID<class_RID>` **get_viewport_rid** **(** **)** const
- Returns the viewport's RID from the :ref:`VisualServer<class_VisualServer>`.
- ----
- .. _class_Viewport_method_get_visible_rect:
- - :ref:`Rect2<class_Rect2>` **get_visible_rect** **(** **)** const
- Returns the visible rectangle in global screen coordinates.
- ----
- .. _class_Viewport_method_gui_get_drag_data:
- - :ref:`Variant<class_Variant>` **gui_get_drag_data** **(** **)** const
- Returns the drag data from the GUI, that was previously returned by :ref:`Control.get_drag_data<class_Control_method_get_drag_data>`.
- ----
- .. _class_Viewport_method_gui_has_modal_stack:
- - :ref:`bool<class_bool>` **gui_has_modal_stack** **(** **)** const
- Returns ``true`` if there are visible modals on-screen.
- ----
- .. _class_Viewport_method_gui_is_dragging:
- - :ref:`bool<class_bool>` **gui_is_dragging** **(** **)** const
- Returns ``true`` if the viewport is currently performing a drag operation.
- ----
- .. _class_Viewport_method_input:
- - void **input** **(** :ref:`InputEvent<class_InputEvent>` local_event **)**
- ----
- .. _class_Viewport_method_is_input_handled:
- - :ref:`bool<class_bool>` **is_input_handled** **(** **)** const
- ----
- .. _class_Viewport_method_is_size_override_enabled:
- - :ref:`bool<class_bool>` **is_size_override_enabled** **(** **)** const
- Returns ``true`` if the size override is enabled. See :ref:`set_size_override<class_Viewport_method_set_size_override>`.
- ----
- .. _class_Viewport_method_set_attach_to_screen_rect:
- - void **set_attach_to_screen_rect** **(** :ref:`Rect2<class_Rect2>` rect **)**
- Attaches this ``Viewport`` to the root ``Viewport`` with the specified rectangle. This bypasses the need for another node to display this ``Viewport`` but makes you responsible for updating the position of this ``Viewport`` manually.
- ----
- .. _class_Viewport_method_set_input_as_handled:
- - void **set_input_as_handled** **(** **)**
- Stops the input from propagating further down the :ref:`SceneTree<class_SceneTree>`.
- ----
- .. _class_Viewport_method_set_shadow_atlas_quadrant_subdiv:
- - void **set_shadow_atlas_quadrant_subdiv** **(** :ref:`int<class_int>` quadrant, :ref:`ShadowAtlasQuadrantSubdiv<enum_Viewport_ShadowAtlasQuadrantSubdiv>` subdiv **)**
- Sets the number of subdivisions to use in the specified quadrant. A higher number of subdivisions allows you to have more shadows in the scene at once, but reduces the quality of the shadows. A good practice is to have quadrants with a varying number of subdivisions and to have as few subdivisions as possible.
- ----
- .. _class_Viewport_method_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 ) **)**
- Sets the size override of the viewport. If the ``enable`` parameter is ``true`` the override is used, otherwise it uses the default size. If the size parameter is ``(-1, -1)``, it won't update the size.
- ----
- .. _class_Viewport_method_unhandled_input:
- - void **unhandled_input** **(** :ref:`InputEvent<class_InputEvent>` local_event **)**
- ----
- .. _class_Viewport_method_update_worlds:
- - void **update_worlds** **(** **)**
- Forces update of the 2D and 3D worlds.
- ----
- .. _class_Viewport_method_warp_mouse:
- - void **warp_mouse** **(** :ref:`Vector2<class_Vector2>` to_position **)**
- Warps the mouse to a position relative to the viewport.
|