class_viewport.rst 76 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537
  1. :github_url: hide
  2. .. DO NOT EDIT THIS FILE!!!
  3. .. Generated automatically from Godot engine sources.
  4. .. Generator: https://github.com/godotengine/godot/tree/3.6/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/3.6/doc/classes/Viewport.xml.
  6. .. _class_Viewport:
  7. Viewport
  8. ========
  9. **Inherits:** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
  10. Creates a sub-view into the screen.
  11. .. rst-class:: classref-introduction-group
  12. Description
  13. -----------
  14. 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.
  15. Optionally, a viewport can have its own 2D or 3D world, so they don't share what they draw with other viewports.
  16. If a viewport is a child of a :ref:`ViewportContainer<class_ViewportContainer>`, the viewport will automatically take up the container's size, otherwise it must be set manually.
  17. Viewports can also choose to be audio listeners, so they generate positional audio depending on a 2D or 3D camera child of it.
  18. Also, viewports can be assigned to different screens in case the devices have multiple screens.
  19. Finally, viewports can also behave as render targets, in which case they will not be visible unless the associated texture is used to draw.
  20. \ **Note:** By default, a newly created Viewport in Godot 3.x will appear to be upside down. Enabling :ref:`render_target_v_flip<class_Viewport_property_render_target_v_flip>` will display the Viewport with the correct orientation.
  21. .. rst-class:: classref-introduction-group
  22. Tutorials
  23. ---------
  24. - :doc:`Viewport and canvas transforms <../tutorials/2d/2d_transforms>`
  25. - :doc:`Viewports tutorial index <../tutorials/rendering/index>`
  26. - `GUI in 3D Demo <https://godotengine.org/asset-library/asset/127>`__
  27. - `3D in 2D Demo <https://godotengine.org/asset-library/asset/128>`__
  28. - `2D in 3D Demo <https://godotengine.org/asset-library/asset/129>`__
  29. - `Screen Capture Demo <https://godotengine.org/asset-library/asset/130>`__
  30. - `Dynamic Split Screen Demo <https://godotengine.org/asset-library/asset/541>`__
  31. - `3D Viewport Scaling Demo <https://godotengine.org/asset-library/asset/586>`__
  32. .. rst-class:: classref-reftable-group
  33. Properties
  34. ----------
  35. .. table::
  36. :widths: auto
  37. +---------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+-------------------------------------------------------------------------------+
  38. | :ref:`bool<class_bool>` | :ref:`arvr<class_Viewport_property_arvr>` | ``false`` |
  39. +---------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+-------------------------------------------------------------------------------+
  40. | :ref:`bool<class_bool>` | :ref:`audio_listener_enable_2d<class_Viewport_property_audio_listener_enable_2d>` | ``false`` |
  41. +---------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+-------------------------------------------------------------------------------+
  42. | :ref:`bool<class_bool>` | :ref:`audio_listener_enable_3d<class_Viewport_property_audio_listener_enable_3d>` | ``false`` |
  43. +---------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+-------------------------------------------------------------------------------+
  44. | :ref:`Transform2D<class_Transform2D>` | :ref:`canvas_transform<class_Viewport_property_canvas_transform>` | |
  45. +---------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+-------------------------------------------------------------------------------+
  46. | :ref:`bool<class_bool>` | :ref:`debanding<class_Viewport_property_debanding>` | ``false`` |
  47. +---------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+-------------------------------------------------------------------------------+
  48. | :ref:`DebugDraw<enum_Viewport_DebugDraw>` | :ref:`debug_draw<class_Viewport_property_debug_draw>` | ``0`` |
  49. +---------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+-------------------------------------------------------------------------------+
  50. | :ref:`bool<class_bool>` | :ref:`disable_3d<class_Viewport_property_disable_3d>` | ``false`` |
  51. +---------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+-------------------------------------------------------------------------------+
  52. | :ref:`bool<class_bool>` | :ref:`fxaa<class_Viewport_property_fxaa>` | ``false`` |
  53. +---------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+-------------------------------------------------------------------------------+
  54. | :ref:`Transform2D<class_Transform2D>` | :ref:`global_canvas_transform<class_Viewport_property_global_canvas_transform>` | |
  55. +---------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+-------------------------------------------------------------------------------+
  56. | :ref:`bool<class_bool>` | :ref:`gui_disable_input<class_Viewport_property_gui_disable_input>` | ``false`` |
  57. +---------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+-------------------------------------------------------------------------------+
  58. | :ref:`bool<class_bool>` | :ref:`gui_snap_controls_to_pixels<class_Viewport_property_gui_snap_controls_to_pixels>` | ``true`` |
  59. +---------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+-------------------------------------------------------------------------------+
  60. | :ref:`bool<class_bool>` | :ref:`handle_input_locally<class_Viewport_property_handle_input_locally>` | ``true`` |
  61. +---------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+-------------------------------------------------------------------------------+
  62. | :ref:`bool<class_bool>` | :ref:`hdr<class_Viewport_property_hdr>` | ``true`` |
  63. +---------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+-------------------------------------------------------------------------------+
  64. | :ref:`bool<class_bool>` | :ref:`keep_3d_linear<class_Viewport_property_keep_3d_linear>` | ``false`` |
  65. +---------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+-------------------------------------------------------------------------------+
  66. | :ref:`MSAA<enum_Viewport_MSAA>` | :ref:`msaa<class_Viewport_property_msaa>` | ``0`` |
  67. +---------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+-------------------------------------------------------------------------------+
  68. | :ref:`bool<class_bool>` | :ref:`own_world<class_Viewport_property_own_world>` | ``false`` |
  69. +---------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+-------------------------------------------------------------------------------+
  70. | :ref:`PhysicsInterpolationMode<enum_Node_PhysicsInterpolationMode>` | physics_interpolation_mode | ``2`` (overrides :ref:`Node<class_Node_property_physics_interpolation_mode>`) |
  71. +---------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+-------------------------------------------------------------------------------+
  72. | :ref:`bool<class_bool>` | :ref:`physics_object_picking<class_Viewport_property_physics_object_picking>` | ``false`` |
  73. +---------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+-------------------------------------------------------------------------------+
  74. | :ref:`bool<class_bool>` | :ref:`render_direct_to_screen<class_Viewport_property_render_direct_to_screen>` | ``false`` |
  75. +---------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+-------------------------------------------------------------------------------+
  76. | :ref:`ClearMode<enum_Viewport_ClearMode>` | :ref:`render_target_clear_mode<class_Viewport_property_render_target_clear_mode>` | ``0`` |
  77. +---------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+-------------------------------------------------------------------------------+
  78. | :ref:`UpdateMode<enum_Viewport_UpdateMode>` | :ref:`render_target_update_mode<class_Viewport_property_render_target_update_mode>` | ``2`` |
  79. +---------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+-------------------------------------------------------------------------------+
  80. | :ref:`bool<class_bool>` | :ref:`render_target_v_flip<class_Viewport_property_render_target_v_flip>` | ``false`` |
  81. +---------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+-------------------------------------------------------------------------------+
  82. | :ref:`ShadowAtlasQuadrantSubdiv<enum_Viewport_ShadowAtlasQuadrantSubdiv>` | :ref:`shadow_atlas_quad_0<class_Viewport_property_shadow_atlas_quad_0>` | ``2`` |
  83. +---------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+-------------------------------------------------------------------------------+
  84. | :ref:`ShadowAtlasQuadrantSubdiv<enum_Viewport_ShadowAtlasQuadrantSubdiv>` | :ref:`shadow_atlas_quad_1<class_Viewport_property_shadow_atlas_quad_1>` | ``2`` |
  85. +---------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+-------------------------------------------------------------------------------+
  86. | :ref:`ShadowAtlasQuadrantSubdiv<enum_Viewport_ShadowAtlasQuadrantSubdiv>` | :ref:`shadow_atlas_quad_2<class_Viewport_property_shadow_atlas_quad_2>` | ``3`` |
  87. +---------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+-------------------------------------------------------------------------------+
  88. | :ref:`ShadowAtlasQuadrantSubdiv<enum_Viewport_ShadowAtlasQuadrantSubdiv>` | :ref:`shadow_atlas_quad_3<class_Viewport_property_shadow_atlas_quad_3>` | ``4`` |
  89. +---------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+-------------------------------------------------------------------------------+
  90. | :ref:`int<class_int>` | :ref:`shadow_atlas_size<class_Viewport_property_shadow_atlas_size>` | ``0`` |
  91. +---------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+-------------------------------------------------------------------------------+
  92. | :ref:`float<class_float>` | :ref:`sharpen_intensity<class_Viewport_property_sharpen_intensity>` | ``0.0`` |
  93. +---------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+-------------------------------------------------------------------------------+
  94. | :ref:`Vector2<class_Vector2>` | :ref:`size<class_Viewport_property_size>` | ``Vector2( 0, 0 )`` |
  95. +---------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+-------------------------------------------------------------------------------+
  96. | :ref:`bool<class_bool>` | :ref:`size_override_stretch<class_Viewport_property_size_override_stretch>` | ``false`` |
  97. +---------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+-------------------------------------------------------------------------------+
  98. | :ref:`bool<class_bool>` | :ref:`transparent_bg<class_Viewport_property_transparent_bg>` | ``false`` |
  99. +---------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+-------------------------------------------------------------------------------+
  100. | :ref:`Usage<enum_Viewport_Usage>` | :ref:`usage<class_Viewport_property_usage>` | ``2`` |
  101. +---------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+-------------------------------------------------------------------------------+
  102. | :ref:`bool<class_bool>` | :ref:`use_32_bpc_depth<class_Viewport_property_use_32_bpc_depth>` | ``false`` |
  103. +---------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+-------------------------------------------------------------------------------+
  104. | :ref:`World<class_World>` | :ref:`world<class_Viewport_property_world>` | |
  105. +---------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+-------------------------------------------------------------------------------+
  106. | :ref:`World2D<class_World2D>` | :ref:`world_2d<class_Viewport_property_world_2d>` | |
  107. +---------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+-------------------------------------------------------------------------------+
  108. .. rst-class:: classref-reftable-group
  109. Methods
  110. -------
  111. .. table::
  112. :widths: auto
  113. +---------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  114. | :ref:`World<class_World>` | :ref:`find_world<class_Viewport_method_find_world>` **(** **)** |const| |
  115. +---------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  116. | :ref:`World2D<class_World2D>` | :ref:`find_world_2d<class_Viewport_method_find_world_2d>` **(** **)** |const| |
  117. +---------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  118. | :ref:`Camera<class_Camera>` | :ref:`get_camera<class_Viewport_method_get_camera>` **(** **)** |const| |
  119. +---------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  120. | :ref:`Transform2D<class_Transform2D>` | :ref:`get_final_transform<class_Viewport_method_get_final_transform>` **(** **)** |const| |
  121. +---------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  122. | :ref:`Control<class_Control>` | :ref:`get_modal_stack_top<class_Viewport_method_get_modal_stack_top>` **(** **)** |const| |
  123. +---------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  124. | :ref:`Vector2<class_Vector2>` | :ref:`get_mouse_position<class_Viewport_method_get_mouse_position>` **(** **)** |const| |
  125. +---------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  126. | :ref:`int<class_int>` | :ref:`get_render_info<class_Viewport_method_get_render_info>` **(** :ref:`RenderInfo<enum_Viewport_RenderInfo>` info **)** |
  127. +---------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  128. | :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| |
  129. +---------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  130. | :ref:`Vector2<class_Vector2>` | :ref:`get_size_override<class_Viewport_method_get_size_override>` **(** **)** |const| |
  131. +---------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  132. | :ref:`ViewportTexture<class_ViewportTexture>` | :ref:`get_texture<class_Viewport_method_get_texture>` **(** **)** |const| |
  133. +---------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  134. | :ref:`RID<class_RID>` | :ref:`get_viewport_rid<class_Viewport_method_get_viewport_rid>` **(** **)** |const| |
  135. +---------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  136. | :ref:`Rect2<class_Rect2>` | :ref:`get_visible_rect<class_Viewport_method_get_visible_rect>` **(** **)** |const| |
  137. +---------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  138. | :ref:`Variant<class_Variant>` | :ref:`gui_get_drag_data<class_Viewport_method_gui_get_drag_data>` **(** **)** |const| |
  139. +---------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  140. | :ref:`bool<class_bool>` | :ref:`gui_has_modal_stack<class_Viewport_method_gui_has_modal_stack>` **(** **)** |const| |
  141. +---------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  142. | :ref:`bool<class_bool>` | :ref:`gui_is_drag_successful<class_Viewport_method_gui_is_drag_successful>` **(** **)** |const| |
  143. +---------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  144. | :ref:`bool<class_bool>` | :ref:`gui_is_dragging<class_Viewport_method_gui_is_dragging>` **(** **)** |const| |
  145. +---------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  146. | void | :ref:`input<class_Viewport_method_input>` **(** :ref:`InputEvent<class_InputEvent>` local_event **)** |
  147. +---------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  148. | :ref:`bool<class_bool>` | :ref:`is_input_handled<class_Viewport_method_is_input_handled>` **(** **)** |const| |
  149. +---------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  150. | :ref:`bool<class_bool>` | :ref:`is_size_override_enabled<class_Viewport_method_is_size_override_enabled>` **(** **)** |const| |
  151. +---------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  152. | void | :ref:`set_attach_to_screen_rect<class_Viewport_method_set_attach_to_screen_rect>` **(** :ref:`Rect2<class_Rect2>` rect **)** |
  153. +---------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  154. | void | :ref:`set_input_as_handled<class_Viewport_method_set_input_as_handled>` **(** **)** |
  155. +---------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  156. | 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 **)** |
  157. +---------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  158. | 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 ) **)** |
  159. +---------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  160. | void | :ref:`unhandled_input<class_Viewport_method_unhandled_input>` **(** :ref:`InputEvent<class_InputEvent>` local_event **)** |
  161. +---------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  162. | void | :ref:`update_worlds<class_Viewport_method_update_worlds>` **(** **)** |
  163. +---------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  164. | void | :ref:`warp_mouse<class_Viewport_method_warp_mouse>` **(** :ref:`Vector2<class_Vector2>` to_position **)** |
  165. +---------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  166. .. rst-class:: classref-section-separator
  167. ----
  168. .. rst-class:: classref-descriptions-group
  169. Signals
  170. -------
  171. .. _class_Viewport_signal_gui_focus_changed:
  172. .. rst-class:: classref-signal
  173. **gui_focus_changed** **(** :ref:`Control<class_Control>` node **)**
  174. Emitted when a Control node grabs keyboard focus.
  175. .. rst-class:: classref-item-separator
  176. ----
  177. .. _class_Viewport_signal_size_changed:
  178. .. rst-class:: classref-signal
  179. **size_changed** **(** **)**
  180. 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.
  181. .. rst-class:: classref-section-separator
  182. ----
  183. .. rst-class:: classref-descriptions-group
  184. Enumerations
  185. ------------
  186. .. _enum_Viewport_UpdateMode:
  187. .. rst-class:: classref-enumeration
  188. enum **UpdateMode**:
  189. .. _class_Viewport_constant_UPDATE_DISABLED:
  190. .. rst-class:: classref-enumeration-constant
  191. :ref:`UpdateMode<enum_Viewport_UpdateMode>` **UPDATE_DISABLED** = ``0``
  192. Do not update the render target.
  193. .. _class_Viewport_constant_UPDATE_ONCE:
  194. .. rst-class:: classref-enumeration-constant
  195. :ref:`UpdateMode<enum_Viewport_UpdateMode>` **UPDATE_ONCE** = ``1``
  196. Update the render target once, then switch to :ref:`UPDATE_DISABLED<class_Viewport_constant_UPDATE_DISABLED>`.
  197. .. _class_Viewport_constant_UPDATE_WHEN_VISIBLE:
  198. .. rst-class:: classref-enumeration-constant
  199. :ref:`UpdateMode<enum_Viewport_UpdateMode>` **UPDATE_WHEN_VISIBLE** = ``2``
  200. Update the render target only when it is visible. This is the default value.
  201. .. _class_Viewport_constant_UPDATE_ALWAYS:
  202. .. rst-class:: classref-enumeration-constant
  203. :ref:`UpdateMode<enum_Viewport_UpdateMode>` **UPDATE_ALWAYS** = ``3``
  204. Always update the render target.
  205. .. rst-class:: classref-item-separator
  206. ----
  207. .. _enum_Viewport_ShadowAtlasQuadrantSubdiv:
  208. .. rst-class:: classref-enumeration
  209. enum **ShadowAtlasQuadrantSubdiv**:
  210. .. _class_Viewport_constant_SHADOW_ATLAS_QUADRANT_SUBDIV_DISABLED:
  211. .. rst-class:: classref-enumeration-constant
  212. :ref:`ShadowAtlasQuadrantSubdiv<enum_Viewport_ShadowAtlasQuadrantSubdiv>` **SHADOW_ATLAS_QUADRANT_SUBDIV_DISABLED** = ``0``
  213. This quadrant will not be used.
  214. .. _class_Viewport_constant_SHADOW_ATLAS_QUADRANT_SUBDIV_1:
  215. .. rst-class:: classref-enumeration-constant
  216. :ref:`ShadowAtlasQuadrantSubdiv<enum_Viewport_ShadowAtlasQuadrantSubdiv>` **SHADOW_ATLAS_QUADRANT_SUBDIV_1** = ``1``
  217. This quadrant will only be used by one shadow map.
  218. .. _class_Viewport_constant_SHADOW_ATLAS_QUADRANT_SUBDIV_4:
  219. .. rst-class:: classref-enumeration-constant
  220. :ref:`ShadowAtlasQuadrantSubdiv<enum_Viewport_ShadowAtlasQuadrantSubdiv>` **SHADOW_ATLAS_QUADRANT_SUBDIV_4** = ``2``
  221. This quadrant will be split in 4 and used by up to 4 shadow maps.
  222. .. _class_Viewport_constant_SHADOW_ATLAS_QUADRANT_SUBDIV_16:
  223. .. rst-class:: classref-enumeration-constant
  224. :ref:`ShadowAtlasQuadrantSubdiv<enum_Viewport_ShadowAtlasQuadrantSubdiv>` **SHADOW_ATLAS_QUADRANT_SUBDIV_16** = ``3``
  225. This quadrant will be split 16 ways and used by up to 16 shadow maps.
  226. .. _class_Viewport_constant_SHADOW_ATLAS_QUADRANT_SUBDIV_64:
  227. .. rst-class:: classref-enumeration-constant
  228. :ref:`ShadowAtlasQuadrantSubdiv<enum_Viewport_ShadowAtlasQuadrantSubdiv>` **SHADOW_ATLAS_QUADRANT_SUBDIV_64** = ``4``
  229. This quadrant will be split 64 ways and used by up to 64 shadow maps.
  230. .. _class_Viewport_constant_SHADOW_ATLAS_QUADRANT_SUBDIV_256:
  231. .. rst-class:: classref-enumeration-constant
  232. :ref:`ShadowAtlasQuadrantSubdiv<enum_Viewport_ShadowAtlasQuadrantSubdiv>` **SHADOW_ATLAS_QUADRANT_SUBDIV_256** = ``5``
  233. 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.
  234. .. _class_Viewport_constant_SHADOW_ATLAS_QUADRANT_SUBDIV_1024:
  235. .. rst-class:: classref-enumeration-constant
  236. :ref:`ShadowAtlasQuadrantSubdiv<enum_Viewport_ShadowAtlasQuadrantSubdiv>` **SHADOW_ATLAS_QUADRANT_SUBDIV_1024** = ``6``
  237. 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.
  238. .. _class_Viewport_constant_SHADOW_ATLAS_QUADRANT_SUBDIV_MAX:
  239. .. rst-class:: classref-enumeration-constant
  240. :ref:`ShadowAtlasQuadrantSubdiv<enum_Viewport_ShadowAtlasQuadrantSubdiv>` **SHADOW_ATLAS_QUADRANT_SUBDIV_MAX** = ``7``
  241. Represents the size of the :ref:`ShadowAtlasQuadrantSubdiv<enum_Viewport_ShadowAtlasQuadrantSubdiv>` enum.
  242. .. rst-class:: classref-item-separator
  243. ----
  244. .. _enum_Viewport_RenderInfo:
  245. .. rst-class:: classref-enumeration
  246. enum **RenderInfo**:
  247. .. _class_Viewport_constant_RENDER_INFO_OBJECTS_IN_FRAME:
  248. .. rst-class:: classref-enumeration-constant
  249. :ref:`RenderInfo<enum_Viewport_RenderInfo>` **RENDER_INFO_OBJECTS_IN_FRAME** = ``0``
  250. Amount of objects in frame.
  251. .. _class_Viewport_constant_RENDER_INFO_VERTICES_IN_FRAME:
  252. .. rst-class:: classref-enumeration-constant
  253. :ref:`RenderInfo<enum_Viewport_RenderInfo>` **RENDER_INFO_VERTICES_IN_FRAME** = ``1``
  254. Amount of vertices in frame.
  255. .. _class_Viewport_constant_RENDER_INFO_MATERIAL_CHANGES_IN_FRAME:
  256. .. rst-class:: classref-enumeration-constant
  257. :ref:`RenderInfo<enum_Viewport_RenderInfo>` **RENDER_INFO_MATERIAL_CHANGES_IN_FRAME** = ``2``
  258. Amount of material changes in frame.
  259. .. _class_Viewport_constant_RENDER_INFO_SHADER_CHANGES_IN_FRAME:
  260. .. rst-class:: classref-enumeration-constant
  261. :ref:`RenderInfo<enum_Viewport_RenderInfo>` **RENDER_INFO_SHADER_CHANGES_IN_FRAME** = ``3``
  262. Amount of shader changes in frame.
  263. .. _class_Viewport_constant_RENDER_INFO_SURFACE_CHANGES_IN_FRAME:
  264. .. rst-class:: classref-enumeration-constant
  265. :ref:`RenderInfo<enum_Viewport_RenderInfo>` **RENDER_INFO_SURFACE_CHANGES_IN_FRAME** = ``4``
  266. Amount of surface changes in frame.
  267. .. _class_Viewport_constant_RENDER_INFO_DRAW_CALLS_IN_FRAME:
  268. .. rst-class:: classref-enumeration-constant
  269. :ref:`RenderInfo<enum_Viewport_RenderInfo>` **RENDER_INFO_DRAW_CALLS_IN_FRAME** = ``5``
  270. Amount of draw calls in frame.
  271. .. _class_Viewport_constant_RENDER_INFO_2D_ITEMS_IN_FRAME:
  272. .. rst-class:: classref-enumeration-constant
  273. :ref:`RenderInfo<enum_Viewport_RenderInfo>` **RENDER_INFO_2D_ITEMS_IN_FRAME** = ``6``
  274. Amount of items or joined items in frame.
  275. .. _class_Viewport_constant_RENDER_INFO_2D_DRAW_CALLS_IN_FRAME:
  276. .. rst-class:: classref-enumeration-constant
  277. :ref:`RenderInfo<enum_Viewport_RenderInfo>` **RENDER_INFO_2D_DRAW_CALLS_IN_FRAME** = ``7``
  278. Amount of draw calls in frame.
  279. .. _class_Viewport_constant_RENDER_INFO_MAX:
  280. .. rst-class:: classref-enumeration-constant
  281. :ref:`RenderInfo<enum_Viewport_RenderInfo>` **RENDER_INFO_MAX** = ``8``
  282. Represents the size of the :ref:`RenderInfo<enum_Viewport_RenderInfo>` enum.
  283. .. rst-class:: classref-item-separator
  284. ----
  285. .. _enum_Viewport_DebugDraw:
  286. .. rst-class:: classref-enumeration
  287. enum **DebugDraw**:
  288. .. _class_Viewport_constant_DEBUG_DRAW_DISABLED:
  289. .. rst-class:: classref-enumeration-constant
  290. :ref:`DebugDraw<enum_Viewport_DebugDraw>` **DEBUG_DRAW_DISABLED** = ``0``
  291. Objects are displayed normally.
  292. .. _class_Viewport_constant_DEBUG_DRAW_UNSHADED:
  293. .. rst-class:: classref-enumeration-constant
  294. :ref:`DebugDraw<enum_Viewport_DebugDraw>` **DEBUG_DRAW_UNSHADED** = ``1``
  295. Objects are displayed without light information.
  296. .. _class_Viewport_constant_DEBUG_DRAW_OVERDRAW:
  297. .. rst-class:: classref-enumeration-constant
  298. :ref:`DebugDraw<enum_Viewport_DebugDraw>` **DEBUG_DRAW_OVERDRAW** = ``2``
  299. Objected are displayed semi-transparent with additive blending so you can see where they intersect.
  300. .. _class_Viewport_constant_DEBUG_DRAW_WIREFRAME:
  301. .. rst-class:: classref-enumeration-constant
  302. :ref:`DebugDraw<enum_Viewport_DebugDraw>` **DEBUG_DRAW_WIREFRAME** = ``3``
  303. Objects are displayed in wireframe style.
  304. .. rst-class:: classref-item-separator
  305. ----
  306. .. _enum_Viewport_MSAA:
  307. .. rst-class:: classref-enumeration
  308. enum **MSAA**:
  309. .. _class_Viewport_constant_MSAA_DISABLED:
  310. .. rst-class:: classref-enumeration-constant
  311. :ref:`MSAA<enum_Viewport_MSAA>` **MSAA_DISABLED** = ``0``
  312. Multisample anti-aliasing mode disabled. This is the default value.
  313. .. _class_Viewport_constant_MSAA_2X:
  314. .. rst-class:: classref-enumeration-constant
  315. :ref:`MSAA<enum_Viewport_MSAA>` **MSAA_2X** = ``1``
  316. Use 2x Multisample Antialiasing.
  317. .. _class_Viewport_constant_MSAA_4X:
  318. .. rst-class:: classref-enumeration-constant
  319. :ref:`MSAA<enum_Viewport_MSAA>` **MSAA_4X** = ``2``
  320. Use 4x Multisample Antialiasing.
  321. .. _class_Viewport_constant_MSAA_8X:
  322. .. rst-class:: classref-enumeration-constant
  323. :ref:`MSAA<enum_Viewport_MSAA>` **MSAA_8X** = ``3``
  324. Use 8x Multisample Antialiasing. Likely unsupported on low-end and older hardware.
  325. .. _class_Viewport_constant_MSAA_16X:
  326. .. rst-class:: classref-enumeration-constant
  327. :ref:`MSAA<enum_Viewport_MSAA>` **MSAA_16X** = ``4``
  328. Use 16x Multisample Antialiasing. Likely unsupported on medium and low-end hardware.
  329. .. rst-class:: classref-item-separator
  330. ----
  331. .. _enum_Viewport_Usage:
  332. .. rst-class:: classref-enumeration
  333. enum **Usage**:
  334. .. _class_Viewport_constant_USAGE_2D:
  335. .. rst-class:: classref-enumeration-constant
  336. :ref:`Usage<enum_Viewport_Usage>` **USAGE_2D** = ``0``
  337. Allocates all buffers needed for drawing 2D scenes. This takes less VRAM than the 3D usage modes. Note that 3D rendering effects such as glow and HDR are not available when using this mode.
  338. .. _class_Viewport_constant_USAGE_2D_NO_SAMPLING:
  339. .. rst-class:: classref-enumeration-constant
  340. :ref:`Usage<enum_Viewport_Usage>` **USAGE_2D_NO_SAMPLING** = ``1``
  341. Allocates buffers needed for 2D scenes without allocating a buffer for screen copy. Accordingly, you cannot read from the screen. Of the :ref:`Usage<enum_Viewport_Usage>` types, this requires the least VRAM. Note that 3D rendering effects such as glow and HDR are not available when using this mode.
  342. .. _class_Viewport_constant_USAGE_3D:
  343. .. rst-class:: classref-enumeration-constant
  344. :ref:`Usage<enum_Viewport_Usage>` **USAGE_3D** = ``2``
  345. Allocates full buffers for drawing 3D scenes and all 3D effects including buffers needed for 2D scenes and effects.
  346. .. _class_Viewport_constant_USAGE_3D_NO_EFFECTS:
  347. .. rst-class:: classref-enumeration-constant
  348. :ref:`Usage<enum_Viewport_Usage>` **USAGE_3D_NO_EFFECTS** = ``3``
  349. Allocates buffers needed for drawing 3D scenes. But does not allocate buffers needed for reading from the screen and post-processing effects. Saves some VRAM.
  350. .. rst-class:: classref-item-separator
  351. ----
  352. .. _enum_Viewport_ClearMode:
  353. .. rst-class:: classref-enumeration
  354. enum **ClearMode**:
  355. .. _class_Viewport_constant_CLEAR_MODE_ALWAYS:
  356. .. rst-class:: classref-enumeration-constant
  357. :ref:`ClearMode<enum_Viewport_ClearMode>` **CLEAR_MODE_ALWAYS** = ``0``
  358. Always clear the render target before drawing.
  359. .. _class_Viewport_constant_CLEAR_MODE_NEVER:
  360. .. rst-class:: classref-enumeration-constant
  361. :ref:`ClearMode<enum_Viewport_ClearMode>` **CLEAR_MODE_NEVER** = ``1``
  362. Never clear the render target.
  363. .. _class_Viewport_constant_CLEAR_MODE_ONLY_NEXT_FRAME:
  364. .. rst-class:: classref-enumeration-constant
  365. :ref:`ClearMode<enum_Viewport_ClearMode>` **CLEAR_MODE_ONLY_NEXT_FRAME** = ``2``
  366. Clear the render target next frame, then switch to :ref:`CLEAR_MODE_NEVER<class_Viewport_constant_CLEAR_MODE_NEVER>`.
  367. .. rst-class:: classref-section-separator
  368. ----
  369. .. rst-class:: classref-descriptions-group
  370. Property Descriptions
  371. ---------------------
  372. .. _class_Viewport_property_arvr:
  373. .. rst-class:: classref-property
  374. :ref:`bool<class_bool>` **arvr** = ``false``
  375. .. rst-class:: classref-property-setget
  376. - void **set_use_arvr** **(** :ref:`bool<class_bool>` value **)**
  377. - :ref:`bool<class_bool>` **use_arvr** **(** **)**
  378. If ``true``, the viewport will be used in AR/VR process.
  379. .. rst-class:: classref-item-separator
  380. ----
  381. .. _class_Viewport_property_audio_listener_enable_2d:
  382. .. rst-class:: classref-property
  383. :ref:`bool<class_bool>` **audio_listener_enable_2d** = ``false``
  384. .. rst-class:: classref-property-setget
  385. - void **set_as_audio_listener_2d** **(** :ref:`bool<class_bool>` value **)**
  386. - :ref:`bool<class_bool>` **is_audio_listener_2d** **(** **)**
  387. If ``true``, the viewport will process 2D audio streams.
  388. .. rst-class:: classref-item-separator
  389. ----
  390. .. _class_Viewport_property_audio_listener_enable_3d:
  391. .. rst-class:: classref-property
  392. :ref:`bool<class_bool>` **audio_listener_enable_3d** = ``false``
  393. .. rst-class:: classref-property-setget
  394. - void **set_as_audio_listener** **(** :ref:`bool<class_bool>` value **)**
  395. - :ref:`bool<class_bool>` **is_audio_listener** **(** **)**
  396. If ``true``, the viewport will process 3D audio streams.
  397. .. rst-class:: classref-item-separator
  398. ----
  399. .. _class_Viewport_property_canvas_transform:
  400. .. rst-class:: classref-property
  401. :ref:`Transform2D<class_Transform2D>` **canvas_transform**
  402. .. rst-class:: classref-property-setget
  403. - void **set_canvas_transform** **(** :ref:`Transform2D<class_Transform2D>` value **)**
  404. - :ref:`Transform2D<class_Transform2D>` **get_canvas_transform** **(** **)**
  405. 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.
  406. .. rst-class:: classref-item-separator
  407. ----
  408. .. _class_Viewport_property_debanding:
  409. .. rst-class:: classref-property
  410. :ref:`bool<class_bool>` **debanding** = ``false``
  411. .. rst-class:: classref-property-setget
  412. - void **set_use_debanding** **(** :ref:`bool<class_bool>` value **)**
  413. - :ref:`bool<class_bool>` **get_use_debanding** **(** **)**
  414. If ``true``, uses a fast post-processing filter to make banding significantly less visible in 3D. 2D rendering is *not* affected by debanding unless the :ref:`Environment.background_mode<class_Environment_property_background_mode>` is :ref:`Environment.BG_CANVAS<class_Environment_constant_BG_CANVAS>`. In this case, :ref:`usage<class_Viewport_property_usage>` must also be set to :ref:`USAGE_3D<class_Viewport_constant_USAGE_3D>`. See also :ref:`ProjectSettings.rendering/quality/filters/use_debanding<class_ProjectSettings_property_rendering/quality/filters/use_debanding>`.
  415. In some cases, debanding may introduce a slightly noticeable dithering pattern. It's recommended to enable debanding only when actually needed since the dithering pattern will make lossless-compressed screenshots larger.
  416. \ **Note:** Only available on the GLES3 backend. :ref:`hdr<class_Viewport_property_hdr>` must also be ``true`` for debanding to be effective.
  417. .. rst-class:: classref-item-separator
  418. ----
  419. .. _class_Viewport_property_debug_draw:
  420. .. rst-class:: classref-property
  421. :ref:`DebugDraw<enum_Viewport_DebugDraw>` **debug_draw** = ``0``
  422. .. rst-class:: classref-property-setget
  423. - void **set_debug_draw** **(** :ref:`DebugDraw<enum_Viewport_DebugDraw>` value **)**
  424. - :ref:`DebugDraw<enum_Viewport_DebugDraw>` **get_debug_draw** **(** **)**
  425. The overlay mode for test rendered geometry in debug purposes.
  426. .. rst-class:: classref-item-separator
  427. ----
  428. .. _class_Viewport_property_disable_3d:
  429. .. rst-class:: classref-property
  430. :ref:`bool<class_bool>` **disable_3d** = ``false``
  431. .. rst-class:: classref-property-setget
  432. - void **set_disable_3d** **(** :ref:`bool<class_bool>` value **)**
  433. - :ref:`bool<class_bool>` **is_3d_disabled** **(** **)**
  434. If ``true``, the viewport will disable 3D rendering. To actually disable allocation of 3D buffers, set :ref:`usage<class_Viewport_property_usage>` instead.
  435. .. rst-class:: classref-item-separator
  436. ----
  437. .. _class_Viewport_property_fxaa:
  438. .. rst-class:: classref-property
  439. :ref:`bool<class_bool>` **fxaa** = ``false``
  440. .. rst-class:: classref-property-setget
  441. - void **set_use_fxaa** **(** :ref:`bool<class_bool>` value **)**
  442. - :ref:`bool<class_bool>` **get_use_fxaa** **(** **)**
  443. Enables fast approximate antialiasing. FXAA is a popular screen-space antialiasing method, which is fast but will make the image look blurry, especially at lower resolutions. It can still work relatively well at large resolutions such as 1440p and 4K. Some of the lost sharpness can be recovered by enabling contrast-adaptive sharpening (see :ref:`sharpen_intensity<class_Viewport_property_sharpen_intensity>`).
  444. .. rst-class:: classref-item-separator
  445. ----
  446. .. _class_Viewport_property_global_canvas_transform:
  447. .. rst-class:: classref-property
  448. :ref:`Transform2D<class_Transform2D>` **global_canvas_transform**
  449. .. rst-class:: classref-property-setget
  450. - void **set_global_canvas_transform** **(** :ref:`Transform2D<class_Transform2D>` value **)**
  451. - :ref:`Transform2D<class_Transform2D>` **get_global_canvas_transform** **(** **)**
  452. The global canvas transform of the viewport. The canvas transform is relative to this.
  453. .. rst-class:: classref-item-separator
  454. ----
  455. .. _class_Viewport_property_gui_disable_input:
  456. .. rst-class:: classref-property
  457. :ref:`bool<class_bool>` **gui_disable_input** = ``false``
  458. .. rst-class:: classref-property-setget
  459. - void **set_disable_input** **(** :ref:`bool<class_bool>` value **)**
  460. - :ref:`bool<class_bool>` **is_input_disabled** **(** **)**
  461. If ``true``, the viewport will not receive input events.
  462. .. rst-class:: classref-item-separator
  463. ----
  464. .. _class_Viewport_property_gui_snap_controls_to_pixels:
  465. .. rst-class:: classref-property
  466. :ref:`bool<class_bool>` **gui_snap_controls_to_pixels** = ``true``
  467. .. rst-class:: classref-property-setget
  468. - void **set_snap_controls_to_pixels** **(** :ref:`bool<class_bool>` value **)**
  469. - :ref:`bool<class_bool>` **is_snap_controls_to_pixels_enabled** **(** **)**
  470. If ``true``, the GUI controls on the viewport will lay pixel perfectly.
  471. .. rst-class:: classref-item-separator
  472. ----
  473. .. _class_Viewport_property_handle_input_locally:
  474. .. rst-class:: classref-property
  475. :ref:`bool<class_bool>` **handle_input_locally** = ``true``
  476. .. rst-class:: classref-property-setget
  477. - void **set_handle_input_locally** **(** :ref:`bool<class_bool>` value **)**
  478. - :ref:`bool<class_bool>` **is_handling_input_locally** **(** **)**
  479. .. container:: contribute
  480. There is currently no description for this property. Please help us by :ref:`contributing one <doc_updating_the_class_reference>`!
  481. .. rst-class:: classref-item-separator
  482. ----
  483. .. _class_Viewport_property_hdr:
  484. .. rst-class:: classref-property
  485. :ref:`bool<class_bool>` **hdr** = ``true``
  486. .. rst-class:: classref-property-setget
  487. - void **set_hdr** **(** :ref:`bool<class_bool>` value **)**
  488. - :ref:`bool<class_bool>` **get_hdr** **(** **)**
  489. If ``true``, the viewport rendering will receive benefits from High Dynamic Range algorithm. High Dynamic Range allows the viewport to receive values that are outside the 0-1 range. In Godot, HDR uses half floating-point precision (16-bit) by default. To use full floating-point precision (32-bit), enable :ref:`use_32_bpc_depth<class_Viewport_property_use_32_bpc_depth>`.
  490. \ **Note:** Requires :ref:`usage<class_Viewport_property_usage>` to be set to :ref:`USAGE_3D<class_Viewport_constant_USAGE_3D>` or :ref:`USAGE_3D_NO_EFFECTS<class_Viewport_constant_USAGE_3D_NO_EFFECTS>`, since HDR is not supported for 2D.
  491. \ **Note:** Only available on the GLES3 backend.
  492. .. rst-class:: classref-item-separator
  493. ----
  494. .. _class_Viewport_property_keep_3d_linear:
  495. .. rst-class:: classref-property
  496. :ref:`bool<class_bool>` **keep_3d_linear** = ``false``
  497. .. rst-class:: classref-property-setget
  498. - void **set_keep_3d_linear** **(** :ref:`bool<class_bool>` value **)**
  499. - :ref:`bool<class_bool>` **get_keep_3d_linear** **(** **)**
  500. If ``true``, the result after 3D rendering will not have a linear to sRGB color conversion applied. This is important when the viewport is used as a render target where the result is used as a texture on a 3D object rendered in another viewport. It is also important if the viewport is used to create data that is not color based (noise, heightmaps, pickmaps, etc.). Do not enable this when the viewport is used as a texture on a 2D object or if the viewport is your final output. For the GLES2 driver this will convert the sRGB output to linear, this should only be used for VR plugins that require input in linear color space!
  501. .. rst-class:: classref-item-separator
  502. ----
  503. .. _class_Viewport_property_msaa:
  504. .. rst-class:: classref-property
  505. :ref:`MSAA<enum_Viewport_MSAA>` **msaa** = ``0``
  506. .. rst-class:: classref-property-setget
  507. - void **set_msaa** **(** :ref:`MSAA<enum_Viewport_MSAA>` value **)**
  508. - :ref:`MSAA<enum_Viewport_MSAA>` **get_msaa** **(** **)**
  509. 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.
  510. .. rst-class:: classref-item-separator
  511. ----
  512. .. _class_Viewport_property_own_world:
  513. .. rst-class:: classref-property
  514. :ref:`bool<class_bool>` **own_world** = ``false``
  515. .. rst-class:: classref-property-setget
  516. - void **set_use_own_world** **(** :ref:`bool<class_bool>` value **)**
  517. - :ref:`bool<class_bool>` **is_using_own_world** **(** **)**
  518. If ``true``, the viewport will use a unique copy of the :ref:`World<class_World>` defined in :ref:`world<class_Viewport_property_world>`.
  519. .. rst-class:: classref-item-separator
  520. ----
  521. .. _class_Viewport_property_physics_object_picking:
  522. .. rst-class:: classref-property
  523. :ref:`bool<class_bool>` **physics_object_picking** = ``false``
  524. .. rst-class:: classref-property-setget
  525. - void **set_physics_object_picking** **(** :ref:`bool<class_bool>` value **)**
  526. - :ref:`bool<class_bool>` **get_physics_object_picking** **(** **)**
  527. If ``true``, the objects rendered by viewport become subjects of mouse picking process.
  528. .. rst-class:: classref-item-separator
  529. ----
  530. .. _class_Viewport_property_render_direct_to_screen:
  531. .. rst-class:: classref-property
  532. :ref:`bool<class_bool>` **render_direct_to_screen** = ``false``
  533. .. rst-class:: classref-property-setget
  534. - void **set_use_render_direct_to_screen** **(** :ref:`bool<class_bool>` value **)**
  535. - :ref:`bool<class_bool>` **is_using_render_direct_to_screen** **(** **)**
  536. 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>`.
  537. .. rst-class:: classref-item-separator
  538. ----
  539. .. _class_Viewport_property_render_target_clear_mode:
  540. .. rst-class:: classref-property
  541. :ref:`ClearMode<enum_Viewport_ClearMode>` **render_target_clear_mode** = ``0``
  542. .. rst-class:: classref-property-setget
  543. - void **set_clear_mode** **(** :ref:`ClearMode<enum_Viewport_ClearMode>` value **)**
  544. - :ref:`ClearMode<enum_Viewport_ClearMode>` **get_clear_mode** **(** **)**
  545. The clear mode when viewport used as a render target.
  546. \ **Note:** This property is intended for 2D usage.
  547. .. rst-class:: classref-item-separator
  548. ----
  549. .. _class_Viewport_property_render_target_update_mode:
  550. .. rst-class:: classref-property
  551. :ref:`UpdateMode<enum_Viewport_UpdateMode>` **render_target_update_mode** = ``2``
  552. .. rst-class:: classref-property-setget
  553. - void **set_update_mode** **(** :ref:`UpdateMode<enum_Viewport_UpdateMode>` value **)**
  554. - :ref:`UpdateMode<enum_Viewport_UpdateMode>` **get_update_mode** **(** **)**
  555. The update mode when viewport used as a render target.
  556. .. rst-class:: classref-item-separator
  557. ----
  558. .. _class_Viewport_property_render_target_v_flip:
  559. .. rst-class:: classref-property
  560. :ref:`bool<class_bool>` **render_target_v_flip** = ``false``
  561. .. rst-class:: classref-property-setget
  562. - void **set_vflip** **(** :ref:`bool<class_bool>` value **)**
  563. - :ref:`bool<class_bool>` **get_vflip** **(** **)**
  564. If ``true``, the result of rendering will be flipped vertically. Since Viewports in Godot 3.x render upside-down, it's recommended to set this to ``true`` in most situations.
  565. .. rst-class:: classref-item-separator
  566. ----
  567. .. _class_Viewport_property_shadow_atlas_quad_0:
  568. .. rst-class:: classref-property
  569. :ref:`ShadowAtlasQuadrantSubdiv<enum_Viewport_ShadowAtlasQuadrantSubdiv>` **shadow_atlas_quad_0** = ``2``
  570. .. rst-class:: classref-property-setget
  571. - void **set_shadow_atlas_quadrant_subdiv** **(** :ref:`int<class_int>` quadrant, :ref:`ShadowAtlasQuadrantSubdiv<enum_Viewport_ShadowAtlasQuadrantSubdiv>` subdiv **)**
  572. - :ref:`ShadowAtlasQuadrantSubdiv<enum_Viewport_ShadowAtlasQuadrantSubdiv>` **get_shadow_atlas_quadrant_subdiv** **(** :ref:`int<class_int>` quadrant **)** |const|
  573. The subdivision amount of the first quadrant on the shadow atlas.
  574. .. rst-class:: classref-item-separator
  575. ----
  576. .. _class_Viewport_property_shadow_atlas_quad_1:
  577. .. rst-class:: classref-property
  578. :ref:`ShadowAtlasQuadrantSubdiv<enum_Viewport_ShadowAtlasQuadrantSubdiv>` **shadow_atlas_quad_1** = ``2``
  579. .. rst-class:: classref-property-setget
  580. - void **set_shadow_atlas_quadrant_subdiv** **(** :ref:`int<class_int>` quadrant, :ref:`ShadowAtlasQuadrantSubdiv<enum_Viewport_ShadowAtlasQuadrantSubdiv>` subdiv **)**
  581. - :ref:`ShadowAtlasQuadrantSubdiv<enum_Viewport_ShadowAtlasQuadrantSubdiv>` **get_shadow_atlas_quadrant_subdiv** **(** :ref:`int<class_int>` quadrant **)** |const|
  582. The subdivision amount of the second quadrant on the shadow atlas.
  583. .. rst-class:: classref-item-separator
  584. ----
  585. .. _class_Viewport_property_shadow_atlas_quad_2:
  586. .. rst-class:: classref-property
  587. :ref:`ShadowAtlasQuadrantSubdiv<enum_Viewport_ShadowAtlasQuadrantSubdiv>` **shadow_atlas_quad_2** = ``3``
  588. .. rst-class:: classref-property-setget
  589. - void **set_shadow_atlas_quadrant_subdiv** **(** :ref:`int<class_int>` quadrant, :ref:`ShadowAtlasQuadrantSubdiv<enum_Viewport_ShadowAtlasQuadrantSubdiv>` subdiv **)**
  590. - :ref:`ShadowAtlasQuadrantSubdiv<enum_Viewport_ShadowAtlasQuadrantSubdiv>` **get_shadow_atlas_quadrant_subdiv** **(** :ref:`int<class_int>` quadrant **)** |const|
  591. The subdivision amount of the third quadrant on the shadow atlas.
  592. .. rst-class:: classref-item-separator
  593. ----
  594. .. _class_Viewport_property_shadow_atlas_quad_3:
  595. .. rst-class:: classref-property
  596. :ref:`ShadowAtlasQuadrantSubdiv<enum_Viewport_ShadowAtlasQuadrantSubdiv>` **shadow_atlas_quad_3** = ``4``
  597. .. rst-class:: classref-property-setget
  598. - void **set_shadow_atlas_quadrant_subdiv** **(** :ref:`int<class_int>` quadrant, :ref:`ShadowAtlasQuadrantSubdiv<enum_Viewport_ShadowAtlasQuadrantSubdiv>` subdiv **)**
  599. - :ref:`ShadowAtlasQuadrantSubdiv<enum_Viewport_ShadowAtlasQuadrantSubdiv>` **get_shadow_atlas_quadrant_subdiv** **(** :ref:`int<class_int>` quadrant **)** |const|
  600. The subdivision amount of the fourth quadrant on the shadow atlas.
  601. .. rst-class:: classref-item-separator
  602. ----
  603. .. _class_Viewport_property_shadow_atlas_size:
  604. .. rst-class:: classref-property
  605. :ref:`int<class_int>` **shadow_atlas_size** = ``0``
  606. .. rst-class:: classref-property-setget
  607. - void **set_shadow_atlas_size** **(** :ref:`int<class_int>` value **)**
  608. - :ref:`int<class_int>` **get_shadow_atlas_size** **(** **)**
  609. The shadow atlas' resolution (used for omni and spot lights). The value will be rounded up to the nearest power of 2.
  610. \ **Note:** If this is set to ``0``, both point *and* directional shadows won't be visible. Since user-created viewports default to a value of ``0``, this value must be set above ``0`` manually (typically at least ``256``).
  611. .. rst-class:: classref-item-separator
  612. ----
  613. .. _class_Viewport_property_sharpen_intensity:
  614. .. rst-class:: classref-property
  615. :ref:`float<class_float>` **sharpen_intensity** = ``0.0``
  616. .. rst-class:: classref-property-setget
  617. - void **set_sharpen_intensity** **(** :ref:`float<class_float>` value **)**
  618. - :ref:`float<class_float>` **get_sharpen_intensity** **(** **)**
  619. If set to a value greater than ``0.0``, contrast-adaptive sharpening will be applied to the 3D viewport. This has a low performance cost and can be used to recover some of the sharpness lost from using FXAA. Values around ``0.5`` generally give the best results. See also :ref:`fxaa<class_Viewport_property_fxaa>`.
  620. .. rst-class:: classref-item-separator
  621. ----
  622. .. _class_Viewport_property_size:
  623. .. rst-class:: classref-property
  624. :ref:`Vector2<class_Vector2>` **size** = ``Vector2( 0, 0 )``
  625. .. rst-class:: classref-property-setget
  626. - void **set_size** **(** :ref:`Vector2<class_Vector2>` value **)**
  627. - :ref:`Vector2<class_Vector2>` **get_size** **(** **)**
  628. The width and height of viewport. Must be set to a value greater than or equal to 2 pixels on both dimensions. Otherwise, nothing will be displayed.
  629. .. rst-class:: classref-item-separator
  630. ----
  631. .. _class_Viewport_property_size_override_stretch:
  632. .. rst-class:: classref-property
  633. :ref:`bool<class_bool>` **size_override_stretch** = ``false``
  634. .. rst-class:: classref-property-setget
  635. - void **set_size_override_stretch** **(** :ref:`bool<class_bool>` value **)**
  636. - :ref:`bool<class_bool>` **is_size_override_stretch_enabled** **(** **)**
  637. If ``true``, the size override affects stretch as well.
  638. .. rst-class:: classref-item-separator
  639. ----
  640. .. _class_Viewport_property_transparent_bg:
  641. .. rst-class:: classref-property
  642. :ref:`bool<class_bool>` **transparent_bg** = ``false``
  643. .. rst-class:: classref-property-setget
  644. - void **set_transparent_background** **(** :ref:`bool<class_bool>` value **)**
  645. - :ref:`bool<class_bool>` **has_transparent_background** **(** **)**
  646. If ``true``, the viewport should render its background as transparent.
  647. .. rst-class:: classref-item-separator
  648. ----
  649. .. _class_Viewport_property_usage:
  650. .. rst-class:: classref-property
  651. :ref:`Usage<enum_Viewport_Usage>` **usage** = ``2``
  652. .. rst-class:: classref-property-setget
  653. - void **set_usage** **(** :ref:`Usage<enum_Viewport_Usage>` value **)**
  654. - :ref:`Usage<enum_Viewport_Usage>` **get_usage** **(** **)**
  655. The viewport's rendering mode. This controls which buffers are allocated for the viewport (2D only, or 2D + 3D). 2D-only options can reduce memory usage and improve performance slightly, especially on low-end devices.
  656. \ **Note:** If set to :ref:`USAGE_2D<class_Viewport_constant_USAGE_2D>` or :ref:`USAGE_2D_NO_SAMPLING<class_Viewport_constant_USAGE_2D_NO_SAMPLING>`, :ref:`hdr<class_Viewport_property_hdr>` will have no effect when enabled since HDR is not supported for 2D.
  657. .. rst-class:: classref-item-separator
  658. ----
  659. .. _class_Viewport_property_use_32_bpc_depth:
  660. .. rst-class:: classref-property
  661. :ref:`bool<class_bool>` **use_32_bpc_depth** = ``false``
  662. .. rst-class:: classref-property-setget
  663. - void **set_use_32_bpc_depth** **(** :ref:`bool<class_bool>` value **)**
  664. - :ref:`bool<class_bool>` **get_use_32_bpc_depth** **(** **)**
  665. If ``true``, allocates the viewport's framebuffer with full floating-point precision (32-bit) instead of half floating-point precision (16-bit). Only effective when :ref:`hdr<class_Viewport_property_hdr>` is also enabled.
  666. \ **Note:** Enabling this setting does not improve rendering quality. Using full floating-point precision is slower, and is generally only needed for advanced shaders that require a high level of precision. To reduce banding, enable :ref:`debanding<class_Viewport_property_debanding>` instead.
  667. \ **Note:** Only available on the GLES3 backend.
  668. .. rst-class:: classref-item-separator
  669. ----
  670. .. _class_Viewport_property_world:
  671. .. rst-class:: classref-property
  672. :ref:`World<class_World>` **world**
  673. .. rst-class:: classref-property-setget
  674. - void **set_world** **(** :ref:`World<class_World>` value **)**
  675. - :ref:`World<class_World>` **get_world** **(** **)**
  676. The custom :ref:`World<class_World>` which can be used as 3D environment source.
  677. .. rst-class:: classref-item-separator
  678. ----
  679. .. _class_Viewport_property_world_2d:
  680. .. rst-class:: classref-property
  681. :ref:`World2D<class_World2D>` **world_2d**
  682. .. rst-class:: classref-property-setget
  683. - void **set_world_2d** **(** :ref:`World2D<class_World2D>` value **)**
  684. - :ref:`World2D<class_World2D>` **get_world_2d** **(** **)**
  685. The custom :ref:`World2D<class_World2D>` which can be used as 2D environment source.
  686. .. rst-class:: classref-section-separator
  687. ----
  688. .. rst-class:: classref-descriptions-group
  689. Method Descriptions
  690. -------------------
  691. .. _class_Viewport_method_find_world:
  692. .. rst-class:: classref-method
  693. :ref:`World<class_World>` **find_world** **(** **)** |const|
  694. Returns the first valid :ref:`World<class_World>` for this viewport, searching the :ref:`world<class_Viewport_property_world>` property of itself and any Viewport ancestor.
  695. .. rst-class:: classref-item-separator
  696. ----
  697. .. _class_Viewport_method_find_world_2d:
  698. .. rst-class:: classref-method
  699. :ref:`World2D<class_World2D>` **find_world_2d** **(** **)** |const|
  700. Returns the first valid :ref:`World2D<class_World2D>` for this viewport, searching the :ref:`world_2d<class_Viewport_property_world_2d>` property of itself and any Viewport ancestor.
  701. .. rst-class:: classref-item-separator
  702. ----
  703. .. _class_Viewport_method_get_camera:
  704. .. rst-class:: classref-method
  705. :ref:`Camera<class_Camera>` **get_camera** **(** **)** |const|
  706. Returns the active 3D camera.
  707. .. rst-class:: classref-item-separator
  708. ----
  709. .. _class_Viewport_method_get_final_transform:
  710. .. rst-class:: classref-method
  711. :ref:`Transform2D<class_Transform2D>` **get_final_transform** **(** **)** |const|
  712. Returns the total transform of the viewport.
  713. .. rst-class:: classref-item-separator
  714. ----
  715. .. _class_Viewport_method_get_modal_stack_top:
  716. .. rst-class:: classref-method
  717. :ref:`Control<class_Control>` **get_modal_stack_top** **(** **)** |const|
  718. Returns the topmost modal in the stack.
  719. .. rst-class:: classref-item-separator
  720. ----
  721. .. _class_Viewport_method_get_mouse_position:
  722. .. rst-class:: classref-method
  723. :ref:`Vector2<class_Vector2>` **get_mouse_position** **(** **)** |const|
  724. Returns the mouse's position in this **Viewport** using the coordinate system of this **Viewport**.
  725. .. rst-class:: classref-item-separator
  726. ----
  727. .. _class_Viewport_method_get_render_info:
  728. .. rst-class:: classref-method
  729. :ref:`int<class_int>` **get_render_info** **(** :ref:`RenderInfo<enum_Viewport_RenderInfo>` info **)**
  730. Returns information about the viewport from the rendering pipeline.
  731. .. rst-class:: classref-item-separator
  732. ----
  733. .. _class_Viewport_method_get_shadow_atlas_quadrant_subdiv:
  734. .. rst-class:: classref-method
  735. :ref:`ShadowAtlasQuadrantSubdiv<enum_Viewport_ShadowAtlasQuadrantSubdiv>` **get_shadow_atlas_quadrant_subdiv** **(** :ref:`int<class_int>` quadrant **)** |const|
  736. Returns the :ref:`ShadowAtlasQuadrantSubdiv<enum_Viewport_ShadowAtlasQuadrantSubdiv>` of the specified quadrant.
  737. .. rst-class:: classref-item-separator
  738. ----
  739. .. _class_Viewport_method_get_size_override:
  740. .. rst-class:: classref-method
  741. :ref:`Vector2<class_Vector2>` **get_size_override** **(** **)** |const|
  742. Returns the size override set with :ref:`set_size_override<class_Viewport_method_set_size_override>`.
  743. .. rst-class:: classref-item-separator
  744. ----
  745. .. _class_Viewport_method_get_texture:
  746. .. rst-class:: classref-method
  747. :ref:`ViewportTexture<class_ViewportTexture>` **get_texture** **(** **)** |const|
  748. Returns the viewport's texture.
  749. \ **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:`Texture.get_data<class_Texture_method_get_data>` to flip it back, for example:
  750. ::
  751. var img = get_viewport().get_texture().get_data()
  752. img.flip_y()
  753. .. rst-class:: classref-item-separator
  754. ----
  755. .. _class_Viewport_method_get_viewport_rid:
  756. .. rst-class:: classref-method
  757. :ref:`RID<class_RID>` **get_viewport_rid** **(** **)** |const|
  758. Returns the viewport's RID from the :ref:`VisualServer<class_VisualServer>`.
  759. .. rst-class:: classref-item-separator
  760. ----
  761. .. _class_Viewport_method_get_visible_rect:
  762. .. rst-class:: classref-method
  763. :ref:`Rect2<class_Rect2>` **get_visible_rect** **(** **)** |const|
  764. Returns the visible rectangle in global screen coordinates.
  765. .. rst-class:: classref-item-separator
  766. ----
  767. .. _class_Viewport_method_gui_get_drag_data:
  768. .. rst-class:: classref-method
  769. :ref:`Variant<class_Variant>` **gui_get_drag_data** **(** **)** |const|
  770. Returns the drag data from the GUI, that was previously returned by :ref:`Control.get_drag_data<class_Control_method_get_drag_data>`.
  771. .. rst-class:: classref-item-separator
  772. ----
  773. .. _class_Viewport_method_gui_has_modal_stack:
  774. .. rst-class:: classref-method
  775. :ref:`bool<class_bool>` **gui_has_modal_stack** **(** **)** |const|
  776. Returns ``true`` if there are visible modals on-screen.
  777. .. rst-class:: classref-item-separator
  778. ----
  779. .. _class_Viewport_method_gui_is_drag_successful:
  780. .. rst-class:: classref-method
  781. :ref:`bool<class_bool>` **gui_is_drag_successful** **(** **)** |const|
  782. Returns ``true`` if the drag operation is successful.
  783. .. rst-class:: classref-item-separator
  784. ----
  785. .. _class_Viewport_method_gui_is_dragging:
  786. .. rst-class:: classref-method
  787. :ref:`bool<class_bool>` **gui_is_dragging** **(** **)** |const|
  788. Returns ``true`` if the viewport is currently performing a drag operation.
  789. Alternative to :ref:`Node.NOTIFICATION_DRAG_BEGIN<class_Node_constant_NOTIFICATION_DRAG_BEGIN>` and :ref:`Node.NOTIFICATION_DRAG_END<class_Node_constant_NOTIFICATION_DRAG_END>` when you prefer polling the value.
  790. .. rst-class:: classref-item-separator
  791. ----
  792. .. _class_Viewport_method_input:
  793. .. rst-class:: classref-method
  794. void **input** **(** :ref:`InputEvent<class_InputEvent>` local_event **)**
  795. .. container:: contribute
  796. There is currently no description for this method. Please help us by :ref:`contributing one <doc_updating_the_class_reference>`!
  797. .. rst-class:: classref-item-separator
  798. ----
  799. .. _class_Viewport_method_is_input_handled:
  800. .. rst-class:: classref-method
  801. :ref:`bool<class_bool>` **is_input_handled** **(** **)** |const|
  802. .. container:: contribute
  803. There is currently no description for this method. Please help us by :ref:`contributing one <doc_updating_the_class_reference>`!
  804. .. rst-class:: classref-item-separator
  805. ----
  806. .. _class_Viewport_method_is_size_override_enabled:
  807. .. rst-class:: classref-method
  808. :ref:`bool<class_bool>` **is_size_override_enabled** **(** **)** |const|
  809. Returns ``true`` if the size override is enabled. See :ref:`set_size_override<class_Viewport_method_set_size_override>`.
  810. .. rst-class:: classref-item-separator
  811. ----
  812. .. _class_Viewport_method_set_attach_to_screen_rect:
  813. .. rst-class:: classref-method
  814. void **set_attach_to_screen_rect** **(** :ref:`Rect2<class_Rect2>` rect **)**
  815. 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.
  816. .. rst-class:: classref-item-separator
  817. ----
  818. .. _class_Viewport_method_set_input_as_handled:
  819. .. rst-class:: classref-method
  820. void **set_input_as_handled** **(** **)**
  821. Stops the input from propagating further down the :ref:`SceneTree<class_SceneTree>`.
  822. .. rst-class:: classref-item-separator
  823. ----
  824. .. _class_Viewport_method_set_shadow_atlas_quadrant_subdiv:
  825. .. rst-class:: classref-method
  826. void **set_shadow_atlas_quadrant_subdiv** **(** :ref:`int<class_int>` quadrant, :ref:`ShadowAtlasQuadrantSubdiv<enum_Viewport_ShadowAtlasQuadrantSubdiv>` subdiv **)**
  827. 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.
  828. .. rst-class:: classref-item-separator
  829. ----
  830. .. _class_Viewport_method_set_size_override:
  831. .. rst-class:: classref-method
  832. 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 ) **)**
  833. 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.
  834. .. rst-class:: classref-item-separator
  835. ----
  836. .. _class_Viewport_method_unhandled_input:
  837. .. rst-class:: classref-method
  838. void **unhandled_input** **(** :ref:`InputEvent<class_InputEvent>` local_event **)**
  839. .. container:: contribute
  840. There is currently no description for this method. Please help us by :ref:`contributing one <doc_updating_the_class_reference>`!
  841. .. rst-class:: classref-item-separator
  842. ----
  843. .. _class_Viewport_method_update_worlds:
  844. .. rst-class:: classref-method
  845. void **update_worlds** **(** **)**
  846. Forces update of the 2D and 3D worlds.
  847. .. rst-class:: classref-item-separator
  848. ----
  849. .. _class_Viewport_method_warp_mouse:
  850. .. rst-class:: classref-method
  851. void **warp_mouse** **(** :ref:`Vector2<class_Vector2>` to_position **)**
  852. Moves the mouse pointer to the specified position in this **Viewport** using the coordinate system of this **Viewport**.
  853. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  854. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  855. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  856. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`