class_viewport.rst 48 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582
  1. .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
  2. .. DO NOT EDIT THIS FILE, but the doc/base/classes.xml source instead.
  3. .. _class_Viewport:
  4. Viewport
  5. ========
  6. **Inherits:** :ref:`Node<class_node>` **<** :ref:`Object<class_object>`
  7. **Category:** Core
  8. Brief Description
  9. -----------------
  10. Creates a sub-view into the screen.
  11. Member Functions
  12. ----------------
  13. +------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  14. | :ref:`World<class_world>` | :ref:`find_world<class_Viewport_find_world>` **(** **)** const |
  15. +------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  16. | :ref:`World2D<class_world2d>` | :ref:`find_world_2d<class_Viewport_find_world_2d>` **(** **)** const |
  17. +------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  18. | :ref:`Camera<class_camera>` | :ref:`get_camera<class_Viewport_get_camera>` **(** **)** const |
  19. +------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  20. | :ref:`Transform2D<class_transform2d>` | :ref:`get_canvas_transform<class_Viewport_get_canvas_transform>` **(** **)** const |
  21. +------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  22. | :ref:`int<class_int>` | :ref:`get_clear_mode<class_Viewport_get_clear_mode>` **(** **)** const |
  23. +------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  24. | :ref:`int<class_int>` | :ref:`get_debug_draw<class_Viewport_get_debug_draw>` **(** **)** const |
  25. +------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  26. | :ref:`Transform2D<class_transform2d>` | :ref:`get_final_transform<class_Viewport_get_final_transform>` **(** **)** const |
  27. +------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  28. | :ref:`Transform2D<class_transform2d>` | :ref:`get_global_canvas_transform<class_Viewport_get_global_canvas_transform>` **(** **)** const |
  29. +------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  30. | :ref:`bool<class_bool>` | :ref:`get_hdr<class_Viewport_get_hdr>` **(** **)** const |
  31. +------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  32. | :ref:`Vector2<class_vector2>` | :ref:`get_mouse_position<class_Viewport_get_mouse_position>` **(** **)** const |
  33. +------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  34. | :ref:`int<class_int>` | :ref:`get_msaa<class_Viewport_get_msaa>` **(** **)** const |
  35. +------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  36. | :ref:`bool<class_bool>` | :ref:`get_physics_object_picking<class_Viewport_get_physics_object_picking>` **(** **)** |
  37. +------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  38. | :ref:`int<class_int>` | :ref:`get_render_info<class_Viewport_get_render_info>` **(** :ref:`int<class_int>` info **)** |
  39. +------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  40. | :ref:`int<class_int>` | :ref:`get_shadow_atlas_quadrant_subdiv<class_Viewport_get_shadow_atlas_quadrant_subdiv>` **(** :ref:`int<class_int>` quadrant **)** const |
  41. +------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  42. | :ref:`int<class_int>` | :ref:`get_shadow_atlas_size<class_Viewport_get_shadow_atlas_size>` **(** **)** const |
  43. +------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  44. | :ref:`Vector2<class_vector2>` | :ref:`get_size<class_Viewport_get_size>` **(** **)** const |
  45. +------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  46. | :ref:`Vector2<class_vector2>` | :ref:`get_size_override<class_Viewport_get_size_override>` **(** **)** const |
  47. +------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  48. | :ref:`ViewportTexture<class_viewporttexture>` | :ref:`get_texture<class_Viewport_get_texture>` **(** **)** const |
  49. +------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  50. | :ref:`int<class_int>` | :ref:`get_update_mode<class_Viewport_get_update_mode>` **(** **)** const |
  51. +------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  52. | :ref:`int<class_int>` | :ref:`get_usage<class_Viewport_get_usage>` **(** **)** const |
  53. +------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  54. | :ref:`bool<class_bool>` | :ref:`get_vflip<class_Viewport_get_vflip>` **(** **)** const |
  55. +------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  56. | :ref:`RID<class_rid>` | :ref:`get_viewport_rid<class_Viewport_get_viewport_rid>` **(** **)** const |
  57. +------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  58. | :ref:`Rect2<class_rect2>` | :ref:`get_visible_rect<class_Viewport_get_visible_rect>` **(** **)** const |
  59. +------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  60. | :ref:`World<class_world>` | :ref:`get_world<class_Viewport_get_world>` **(** **)** const |
  61. +------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  62. | :ref:`World2D<class_world2d>` | :ref:`get_world_2d<class_Viewport_get_world_2d>` **(** **)** const |
  63. +------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  64. | :ref:`Variant<class_variant>` | :ref:`gui_get_drag_data<class_Viewport_gui_get_drag_data>` **(** **)** const |
  65. +------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  66. | :ref:`bool<class_bool>` | :ref:`gui_has_modal_stack<class_Viewport_gui_has_modal_stack>` **(** **)** const |
  67. +------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  68. | :ref:`bool<class_bool>` | :ref:`has_transparent_background<class_Viewport_has_transparent_background>` **(** **)** const |
  69. +------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  70. | void | :ref:`input<class_Viewport_input>` **(** :ref:`InputEvent<class_inputevent>` local_event **)** |
  71. +------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  72. | :ref:`bool<class_bool>` | :ref:`is_3d_disabled<class_Viewport_is_3d_disabled>` **(** **)** const |
  73. +------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  74. | :ref:`bool<class_bool>` | :ref:`is_audio_listener<class_Viewport_is_audio_listener>` **(** **)** const |
  75. +------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  76. | :ref:`bool<class_bool>` | :ref:`is_audio_listener_2d<class_Viewport_is_audio_listener_2d>` **(** **)** const |
  77. +------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  78. | :ref:`bool<class_bool>` | :ref:`is_input_disabled<class_Viewport_is_input_disabled>` **(** **)** const |
  79. +------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  80. | :ref:`bool<class_bool>` | :ref:`is_size_override_enabled<class_Viewport_is_size_override_enabled>` **(** **)** const |
  81. +------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  82. | :ref:`bool<class_bool>` | :ref:`is_size_override_stretch_enabled<class_Viewport_is_size_override_stretch_enabled>` **(** **)** const |
  83. +------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  84. | :ref:`bool<class_bool>` | :ref:`is_using_own_world<class_Viewport_is_using_own_world>` **(** **)** const |
  85. +------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  86. | void | :ref:`set_as_audio_listener<class_Viewport_set_as_audio_listener>` **(** :ref:`bool<class_bool>` enable **)** |
  87. +------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  88. | void | :ref:`set_as_audio_listener_2d<class_Viewport_set_as_audio_listener_2d>` **(** :ref:`bool<class_bool>` enable **)** |
  89. +------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  90. | void | :ref:`set_attach_to_screen_rect<class_Viewport_set_attach_to_screen_rect>` **(** :ref:`Rect2<class_rect2>` rect **)** |
  91. +------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  92. | void | :ref:`set_canvas_transform<class_Viewport_set_canvas_transform>` **(** :ref:`Transform2D<class_transform2d>` xform **)** |
  93. +------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  94. | void | :ref:`set_clear_mode<class_Viewport_set_clear_mode>` **(** :ref:`int<class_int>` mode **)** |
  95. +------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  96. | void | :ref:`set_debug_draw<class_Viewport_set_debug_draw>` **(** :ref:`int<class_int>` debug_draw **)** |
  97. +------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  98. | void | :ref:`set_disable_3d<class_Viewport_set_disable_3d>` **(** :ref:`bool<class_bool>` disable **)** |
  99. +------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  100. | void | :ref:`set_disable_input<class_Viewport_set_disable_input>` **(** :ref:`bool<class_bool>` disable **)** |
  101. +------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  102. | void | :ref:`set_global_canvas_transform<class_Viewport_set_global_canvas_transform>` **(** :ref:`Transform2D<class_transform2d>` xform **)** |
  103. +------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  104. | void | :ref:`set_hdr<class_Viewport_set_hdr>` **(** :ref:`bool<class_bool>` enable **)** |
  105. +------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  106. | void | :ref:`set_msaa<class_Viewport_set_msaa>` **(** :ref:`int<class_int>` msaa **)** |
  107. +------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  108. | void | :ref:`set_physics_object_picking<class_Viewport_set_physics_object_picking>` **(** :ref:`bool<class_bool>` enable **)** |
  109. +------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  110. | void | :ref:`set_shadow_atlas_quadrant_subdiv<class_Viewport_set_shadow_atlas_quadrant_subdiv>` **(** :ref:`int<class_int>` quadrant, :ref:`int<class_int>` subdiv **)** |
  111. +------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  112. | void | :ref:`set_shadow_atlas_size<class_Viewport_set_shadow_atlas_size>` **(** :ref:`int<class_int>` size **)** |
  113. +------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  114. | void | :ref:`set_size<class_Viewport_set_size>` **(** :ref:`Vector2<class_vector2>` size **)** |
  115. +------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  116. | void | :ref:`set_size_override<class_Viewport_set_size_override>` **(** :ref:`bool<class_bool>` enable, :ref:`Vector2<class_vector2>` size=Vector2( -1, -1 ), :ref:`Vector2<class_vector2>` margin=Vector2( 0, 0 ) **)** |
  117. +------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  118. | void | :ref:`set_size_override_stretch<class_Viewport_set_size_override_stretch>` **(** :ref:`bool<class_bool>` enabled **)** |
  119. +------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  120. | void | :ref:`set_transparent_background<class_Viewport_set_transparent_background>` **(** :ref:`bool<class_bool>` enable **)** |
  121. +------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  122. | void | :ref:`set_update_mode<class_Viewport_set_update_mode>` **(** :ref:`int<class_int>` mode **)** |
  123. +------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  124. | void | :ref:`set_usage<class_Viewport_set_usage>` **(** :ref:`int<class_int>` usage **)** |
  125. +------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  126. | void | :ref:`set_use_arvr<class_Viewport_set_use_arvr>` **(** :ref:`bool<class_bool>` use **)** |
  127. +------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  128. | void | :ref:`set_use_own_world<class_Viewport_set_use_own_world>` **(** :ref:`bool<class_bool>` enable **)** |
  129. +------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  130. | void | :ref:`set_vflip<class_Viewport_set_vflip>` **(** :ref:`bool<class_bool>` enable **)** |
  131. +------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  132. | void | :ref:`set_world<class_Viewport_set_world>` **(** :ref:`World<class_world>` world **)** |
  133. +------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  134. | void | :ref:`set_world_2d<class_Viewport_set_world_2d>` **(** :ref:`World2D<class_world2d>` world_2d **)** |
  135. +------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  136. | void | :ref:`unhandled_input<class_Viewport_unhandled_input>` **(** :ref:`InputEvent<class_inputevent>` local_event **)** |
  137. +------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  138. | void | :ref:`update_worlds<class_Viewport_update_worlds>` **(** **)** |
  139. +------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  140. | :ref:`bool<class_bool>` | :ref:`use_arvr<class_Viewport_use_arvr>` **(** **)** |
  141. +------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  142. | void | :ref:`warp_mouse<class_Viewport_warp_mouse>` **(** :ref:`Vector2<class_vector2>` to_pos **)** |
  143. +------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  144. Signals
  145. -------
  146. - **size_changed** **(** **)**
  147. Emitted when the size of the viewport is changed, whether by :ref:`set_size_override<class_Viewport_set_size_override>`, resize of window, or some other means.
  148. Member Variables
  149. ----------------
  150. - :ref:`bool<class_bool>` **arvr**
  151. - :ref:`bool<class_bool>` **audio_listener_enable_2d**
  152. - :ref:`bool<class_bool>` **audio_listener_enable_3d**
  153. - :ref:`int<class_int>` **debug_draw**
  154. - :ref:`bool<class_bool>` **disable_3d**
  155. - :ref:`bool<class_bool>` **gui_disable_input**
  156. - :ref:`bool<class_bool>` **hdr**
  157. - :ref:`int<class_int>` **msaa**
  158. - :ref:`bool<class_bool>` **own_world**
  159. - :ref:`bool<class_bool>` **physics_object_picking**
  160. - :ref:`int<class_int>` **render_target_clear_mode**
  161. - :ref:`int<class_int>` **render_target_update_mode**
  162. - :ref:`bool<class_bool>` **render_target_v_flip**
  163. - :ref:`int<class_int>` **shadow_atlas_quad_0**
  164. - :ref:`int<class_int>` **shadow_atlas_quad_1**
  165. - :ref:`int<class_int>` **shadow_atlas_quad_2**
  166. - :ref:`int<class_int>` **shadow_atlas_quad_3**
  167. - :ref:`int<class_int>` **shadow_atlas_size**
  168. - :ref:`Vector2<class_vector2>` **size**
  169. - :ref:`bool<class_bool>` **transparent_bg**
  170. - :ref:`int<class_int>` **usage**
  171. - :ref:`World<class_world>` **world**
  172. Numeric Constants
  173. -----------------
  174. - **UPDATE_DISABLED** = **0** --- Do not update the render target.
  175. - **UPDATE_ONCE** = **1** --- Update the render target once, then switch to ``UPDATE_DISABLED``
  176. - **UPDATE_WHEN_VISIBLE** = **2** --- Update the render target only when it is visible. This is the default value.
  177. - **UPDATE_ALWAYS** = **3**
  178. - **SHADOW_ATLAS_QUADRANT_SUBDIV_DISABLED** = **0**
  179. - **SHADOW_ATLAS_QUADRANT_SUBDIV_1** = **1**
  180. - **SHADOW_ATLAS_QUADRANT_SUBDIV_4** = **2**
  181. - **SHADOW_ATLAS_QUADRANT_SUBDIV_16** = **3**
  182. - **SHADOW_ATLAS_QUADRANT_SUBDIV_64** = **4**
  183. - **SHADOW_ATLAS_QUADRANT_SUBDIV_256** = **5**
  184. - **SHADOW_ATLAS_QUADRANT_SUBDIV_1024** = **6**
  185. - **SHADOW_ATLAS_QUADRANT_SUBDIV_MAX** = **7**
  186. - **RENDER_INFO_OBJECTS_IN_FRAME** = **0**
  187. - **RENDER_INFO_VERTICES_IN_FRAME** = **1**
  188. - **RENDER_INFO_MATERIAL_CHANGES_IN_FRAME** = **2**
  189. - **RENDER_INFO_SHADER_CHANGES_IN_FRAME** = **3**
  190. - **RENDER_INFO_SURFACE_CHANGES_IN_FRAME** = **4**
  191. - **RENDER_INFO_DRAW_CALLS_IN_FRAME** = **5**
  192. - **RENDER_INFO_MAX** = **6**
  193. - **DEBUG_DRAW_DISABLED** = **0**
  194. - **DEBUG_DRAW_UNSHADED** = **1**
  195. - **DEBUG_DRAW_OVERDRAW** = **2**
  196. - **DEBUG_DRAW_WIREFRAME** = **3**
  197. - **MSAA_DISABLED** = **0**
  198. - **MSAA_2X** = **1**
  199. - **MSAA_4X** = **2**
  200. - **MSAA_8X** = **3**
  201. - **MSAA_16X** = **4**
  202. Description
  203. -----------
  204. 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.
  205. Optionally, a viewport can have its own 2D or 3D world, so they don't share what they draw with other viewports.
  206. If a viewport is a child of a :ref:`Control<class_control>`, it will automatically take up its same rect and position, otherwise they must be set manually.
  207. Viewports can also choose to be audio listeners, so they generate positional audio depending on a 2D or 3D camera child of it.
  208. Also, viewports can be assigned to different screens in case the devices have multiple screens.
  209. Finally, viewports can also behave as render targets, in which case they will not be visible unless the associated texture is used to draw.
  210. Member Function Description
  211. ---------------------------
  212. .. _class_Viewport_find_world:
  213. - :ref:`World<class_world>` **find_world** **(** **)** const
  214. Return the 3D world of the viewport, or if no such present, the one of the parent viewport.
  215. .. _class_Viewport_find_world_2d:
  216. - :ref:`World2D<class_world2d>` **find_world_2d** **(** **)** const
  217. Return the 2D world of the viewport.
  218. .. _class_Viewport_get_camera:
  219. - :ref:`Camera<class_camera>` **get_camera** **(** **)** const
  220. Return the active 3D camera.
  221. .. _class_Viewport_get_canvas_transform:
  222. - :ref:`Transform2D<class_transform2d>` **get_canvas_transform** **(** **)** const
  223. Get the canvas transform of the viewport.
  224. .. _class_Viewport_get_clear_mode:
  225. - :ref:`int<class_int>` **get_clear_mode** **(** **)** const
  226. .. _class_Viewport_get_debug_draw:
  227. - :ref:`int<class_int>` **get_debug_draw** **(** **)** const
  228. .. _class_Viewport_get_final_transform:
  229. - :ref:`Transform2D<class_transform2d>` **get_final_transform** **(** **)** const
  230. Get the total transform of the viewport.
  231. .. _class_Viewport_get_global_canvas_transform:
  232. - :ref:`Transform2D<class_transform2d>` **get_global_canvas_transform** **(** **)** const
  233. Get the global canvas transform of the viewport.
  234. .. _class_Viewport_get_hdr:
  235. - :ref:`bool<class_bool>` **get_hdr** **(** **)** const
  236. Get whether the rendered texture has filters enabled.
  237. .. _class_Viewport_get_mouse_position:
  238. - :ref:`Vector2<class_vector2>` **get_mouse_position** **(** **)** const
  239. Get the mouse position, relative to the viewport.
  240. .. _class_Viewport_get_msaa:
  241. - :ref:`int<class_int>` **get_msaa** **(** **)** const
  242. .. _class_Viewport_get_physics_object_picking:
  243. - :ref:`bool<class_bool>` **get_physics_object_picking** **(** **)**
  244. Get whether picking for all physics objects inside the viewport is enabled.
  245. .. _class_Viewport_get_render_info:
  246. - :ref:`int<class_int>` **get_render_info** **(** :ref:`int<class_int>` info **)**
  247. .. _class_Viewport_get_shadow_atlas_quadrant_subdiv:
  248. - :ref:`int<class_int>` **get_shadow_atlas_quadrant_subdiv** **(** :ref:`int<class_int>` quadrant **)** const
  249. .. _class_Viewport_get_shadow_atlas_size:
  250. - :ref:`int<class_int>` **get_shadow_atlas_size** **(** **)** const
  251. .. _class_Viewport_get_size:
  252. - :ref:`Vector2<class_vector2>` **get_size** **(** **)** const
  253. Return the viewport rect. If the viewport is child of a control, it will use the same rect as the parent. Otherwise, if the rect is empty, the viewport will use all the allowed space.
  254. .. _class_Viewport_get_size_override:
  255. - :ref:`Vector2<class_vector2>` **get_size_override** **(** **)** const
  256. Get the size override set with :ref:`set_size_override<class_Viewport_set_size_override>`.
  257. .. _class_Viewport_get_texture:
  258. - :ref:`ViewportTexture<class_viewporttexture>` **get_texture** **(** **)** const
  259. Get the viewport's texture, for use with various objects that you want to texture with the viewport.
  260. .. _class_Viewport_get_update_mode:
  261. - :ref:`int<class_int>` **get_update_mode** **(** **)** const
  262. Get when the viewport would be updated, will be one of the ``UPDATE\_\*`` constants.
  263. .. _class_Viewport_get_usage:
  264. - :ref:`int<class_int>` **get_usage** **(** **)** const
  265. .. _class_Viewport_get_vflip:
  266. - :ref:`bool<class_bool>` **get_vflip** **(** **)** const
  267. Set whether the render target is flipped on the Y axis.
  268. .. _class_Viewport_get_viewport_rid:
  269. - :ref:`RID<class_rid>` **get_viewport_rid** **(** **)** const
  270. Get the viewport RID from the :ref:`VisualServer<class_visualserver>`.
  271. .. _class_Viewport_get_visible_rect:
  272. - :ref:`Rect2<class_rect2>` **get_visible_rect** **(** **)** const
  273. Return the final, visible rect in global screen coordinates.
  274. .. _class_Viewport_get_world:
  275. - :ref:`World<class_world>` **get_world** **(** **)** const
  276. Return the 3D world of the viewport.
  277. .. _class_Viewport_get_world_2d:
  278. - :ref:`World2D<class_world2d>` **get_world_2d** **(** **)** const
  279. Return the 2D world of the viewport.
  280. .. _class_Viewport_gui_get_drag_data:
  281. - :ref:`Variant<class_variant>` **gui_get_drag_data** **(** **)** const
  282. Returs the drag data from the GUI, that was previously returned by :ref:`Control.get_drag_data<class_Control_get_drag_data>`.
  283. .. _class_Viewport_gui_has_modal_stack:
  284. - :ref:`bool<class_bool>` **gui_has_modal_stack** **(** **)** const
  285. Returs whether there are shown modals on-screen.
  286. .. _class_Viewport_has_transparent_background:
  287. - :ref:`bool<class_bool>` **has_transparent_background** **(** **)** const
  288. Return whether the viewport lets whatever is behind it to show.
  289. .. _class_Viewport_input:
  290. - void **input** **(** :ref:`InputEvent<class_inputevent>` local_event **)**
  291. .. _class_Viewport_is_3d_disabled:
  292. - :ref:`bool<class_bool>` **is_3d_disabled** **(** **)** const
  293. .. _class_Viewport_is_audio_listener:
  294. - :ref:`bool<class_bool>` **is_audio_listener** **(** **)** const
  295. Returns whether the viewport sends sounds to the speakers.
  296. .. _class_Viewport_is_audio_listener_2d:
  297. - :ref:`bool<class_bool>` **is_audio_listener_2d** **(** **)** const
  298. Returns whether the viewport sends soundsfrom 2D emitters to the speakers.
  299. .. _class_Viewport_is_input_disabled:
  300. - :ref:`bool<class_bool>` **is_input_disabled** **(** **)** const
  301. Return whether input to the viewport is disabled.
  302. .. _class_Viewport_is_size_override_enabled:
  303. - :ref:`bool<class_bool>` **is_size_override_enabled** **(** **)** const
  304. Get the enabled status of the size override set with :ref:`set_size_override<class_Viewport_set_size_override>`.
  305. .. _class_Viewport_is_size_override_stretch_enabled:
  306. - :ref:`bool<class_bool>` **is_size_override_stretch_enabled** **(** **)** const
  307. Get the enabled status of the size strech override set with :ref:`set_size_override_stretch<class_Viewport_set_size_override_stretch>`.
  308. .. _class_Viewport_is_using_own_world:
  309. - :ref:`bool<class_bool>` **is_using_own_world** **(** **)** const
  310. Return whether the viewport is using a world separate from the parent viewport's world.
  311. .. _class_Viewport_set_as_audio_listener:
  312. - void **set_as_audio_listener** **(** :ref:`bool<class_bool>` enable **)**
  313. Makes the viewport send sounds to the speakers.
  314. .. _class_Viewport_set_as_audio_listener_2d:
  315. - void **set_as_audio_listener_2d** **(** :ref:`bool<class_bool>` enable **)**
  316. Makes the viewport send sounds from 2D emitters to the speakers.
  317. .. _class_Viewport_set_attach_to_screen_rect:
  318. - void **set_attach_to_screen_rect** **(** :ref:`Rect2<class_rect2>` rect **)**
  319. .. _class_Viewport_set_canvas_transform:
  320. - void **set_canvas_transform** **(** :ref:`Transform2D<class_transform2d>` xform **)**
  321. Set the canvas transform of the viewport, useful for changing the on-screen positions of all child :ref:`CanvasItem<class_canvasitem>`\ s. This is relative to the global canvas transform of the viewport.
  322. .. _class_Viewport_set_clear_mode:
  323. - void **set_clear_mode** **(** :ref:`int<class_int>` mode **)**
  324. .. _class_Viewport_set_debug_draw:
  325. - void **set_debug_draw** **(** :ref:`int<class_int>` debug_draw **)**
  326. .. _class_Viewport_set_disable_3d:
  327. - void **set_disable_3d** **(** :ref:`bool<class_bool>` disable **)**
  328. .. _class_Viewport_set_disable_input:
  329. - void **set_disable_input** **(** :ref:`bool<class_bool>` disable **)**
  330. Set whether input to the viewport is disabled.
  331. .. _class_Viewport_set_global_canvas_transform:
  332. - void **set_global_canvas_transform** **(** :ref:`Transform2D<class_transform2d>` xform **)**
  333. Set the global canvas transform of the viewport. The canvas transform is relative to this.
  334. .. _class_Viewport_set_hdr:
  335. - void **set_hdr** **(** :ref:`bool<class_bool>` enable **)**
  336. .. _class_Viewport_set_msaa:
  337. - void **set_msaa** **(** :ref:`int<class_int>` msaa **)**
  338. .. _class_Viewport_set_physics_object_picking:
  339. - void **set_physics_object_picking** **(** :ref:`bool<class_bool>` enable **)**
  340. Enable/disable picking for all physics objects inside the viewport.
  341. .. _class_Viewport_set_shadow_atlas_quadrant_subdiv:
  342. - void **set_shadow_atlas_quadrant_subdiv** **(** :ref:`int<class_int>` quadrant, :ref:`int<class_int>` subdiv **)**
  343. .. _class_Viewport_set_shadow_atlas_size:
  344. - void **set_shadow_atlas_size** **(** :ref:`int<class_int>` size **)**
  345. .. _class_Viewport_set_size:
  346. - void **set_size** **(** :ref:`Vector2<class_vector2>` size **)**
  347. Set the size of the viewport.
  348. .. _class_Viewport_set_size_override:
  349. - 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 ) **)**
  350. Set the size override of the viewport. If the enable parameter is true, it would use the override, otherwise it would use the default size. If the size parameter is equal to ``(-1, -1)``, it won't update the size.
  351. .. _class_Viewport_set_size_override_stretch:
  352. - void **set_size_override_stretch** **(** :ref:`bool<class_bool>` enabled **)**
  353. Set whether the size override affects stretch as well.
  354. .. _class_Viewport_set_transparent_background:
  355. - void **set_transparent_background** **(** :ref:`bool<class_bool>` enable **)**
  356. If this viewport is a child of another viewport, keep the previously drawn background visible.
  357. .. _class_Viewport_set_update_mode:
  358. - void **set_update_mode** **(** :ref:`int<class_int>` mode **)**
  359. Set when the render target would be updated, using the ``UPDATE\_\*`` constants
  360. .. _class_Viewport_set_usage:
  361. - void **set_usage** **(** :ref:`int<class_int>` usage **)**
  362. .. _class_Viewport_set_use_arvr:
  363. - void **set_use_arvr** **(** :ref:`bool<class_bool>` use **)**
  364. .. _class_Viewport_set_use_own_world:
  365. - void **set_use_own_world** **(** :ref:`bool<class_bool>` enable **)**
  366. Make the viewport use a world separate from the parent viewport's world.
  367. .. _class_Viewport_set_vflip:
  368. - void **set_vflip** **(** :ref:`bool<class_bool>` enable **)**
  369. Set whether the viewport is flipped on the Y axis.
  370. .. _class_Viewport_set_world:
  371. - void **set_world** **(** :ref:`World<class_world>` world **)**
  372. Change the 3D world of the viewport.
  373. .. _class_Viewport_set_world_2d:
  374. - void **set_world_2d** **(** :ref:`World2D<class_world2d>` world_2d **)**
  375. .. _class_Viewport_unhandled_input:
  376. - void **unhandled_input** **(** :ref:`InputEvent<class_inputevent>` local_event **)**
  377. .. _class_Viewport_update_worlds:
  378. - void **update_worlds** **(** **)**
  379. Force update of the 2D and 3D worlds.
  380. .. _class_Viewport_use_arvr:
  381. - :ref:`bool<class_bool>` **use_arvr** **(** **)**
  382. .. _class_Viewport_warp_mouse:
  383. - void **warp_mouse** **(** :ref:`Vector2<class_vector2>` to_pos **)**
  384. Warp the mouse to a position, relative to the viewport.