class_viewport.rst 55 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028
  1. :github_url: hide
  2. .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
  3. .. DO NOT EDIT THIS FILE, but the Viewport.xml source instead.
  4. .. The source is found in doc/classes or modules/<name>/doc_classes.
  5. .. _class_Viewport:
  6. Viewport
  7. ========
  8. **Inherits:** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
  9. Creates a sub-view into the screen.
  10. Description
  11. -----------
  12. 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.
  13. Optionally, a viewport can have its own 2D or 3D world, so they don't share what they draw with other viewports.
  14. 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.
  15. Viewports can also choose to be audio listeners, so they generate positional audio depending on a 2D or 3D camera child of it.
  16. Also, viewports can be assigned to different screens in case the devices have multiple screens.
  17. Finally, viewports can also behave as render targets, in which case they will not be visible unless the associated texture is used to draw.
  18. Tutorials
  19. ---------
  20. - :doc:`../tutorials/2d/2d_transforms`
  21. - :doc:`../tutorials/rendering/viewports`
  22. Properties
  23. ----------
  24. +-------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+---------------------+
  25. | :ref:`bool<class_bool>` | :ref:`arvr<class_Viewport_property_arvr>` | ``false`` |
  26. +-------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+---------------------+
  27. | :ref:`bool<class_bool>` | :ref:`audio_listener_enable_2d<class_Viewport_property_audio_listener_enable_2d>` | ``false`` |
  28. +-------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+---------------------+
  29. | :ref:`bool<class_bool>` | :ref:`audio_listener_enable_3d<class_Viewport_property_audio_listener_enable_3d>` | ``false`` |
  30. +-------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+---------------------+
  31. | :ref:`DefaultCanvasItemTextureFilter<enum_Viewport_DefaultCanvasItemTextureFilter>` | :ref:`canvas_item_default_texture_filter<class_Viewport_property_canvas_item_default_texture_filter>` | ``1`` |
  32. +-------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+---------------------+
  33. | :ref:`DefaultCanvasItemTextureRepeat<enum_Viewport_DefaultCanvasItemTextureRepeat>` | :ref:`canvas_item_default_texture_repeat<class_Viewport_property_canvas_item_default_texture_repeat>` | ``0`` |
  34. +-------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+---------------------+
  35. | :ref:`Transform2D<class_Transform2D>` | :ref:`canvas_transform<class_Viewport_property_canvas_transform>` | |
  36. +-------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+---------------------+
  37. | :ref:`DebugDraw<enum_Viewport_DebugDraw>` | :ref:`debug_draw<class_Viewport_property_debug_draw>` | ``0`` |
  38. +-------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+---------------------+
  39. | :ref:`Transform2D<class_Transform2D>` | :ref:`global_canvas_transform<class_Viewport_property_global_canvas_transform>` | |
  40. +-------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+---------------------+
  41. | :ref:`bool<class_bool>` | :ref:`gui_disable_input<class_Viewport_property_gui_disable_input>` | ``false`` |
  42. +-------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+---------------------+
  43. | :ref:`bool<class_bool>` | :ref:`gui_snap_controls_to_pixels<class_Viewport_property_gui_snap_controls_to_pixels>` | ``true`` |
  44. +-------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+---------------------+
  45. | :ref:`bool<class_bool>` | :ref:`handle_input_locally<class_Viewport_property_handle_input_locally>` | ``true`` |
  46. +-------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+---------------------+
  47. | :ref:`MSAA<enum_Viewport_MSAA>` | :ref:`msaa<class_Viewport_property_msaa>` | ``0`` |
  48. +-------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+---------------------+
  49. | :ref:`bool<class_bool>` | :ref:`own_world<class_Viewport_property_own_world>` | ``false`` |
  50. +-------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+---------------------+
  51. | :ref:`bool<class_bool>` | :ref:`physics_object_picking<class_Viewport_property_physics_object_picking>` | ``false`` |
  52. +-------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+---------------------+
  53. | :ref:`bool<class_bool>` | :ref:`render_direct_to_screen<class_Viewport_property_render_direct_to_screen>` | ``false`` |
  54. +-------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+---------------------+
  55. | :ref:`ClearMode<enum_Viewport_ClearMode>` | :ref:`render_target_clear_mode<class_Viewport_property_render_target_clear_mode>` | ``0`` |
  56. +-------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+---------------------+
  57. | :ref:`UpdateMode<enum_Viewport_UpdateMode>` | :ref:`render_target_update_mode<class_Viewport_property_render_target_update_mode>` | ``2`` |
  58. +-------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+---------------------+
  59. | :ref:`ShadowAtlasQuadrantSubdiv<enum_Viewport_ShadowAtlasQuadrantSubdiv>` | :ref:`shadow_atlas_quad_0<class_Viewport_property_shadow_atlas_quad_0>` | ``2`` |
  60. +-------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+---------------------+
  61. | :ref:`ShadowAtlasQuadrantSubdiv<enum_Viewport_ShadowAtlasQuadrantSubdiv>` | :ref:`shadow_atlas_quad_1<class_Viewport_property_shadow_atlas_quad_1>` | ``2`` |
  62. +-------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+---------------------+
  63. | :ref:`ShadowAtlasQuadrantSubdiv<enum_Viewport_ShadowAtlasQuadrantSubdiv>` | :ref:`shadow_atlas_quad_2<class_Viewport_property_shadow_atlas_quad_2>` | ``3`` |
  64. +-------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+---------------------+
  65. | :ref:`ShadowAtlasQuadrantSubdiv<enum_Viewport_ShadowAtlasQuadrantSubdiv>` | :ref:`shadow_atlas_quad_3<class_Viewport_property_shadow_atlas_quad_3>` | ``4`` |
  66. +-------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+---------------------+
  67. | :ref:`int<class_int>` | :ref:`shadow_atlas_size<class_Viewport_property_shadow_atlas_size>` | ``0`` |
  68. +-------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+---------------------+
  69. | :ref:`Vector2<class_Vector2>` | :ref:`size<class_Viewport_property_size>` | ``Vector2( 0, 0 )`` |
  70. +-------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+---------------------+
  71. | :ref:`bool<class_bool>` | :ref:`size_override_stretch<class_Viewport_property_size_override_stretch>` | ``false`` |
  72. +-------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+---------------------+
  73. | :ref:`bool<class_bool>` | :ref:`transparent_bg<class_Viewport_property_transparent_bg>` | ``false`` |
  74. +-------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+---------------------+
  75. | :ref:`World<class_World>` | :ref:`world<class_Viewport_property_world>` | |
  76. +-------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+---------------------+
  77. | :ref:`World2D<class_World2D>` | :ref:`world_2d<class_Viewport_property_world_2d>` | |
  78. +-------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+---------------------+
  79. Methods
  80. -------
  81. +---------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  82. | :ref:`World<class_World>` | :ref:`find_world<class_Viewport_method_find_world>` **(** **)** const |
  83. +---------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  84. | :ref:`World2D<class_World2D>` | :ref:`find_world_2d<class_Viewport_method_find_world_2d>` **(** **)** const |
  85. +---------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  86. | :ref:`Camera<class_Camera>` | :ref:`get_camera<class_Viewport_method_get_camera>` **(** **)** const |
  87. +---------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  88. | :ref:`Transform2D<class_Transform2D>` | :ref:`get_final_transform<class_Viewport_method_get_final_transform>` **(** **)** const |
  89. +---------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  90. | :ref:`Control<class_Control>` | :ref:`get_modal_stack_top<class_Viewport_method_get_modal_stack_top>` **(** **)** const |
  91. +---------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  92. | :ref:`Vector2<class_Vector2>` | :ref:`get_mouse_position<class_Viewport_method_get_mouse_position>` **(** **)** const |
  93. +---------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  94. | :ref:`int<class_int>` | :ref:`get_render_info<class_Viewport_method_get_render_info>` **(** :ref:`RenderInfo<enum_Viewport_RenderInfo>` info **)** |
  95. +---------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  96. | :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 |
  97. +---------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  98. | :ref:`Vector2<class_Vector2>` | :ref:`get_size_override<class_Viewport_method_get_size_override>` **(** **)** const |
  99. +---------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  100. | :ref:`ViewportTexture<class_ViewportTexture>` | :ref:`get_texture<class_Viewport_method_get_texture>` **(** **)** const |
  101. +---------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  102. | :ref:`RID<class_RID>` | :ref:`get_viewport_rid<class_Viewport_method_get_viewport_rid>` **(** **)** const |
  103. +---------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  104. | :ref:`Rect2<class_Rect2>` | :ref:`get_visible_rect<class_Viewport_method_get_visible_rect>` **(** **)** const |
  105. +---------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  106. | :ref:`Variant<class_Variant>` | :ref:`gui_get_drag_data<class_Viewport_method_gui_get_drag_data>` **(** **)** const |
  107. +---------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  108. | :ref:`bool<class_bool>` | :ref:`gui_has_modal_stack<class_Viewport_method_gui_has_modal_stack>` **(** **)** const |
  109. +---------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  110. | :ref:`bool<class_bool>` | :ref:`gui_is_dragging<class_Viewport_method_gui_is_dragging>` **(** **)** const |
  111. +---------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  112. | void | :ref:`input<class_Viewport_method_input>` **(** :ref:`InputEvent<class_InputEvent>` local_event **)** |
  113. +---------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  114. | :ref:`bool<class_bool>` | :ref:`is_input_handled<class_Viewport_method_is_input_handled>` **(** **)** const |
  115. +---------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  116. | :ref:`bool<class_bool>` | :ref:`is_size_override_enabled<class_Viewport_method_is_size_override_enabled>` **(** **)** const |
  117. +---------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  118. | void | :ref:`set_attach_to_screen_rect<class_Viewport_method_set_attach_to_screen_rect>` **(** :ref:`Rect2<class_Rect2>` rect **)** |
  119. +---------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  120. | void | :ref:`set_input_as_handled<class_Viewport_method_set_input_as_handled>` **(** **)** |
  121. +---------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  122. | 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 **)** |
  123. +---------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  124. | 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 ) **)** |
  125. +---------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  126. | void | :ref:`unhandled_input<class_Viewport_method_unhandled_input>` **(** :ref:`InputEvent<class_InputEvent>` local_event **)** |
  127. +---------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  128. | void | :ref:`update_worlds<class_Viewport_method_update_worlds>` **(** **)** |
  129. +---------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  130. | void | :ref:`warp_mouse<class_Viewport_method_warp_mouse>` **(** :ref:`Vector2<class_Vector2>` to_position **)** |
  131. +---------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  132. Signals
  133. -------
  134. .. _class_Viewport_signal_gui_focus_changed:
  135. - **gui_focus_changed** **(** :ref:`Control<class_Control>` node **)**
  136. Emitted when a Control node grabs keyboard focus.
  137. ----
  138. .. _class_Viewport_signal_size_changed:
  139. - **size_changed** **(** **)**
  140. 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.
  141. Enumerations
  142. ------------
  143. .. _enum_Viewport_UpdateMode:
  144. .. _class_Viewport_constant_UPDATE_DISABLED:
  145. .. _class_Viewport_constant_UPDATE_ONCE:
  146. .. _class_Viewport_constant_UPDATE_WHEN_VISIBLE:
  147. .. _class_Viewport_constant_UPDATE_ALWAYS:
  148. enum **UpdateMode**:
  149. - **UPDATE_DISABLED** = **0** --- Do not update the render target.
  150. - **UPDATE_ONCE** = **1** --- Update the render target once, then switch to :ref:`UPDATE_DISABLED<class_Viewport_constant_UPDATE_DISABLED>`.
  151. - **UPDATE_WHEN_VISIBLE** = **2** --- Update the render target only when it is visible. This is the default value.
  152. - **UPDATE_ALWAYS** = **3** --- Always update the render target.
  153. ----
  154. .. _enum_Viewport_ShadowAtlasQuadrantSubdiv:
  155. .. _class_Viewport_constant_SHADOW_ATLAS_QUADRANT_SUBDIV_DISABLED:
  156. .. _class_Viewport_constant_SHADOW_ATLAS_QUADRANT_SUBDIV_1:
  157. .. _class_Viewport_constant_SHADOW_ATLAS_QUADRANT_SUBDIV_4:
  158. .. _class_Viewport_constant_SHADOW_ATLAS_QUADRANT_SUBDIV_16:
  159. .. _class_Viewport_constant_SHADOW_ATLAS_QUADRANT_SUBDIV_64:
  160. .. _class_Viewport_constant_SHADOW_ATLAS_QUADRANT_SUBDIV_256:
  161. .. _class_Viewport_constant_SHADOW_ATLAS_QUADRANT_SUBDIV_1024:
  162. .. _class_Viewport_constant_SHADOW_ATLAS_QUADRANT_SUBDIV_MAX:
  163. enum **ShadowAtlasQuadrantSubdiv**:
  164. - **SHADOW_ATLAS_QUADRANT_SUBDIV_DISABLED** = **0** --- This quadrant will not be used.
  165. - **SHADOW_ATLAS_QUADRANT_SUBDIV_1** = **1** --- This quadrant will only be used by one shadow map.
  166. - **SHADOW_ATLAS_QUADRANT_SUBDIV_4** = **2** --- This quadrant will be split in 4 and used by up to 4 shadow maps.
  167. - **SHADOW_ATLAS_QUADRANT_SUBDIV_16** = **3** --- This quadrant will be split 16 ways and used by up to 16 shadow maps.
  168. - **SHADOW_ATLAS_QUADRANT_SUBDIV_64** = **4** --- This quadrant will be split 64 ways and used by up to 64 shadow maps.
  169. - **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.
  170. - **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.
  171. - **SHADOW_ATLAS_QUADRANT_SUBDIV_MAX** = **7** --- Represents the size of the :ref:`ShadowAtlasQuadrantSubdiv<enum_Viewport_ShadowAtlasQuadrantSubdiv>` enum.
  172. ----
  173. .. _enum_Viewport_RenderInfo:
  174. .. _class_Viewport_constant_RENDER_INFO_OBJECTS_IN_FRAME:
  175. .. _class_Viewport_constant_RENDER_INFO_VERTICES_IN_FRAME:
  176. .. _class_Viewport_constant_RENDER_INFO_MATERIAL_CHANGES_IN_FRAME:
  177. .. _class_Viewport_constant_RENDER_INFO_SHADER_CHANGES_IN_FRAME:
  178. .. _class_Viewport_constant_RENDER_INFO_SURFACE_CHANGES_IN_FRAME:
  179. .. _class_Viewport_constant_RENDER_INFO_DRAW_CALLS_IN_FRAME:
  180. .. _class_Viewport_constant_RENDER_INFO_MAX:
  181. enum **RenderInfo**:
  182. - **RENDER_INFO_OBJECTS_IN_FRAME** = **0** --- Amount of objects in frame.
  183. - **RENDER_INFO_VERTICES_IN_FRAME** = **1** --- Amount of vertices in frame.
  184. - **RENDER_INFO_MATERIAL_CHANGES_IN_FRAME** = **2** --- Amount of material changes in frame.
  185. - **RENDER_INFO_SHADER_CHANGES_IN_FRAME** = **3** --- Amount of shader changes in frame.
  186. - **RENDER_INFO_SURFACE_CHANGES_IN_FRAME** = **4** --- Amount of surface changes in frame.
  187. - **RENDER_INFO_DRAW_CALLS_IN_FRAME** = **5** --- Amount of draw calls in frame.
  188. - **RENDER_INFO_MAX** = **6** --- Represents the size of the :ref:`RenderInfo<enum_Viewport_RenderInfo>` enum.
  189. ----
  190. .. _enum_Viewport_DebugDraw:
  191. .. _class_Viewport_constant_DEBUG_DRAW_DISABLED:
  192. .. _class_Viewport_constant_DEBUG_DRAW_UNSHADED:
  193. .. _class_Viewport_constant_DEBUG_DRAW_OVERDRAW:
  194. .. _class_Viewport_constant_DEBUG_DRAW_WIREFRAME:
  195. .. _class_Viewport_constant_DEBUG_DRAW_GI_PROBE_ALBEDO:
  196. .. _class_Viewport_constant_DEBUG_DRAW_GI_PROBE_LIGHTING:
  197. .. _class_Viewport_constant_DEBUG_DRAW_GI_PROBE_EMISSION:
  198. .. _class_Viewport_constant_DEBUG_DRAW_SHADOW_ATLAS:
  199. .. _class_Viewport_constant_DEBUG_DRAW_DIRECTIONAL_SHADOW_ATLAS:
  200. .. _class_Viewport_constant_DEBUG_DRAW_SCENE_LUMINANCE:
  201. .. _class_Viewport_constant_DEBUG_DRAW_SSAO:
  202. enum **DebugDraw**:
  203. - **DEBUG_DRAW_DISABLED** = **0** --- Objects are displayed normally.
  204. - **DEBUG_DRAW_UNSHADED** = **1** --- Objects are displayed without light information.
  205. - **DEBUG_DRAW_OVERDRAW** = **3** --- Objected are displayed semi-transparent with additive blending so you can see where they intersect.
  206. - **DEBUG_DRAW_WIREFRAME** = **4** --- Objects are displayed in wireframe style.
  207. - **DEBUG_DRAW_GI_PROBE_ALBEDO** = **6**
  208. - **DEBUG_DRAW_GI_PROBE_LIGHTING** = **7**
  209. - **DEBUG_DRAW_GI_PROBE_EMISSION** = **8**
  210. - **DEBUG_DRAW_SHADOW_ATLAS** = **9**
  211. - **DEBUG_DRAW_DIRECTIONAL_SHADOW_ATLAS** = **10**
  212. - **DEBUG_DRAW_SCENE_LUMINANCE** = **11**
  213. - **DEBUG_DRAW_SSAO** = **12**
  214. ----
  215. .. _enum_Viewport_MSAA:
  216. .. _class_Viewport_constant_MSAA_DISABLED:
  217. .. _class_Viewport_constant_MSAA_2X:
  218. .. _class_Viewport_constant_MSAA_4X:
  219. .. _class_Viewport_constant_MSAA_8X:
  220. .. _class_Viewport_constant_MSAA_16X:
  221. enum **MSAA**:
  222. - **MSAA_DISABLED** = **0** --- Multisample anti-aliasing mode disabled. This is the default value.
  223. - **MSAA_2X** = **1** --- Use 2x Multisample Antialiasing.
  224. - **MSAA_4X** = **2** --- Use 4x Multisample Antialiasing.
  225. - **MSAA_8X** = **3** --- Use 8x Multisample Antialiasing. Likely unsupported on low-end and older hardware.
  226. - **MSAA_16X** = **4** --- Use 16x Multisample Antialiasing. Likely unsupported on medium and low-end hardware.
  227. ----
  228. .. _enum_Viewport_ClearMode:
  229. .. _class_Viewport_constant_CLEAR_MODE_ALWAYS:
  230. .. _class_Viewport_constant_CLEAR_MODE_NEVER:
  231. .. _class_Viewport_constant_CLEAR_MODE_ONLY_NEXT_FRAME:
  232. enum **ClearMode**:
  233. - **CLEAR_MODE_ALWAYS** = **0** --- Always clear the render target before drawing.
  234. - **CLEAR_MODE_NEVER** = **1** --- Never clear the render target.
  235. - **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>`.
  236. ----
  237. .. _enum_Viewport_DefaultCanvasItemTextureFilter:
  238. .. _class_Viewport_constant_DEFAULT_CANVAS_ITEM_TEXTURE_FILTER_NEAREST:
  239. .. _class_Viewport_constant_DEFAULT_CANVAS_ITEM_TEXTURE_FILTER_LINEAR:
  240. .. _class_Viewport_constant_DEFAULT_CANVAS_ITEM_TEXTURE_FILTER_LINEAR_WITH_MIPMAPS:
  241. .. _class_Viewport_constant_DEFAULT_CANVAS_ITEM_TEXTURE_FILTER_NEAREST_WITH_MIPMAPS:
  242. .. _class_Viewport_constant_DEFAULT_CANVAS_ITEM_TEXTURE_FILTER_MAX:
  243. enum **DefaultCanvasItemTextureFilter**:
  244. - **DEFAULT_CANVAS_ITEM_TEXTURE_FILTER_NEAREST** = **0**
  245. - **DEFAULT_CANVAS_ITEM_TEXTURE_FILTER_LINEAR** = **1**
  246. - **DEFAULT_CANVAS_ITEM_TEXTURE_FILTER_LINEAR_WITH_MIPMAPS** = **2**
  247. - **DEFAULT_CANVAS_ITEM_TEXTURE_FILTER_NEAREST_WITH_MIPMAPS** = **3**
  248. - **DEFAULT_CANVAS_ITEM_TEXTURE_FILTER_MAX** = **4**
  249. ----
  250. .. _enum_Viewport_DefaultCanvasItemTextureRepeat:
  251. .. _class_Viewport_constant_DEFAULT_CANVAS_ITEM_TEXTURE_REPEAT_DISABLED:
  252. .. _class_Viewport_constant_DEFAULT_CANVAS_ITEM_TEXTURE_REPEAT_ENABLED:
  253. .. _class_Viewport_constant_DEFAULT_CANVAS_ITEM_TEXTURE_REPEAT_MIRROR:
  254. .. _class_Viewport_constant_DEFAULT_CANVAS_ITEM_TEXTURE_REPEAT_MAX:
  255. enum **DefaultCanvasItemTextureRepeat**:
  256. - **DEFAULT_CANVAS_ITEM_TEXTURE_REPEAT_DISABLED** = **0**
  257. - **DEFAULT_CANVAS_ITEM_TEXTURE_REPEAT_ENABLED** = **1**
  258. - **DEFAULT_CANVAS_ITEM_TEXTURE_REPEAT_MIRROR** = **2**
  259. - **DEFAULT_CANVAS_ITEM_TEXTURE_REPEAT_MAX** = **3**
  260. Property Descriptions
  261. ---------------------
  262. .. _class_Viewport_property_arvr:
  263. - :ref:`bool<class_bool>` **arvr**
  264. +-----------+---------------------+
  265. | *Default* | ``false`` |
  266. +-----------+---------------------+
  267. | *Setter* | set_use_arvr(value) |
  268. +-----------+---------------------+
  269. | *Getter* | use_arvr() |
  270. +-----------+---------------------+
  271. If ``true``, the viewport will be used in AR/VR process.
  272. ----
  273. .. _class_Viewport_property_audio_listener_enable_2d:
  274. - :ref:`bool<class_bool>` **audio_listener_enable_2d**
  275. +-----------+---------------------------------+
  276. | *Default* | ``false`` |
  277. +-----------+---------------------------------+
  278. | *Setter* | set_as_audio_listener_2d(value) |
  279. +-----------+---------------------------------+
  280. | *Getter* | is_audio_listener_2d() |
  281. +-----------+---------------------------------+
  282. If ``true``, the viewport will process 2D audio streams.
  283. ----
  284. .. _class_Viewport_property_audio_listener_enable_3d:
  285. - :ref:`bool<class_bool>` **audio_listener_enable_3d**
  286. +-----------+------------------------------+
  287. | *Default* | ``false`` |
  288. +-----------+------------------------------+
  289. | *Setter* | set_as_audio_listener(value) |
  290. +-----------+------------------------------+
  291. | *Getter* | is_audio_listener() |
  292. +-----------+------------------------------+
  293. If ``true``, the viewport will process 3D audio streams.
  294. ----
  295. .. _class_Viewport_property_canvas_item_default_texture_filter:
  296. - :ref:`DefaultCanvasItemTextureFilter<enum_Viewport_DefaultCanvasItemTextureFilter>` **canvas_item_default_texture_filter**
  297. +-----------+-----------------------------------------------+
  298. | *Default* | ``1`` |
  299. +-----------+-----------------------------------------------+
  300. | *Setter* | set_default_canvas_item_texture_filter(value) |
  301. +-----------+-----------------------------------------------+
  302. | *Getter* | get_default_canvas_item_texture_filter() |
  303. +-----------+-----------------------------------------------+
  304. ----
  305. .. _class_Viewport_property_canvas_item_default_texture_repeat:
  306. - :ref:`DefaultCanvasItemTextureRepeat<enum_Viewport_DefaultCanvasItemTextureRepeat>` **canvas_item_default_texture_repeat**
  307. +-----------+-----------------------------------------------+
  308. | *Default* | ``0`` |
  309. +-----------+-----------------------------------------------+
  310. | *Setter* | set_default_canvas_item_texture_repeat(value) |
  311. +-----------+-----------------------------------------------+
  312. | *Getter* | get_default_canvas_item_texture_repeat() |
  313. +-----------+-----------------------------------------------+
  314. ----
  315. .. _class_Viewport_property_canvas_transform:
  316. - :ref:`Transform2D<class_Transform2D>` **canvas_transform**
  317. +----------+-----------------------------+
  318. | *Setter* | set_canvas_transform(value) |
  319. +----------+-----------------------------+
  320. | *Getter* | get_canvas_transform() |
  321. +----------+-----------------------------+
  322. 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.
  323. ----
  324. .. _class_Viewport_property_debug_draw:
  325. - :ref:`DebugDraw<enum_Viewport_DebugDraw>` **debug_draw**
  326. +-----------+-----------------------+
  327. | *Default* | ``0`` |
  328. +-----------+-----------------------+
  329. | *Setter* | set_debug_draw(value) |
  330. +-----------+-----------------------+
  331. | *Getter* | get_debug_draw() |
  332. +-----------+-----------------------+
  333. The overlay mode for test rendered geometry in debug purposes.
  334. ----
  335. .. _class_Viewport_property_global_canvas_transform:
  336. - :ref:`Transform2D<class_Transform2D>` **global_canvas_transform**
  337. +----------+------------------------------------+
  338. | *Setter* | set_global_canvas_transform(value) |
  339. +----------+------------------------------------+
  340. | *Getter* | get_global_canvas_transform() |
  341. +----------+------------------------------------+
  342. The global canvas transform of the viewport. The canvas transform is relative to this.
  343. ----
  344. .. _class_Viewport_property_gui_disable_input:
  345. - :ref:`bool<class_bool>` **gui_disable_input**
  346. +-----------+--------------------------+
  347. | *Default* | ``false`` |
  348. +-----------+--------------------------+
  349. | *Setter* | set_disable_input(value) |
  350. +-----------+--------------------------+
  351. | *Getter* | is_input_disabled() |
  352. +-----------+--------------------------+
  353. If ``true``, the viewport will not receive input event.
  354. ----
  355. .. _class_Viewport_property_gui_snap_controls_to_pixels:
  356. - :ref:`bool<class_bool>` **gui_snap_controls_to_pixels**
  357. +-----------+--------------------------------------+
  358. | *Default* | ``true`` |
  359. +-----------+--------------------------------------+
  360. | *Setter* | set_snap_controls_to_pixels(value) |
  361. +-----------+--------------------------------------+
  362. | *Getter* | is_snap_controls_to_pixels_enabled() |
  363. +-----------+--------------------------------------+
  364. If ``true``, the GUI controls on the viewport will lay pixel perfectly.
  365. ----
  366. .. _class_Viewport_property_handle_input_locally:
  367. - :ref:`bool<class_bool>` **handle_input_locally**
  368. +-----------+---------------------------------+
  369. | *Default* | ``true`` |
  370. +-----------+---------------------------------+
  371. | *Setter* | set_handle_input_locally(value) |
  372. +-----------+---------------------------------+
  373. | *Getter* | is_handling_input_locally() |
  374. +-----------+---------------------------------+
  375. ----
  376. .. _class_Viewport_property_msaa:
  377. - :ref:`MSAA<enum_Viewport_MSAA>` **msaa**
  378. +-----------+-----------------+
  379. | *Default* | ``0`` |
  380. +-----------+-----------------+
  381. | *Setter* | set_msaa(value) |
  382. +-----------+-----------------+
  383. | *Getter* | get_msaa() |
  384. +-----------+-----------------+
  385. 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.
  386. ----
  387. .. _class_Viewport_property_own_world:
  388. - :ref:`bool<class_bool>` **own_world**
  389. +-----------+--------------------------+
  390. | *Default* | ``false`` |
  391. +-----------+--------------------------+
  392. | *Setter* | set_use_own_world(value) |
  393. +-----------+--------------------------+
  394. | *Getter* | is_using_own_world() |
  395. +-----------+--------------------------+
  396. If ``true``, the viewport will use :ref:`World<class_World>` defined in ``world`` property.
  397. ----
  398. .. _class_Viewport_property_physics_object_picking:
  399. - :ref:`bool<class_bool>` **physics_object_picking**
  400. +-----------+-----------------------------------+
  401. | *Default* | ``false`` |
  402. +-----------+-----------------------------------+
  403. | *Setter* | set_physics_object_picking(value) |
  404. +-----------+-----------------------------------+
  405. | *Getter* | get_physics_object_picking() |
  406. +-----------+-----------------------------------+
  407. If ``true``, the objects rendered by viewport become subjects of mouse picking process.
  408. ----
  409. .. _class_Viewport_property_render_direct_to_screen:
  410. - :ref:`bool<class_bool>` **render_direct_to_screen**
  411. +-----------+----------------------------------------+
  412. | *Default* | ``false`` |
  413. +-----------+----------------------------------------+
  414. | *Setter* | set_use_render_direct_to_screen(value) |
  415. +-----------+----------------------------------------+
  416. | *Getter* | is_using_render_direct_to_screen() |
  417. +-----------+----------------------------------------+
  418. 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>`.
  419. ----
  420. .. _class_Viewport_property_render_target_clear_mode:
  421. - :ref:`ClearMode<enum_Viewport_ClearMode>` **render_target_clear_mode**
  422. +-----------+-----------------------+
  423. | *Default* | ``0`` |
  424. +-----------+-----------------------+
  425. | *Setter* | set_clear_mode(value) |
  426. +-----------+-----------------------+
  427. | *Getter* | get_clear_mode() |
  428. +-----------+-----------------------+
  429. The clear mode when viewport used as a render target.
  430. ----
  431. .. _class_Viewport_property_render_target_update_mode:
  432. - :ref:`UpdateMode<enum_Viewport_UpdateMode>` **render_target_update_mode**
  433. +-----------+------------------------+
  434. | *Default* | ``2`` |
  435. +-----------+------------------------+
  436. | *Setter* | set_update_mode(value) |
  437. +-----------+------------------------+
  438. | *Getter* | get_update_mode() |
  439. +-----------+------------------------+
  440. The update mode when viewport used as a render target.
  441. ----
  442. .. _class_Viewport_property_shadow_atlas_quad_0:
  443. - :ref:`ShadowAtlasQuadrantSubdiv<enum_Viewport_ShadowAtlasQuadrantSubdiv>` **shadow_atlas_quad_0**
  444. +-----------+-----------------------------------------+
  445. | *Default* | ``2`` |
  446. +-----------+-----------------------------------------+
  447. | *Setter* | set_shadow_atlas_quadrant_subdiv(value) |
  448. +-----------+-----------------------------------------+
  449. | *Getter* | get_shadow_atlas_quadrant_subdiv() |
  450. +-----------+-----------------------------------------+
  451. The subdivision amount of the first quadrant on the shadow atlas.
  452. ----
  453. .. _class_Viewport_property_shadow_atlas_quad_1:
  454. - :ref:`ShadowAtlasQuadrantSubdiv<enum_Viewport_ShadowAtlasQuadrantSubdiv>` **shadow_atlas_quad_1**
  455. +-----------+-----------------------------------------+
  456. | *Default* | ``2`` |
  457. +-----------+-----------------------------------------+
  458. | *Setter* | set_shadow_atlas_quadrant_subdiv(value) |
  459. +-----------+-----------------------------------------+
  460. | *Getter* | get_shadow_atlas_quadrant_subdiv() |
  461. +-----------+-----------------------------------------+
  462. The subdivision amount of the second quadrant on the shadow atlas.
  463. ----
  464. .. _class_Viewport_property_shadow_atlas_quad_2:
  465. - :ref:`ShadowAtlasQuadrantSubdiv<enum_Viewport_ShadowAtlasQuadrantSubdiv>` **shadow_atlas_quad_2**
  466. +-----------+-----------------------------------------+
  467. | *Default* | ``3`` |
  468. +-----------+-----------------------------------------+
  469. | *Setter* | set_shadow_atlas_quadrant_subdiv(value) |
  470. +-----------+-----------------------------------------+
  471. | *Getter* | get_shadow_atlas_quadrant_subdiv() |
  472. +-----------+-----------------------------------------+
  473. The subdivision amount of the third quadrant on the shadow atlas.
  474. ----
  475. .. _class_Viewport_property_shadow_atlas_quad_3:
  476. - :ref:`ShadowAtlasQuadrantSubdiv<enum_Viewport_ShadowAtlasQuadrantSubdiv>` **shadow_atlas_quad_3**
  477. +-----------+-----------------------------------------+
  478. | *Default* | ``4`` |
  479. +-----------+-----------------------------------------+
  480. | *Setter* | set_shadow_atlas_quadrant_subdiv(value) |
  481. +-----------+-----------------------------------------+
  482. | *Getter* | get_shadow_atlas_quadrant_subdiv() |
  483. +-----------+-----------------------------------------+
  484. The subdivision amount of the fourth quadrant on the shadow atlas.
  485. ----
  486. .. _class_Viewport_property_shadow_atlas_size:
  487. - :ref:`int<class_int>` **shadow_atlas_size**
  488. +-----------+------------------------------+
  489. | *Default* | ``0`` |
  490. +-----------+------------------------------+
  491. | *Setter* | set_shadow_atlas_size(value) |
  492. +-----------+------------------------------+
  493. | *Getter* | get_shadow_atlas_size() |
  494. +-----------+------------------------------+
  495. The shadow atlas' resolution (used for omni and spot lights). The value will be rounded up to the nearest power of 2.
  496. **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.
  497. ----
  498. .. _class_Viewport_property_size:
  499. - :ref:`Vector2<class_Vector2>` **size**
  500. +-----------+---------------------+
  501. | *Default* | ``Vector2( 0, 0 )`` |
  502. +-----------+---------------------+
  503. | *Setter* | set_size(value) |
  504. +-----------+---------------------+
  505. | *Getter* | get_size() |
  506. +-----------+---------------------+
  507. The width and height of viewport.
  508. ----
  509. .. _class_Viewport_property_size_override_stretch:
  510. - :ref:`bool<class_bool>` **size_override_stretch**
  511. +-----------+------------------------------------+
  512. | *Default* | ``false`` |
  513. +-----------+------------------------------------+
  514. | *Setter* | set_size_override_stretch(value) |
  515. +-----------+------------------------------------+
  516. | *Getter* | is_size_override_stretch_enabled() |
  517. +-----------+------------------------------------+
  518. If ``true``, the size override affects stretch as well.
  519. ----
  520. .. _class_Viewport_property_transparent_bg:
  521. - :ref:`bool<class_bool>` **transparent_bg**
  522. +-----------+-----------------------------------+
  523. | *Default* | ``false`` |
  524. +-----------+-----------------------------------+
  525. | *Setter* | set_transparent_background(value) |
  526. +-----------+-----------------------------------+
  527. | *Getter* | has_transparent_background() |
  528. +-----------+-----------------------------------+
  529. If ``true``, the viewport should render its background as transparent.
  530. ----
  531. .. _class_Viewport_property_world:
  532. - :ref:`World<class_World>` **world**
  533. +----------+------------------+
  534. | *Setter* | set_world(value) |
  535. +----------+------------------+
  536. | *Getter* | get_world() |
  537. +----------+------------------+
  538. The custom :ref:`World<class_World>` which can be used as 3D environment source.
  539. ----
  540. .. _class_Viewport_property_world_2d:
  541. - :ref:`World2D<class_World2D>` **world_2d**
  542. +----------+---------------------+
  543. | *Setter* | set_world_2d(value) |
  544. +----------+---------------------+
  545. | *Getter* | get_world_2d() |
  546. +----------+---------------------+
  547. The custom :ref:`World2D<class_World2D>` which can be used as 2D environment source.
  548. Method Descriptions
  549. -------------------
  550. .. _class_Viewport_method_find_world:
  551. - :ref:`World<class_World>` **find_world** **(** **)** const
  552. Returns the 3D world of the viewport, or if none the world of the parent viewport.
  553. ----
  554. .. _class_Viewport_method_find_world_2d:
  555. - :ref:`World2D<class_World2D>` **find_world_2d** **(** **)** const
  556. Returns the 2D world of the viewport.
  557. ----
  558. .. _class_Viewport_method_get_camera:
  559. - :ref:`Camera<class_Camera>` **get_camera** **(** **)** const
  560. Returns the active 3D camera.
  561. ----
  562. .. _class_Viewport_method_get_final_transform:
  563. - :ref:`Transform2D<class_Transform2D>` **get_final_transform** **(** **)** const
  564. Returns the total transform of the viewport.
  565. ----
  566. .. _class_Viewport_method_get_modal_stack_top:
  567. - :ref:`Control<class_Control>` **get_modal_stack_top** **(** **)** const
  568. Returns the topmost modal in the stack.
  569. ----
  570. .. _class_Viewport_method_get_mouse_position:
  571. - :ref:`Vector2<class_Vector2>` **get_mouse_position** **(** **)** const
  572. Returns the mouse position relative to the viewport.
  573. ----
  574. .. _class_Viewport_method_get_render_info:
  575. - :ref:`int<class_int>` **get_render_info** **(** :ref:`RenderInfo<enum_Viewport_RenderInfo>` info **)**
  576. Returns information about the viewport from the rendering pipeline.
  577. ----
  578. .. _class_Viewport_method_get_shadow_atlas_quadrant_subdiv:
  579. - :ref:`ShadowAtlasQuadrantSubdiv<enum_Viewport_ShadowAtlasQuadrantSubdiv>` **get_shadow_atlas_quadrant_subdiv** **(** :ref:`int<class_int>` quadrant **)** const
  580. Returns the :ref:`ShadowAtlasQuadrantSubdiv<enum_Viewport_ShadowAtlasQuadrantSubdiv>` of the specified quadrant.
  581. ----
  582. .. _class_Viewport_method_get_size_override:
  583. - :ref:`Vector2<class_Vector2>` **get_size_override** **(** **)** const
  584. Returns the size override set with :ref:`set_size_override<class_Viewport_method_set_size_override>`.
  585. ----
  586. .. _class_Viewport_method_get_texture:
  587. - :ref:`ViewportTexture<class_ViewportTexture>` **get_texture** **(** **)** const
  588. Returns the viewport's texture.
  589. **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:
  590. ::
  591. var img = get_viewport().get_texture().get_data()
  592. img.flip_y()
  593. ----
  594. .. _class_Viewport_method_get_viewport_rid:
  595. - :ref:`RID<class_RID>` **get_viewport_rid** **(** **)** const
  596. Returns the viewport's RID from the :ref:`VisualServer<class_VisualServer>`.
  597. ----
  598. .. _class_Viewport_method_get_visible_rect:
  599. - :ref:`Rect2<class_Rect2>` **get_visible_rect** **(** **)** const
  600. Returns the visible rectangle in global screen coordinates.
  601. ----
  602. .. _class_Viewport_method_gui_get_drag_data:
  603. - :ref:`Variant<class_Variant>` **gui_get_drag_data** **(** **)** const
  604. Returns the drag data from the GUI, that was previously returned by :ref:`Control.get_drag_data<class_Control_method_get_drag_data>`.
  605. ----
  606. .. _class_Viewport_method_gui_has_modal_stack:
  607. - :ref:`bool<class_bool>` **gui_has_modal_stack** **(** **)** const
  608. Returns ``true`` if there are visible modals on-screen.
  609. ----
  610. .. _class_Viewport_method_gui_is_dragging:
  611. - :ref:`bool<class_bool>` **gui_is_dragging** **(** **)** const
  612. Returns ``true`` if the viewport is currently performing a drag operation.
  613. ----
  614. .. _class_Viewport_method_input:
  615. - void **input** **(** :ref:`InputEvent<class_InputEvent>` local_event **)**
  616. ----
  617. .. _class_Viewport_method_is_input_handled:
  618. - :ref:`bool<class_bool>` **is_input_handled** **(** **)** const
  619. ----
  620. .. _class_Viewport_method_is_size_override_enabled:
  621. - :ref:`bool<class_bool>` **is_size_override_enabled** **(** **)** const
  622. Returns ``true`` if the size override is enabled. See :ref:`set_size_override<class_Viewport_method_set_size_override>`.
  623. ----
  624. .. _class_Viewport_method_set_attach_to_screen_rect:
  625. - void **set_attach_to_screen_rect** **(** :ref:`Rect2<class_Rect2>` rect **)**
  626. 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.
  627. ----
  628. .. _class_Viewport_method_set_input_as_handled:
  629. - void **set_input_as_handled** **(** **)**
  630. Stops the input from propagating further down the :ref:`SceneTree<class_SceneTree>`.
  631. ----
  632. .. _class_Viewport_method_set_shadow_atlas_quadrant_subdiv:
  633. - void **set_shadow_atlas_quadrant_subdiv** **(** :ref:`int<class_int>` quadrant, :ref:`ShadowAtlasQuadrantSubdiv<enum_Viewport_ShadowAtlasQuadrantSubdiv>` subdiv **)**
  634. 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.
  635. ----
  636. .. _class_Viewport_method_set_size_override:
  637. - 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 ) **)**
  638. 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.
  639. ----
  640. .. _class_Viewport_method_unhandled_input:
  641. - void **unhandled_input** **(** :ref:`InputEvent<class_InputEvent>` local_event **)**
  642. ----
  643. .. _class_Viewport_method_update_worlds:
  644. - void **update_worlds** **(** **)**
  645. Forces update of the 2D and 3D worlds.
  646. ----
  647. .. _class_Viewport_method_warp_mouse:
  648. - void **warp_mouse** **(** :ref:`Vector2<class_Vector2>` to_position **)**
  649. Warps the mouse to a position relative to the viewport.