class_viewport.rst 43 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505
  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:`Matrix32<class_matrix32>` | :ref:`get_canvas_transform<class_Viewport_get_canvas_transform>` **(** **)** const |
  21. +--------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  22. | :ref:`Matrix32<class_matrix32>` | :ref:`get_final_transform<class_Viewport_get_final_transform>` **(** **)** const |
  23. +--------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  24. | :ref:`Matrix32<class_matrix32>` | :ref:`get_global_canvas_transform<class_Viewport_get_global_canvas_transform>` **(** **)** const |
  25. +--------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  26. | :ref:`Vector2<class_vector2>` | :ref:`get_mouse_pos<class_Viewport_get_mouse_pos>` **(** **)** const |
  27. +--------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  28. | :ref:`bool<class_bool>` | :ref:`get_physics_object_picking<class_Viewport_get_physics_object_picking>` **(** **)** |
  29. +--------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  30. | :ref:`Rect2<class_rect2>` | :ref:`get_rect<class_Viewport_get_rect>` **(** **)** const |
  31. +--------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  32. | :ref:`bool<class_bool>` | :ref:`get_render_target_clear_on_new_frame<class_Viewport_get_render_target_clear_on_new_frame>` **(** **)** const |
  33. +--------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  34. | :ref:`bool<class_bool>` | :ref:`get_render_target_filter<class_Viewport_get_render_target_filter>` **(** **)** const |
  35. +--------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  36. | :ref:`bool<class_bool>` | :ref:`get_render_target_gen_mipmaps<class_Viewport_get_render_target_gen_mipmaps>` **(** **)** const |
  37. +--------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  38. | :ref:`RenderTargetTexture<class_rendertargettexture>` | :ref:`get_render_target_texture<class_Viewport_get_render_target_texture>` **(** **)** const |
  39. +--------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  40. | :ref:`int<class_int>` | :ref:`get_render_target_update_mode<class_Viewport_get_render_target_update_mode>` **(** **)** const |
  41. +--------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  42. | :ref:`bool<class_bool>` | :ref:`get_render_target_vflip<class_Viewport_get_render_target_vflip>` **(** **)** const |
  43. +--------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  44. | :ref:`Image<class_image>` | :ref:`get_screen_capture<class_Viewport_get_screen_capture>` **(** **)** const |
  45. +--------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  46. | :ref:`Vector2<class_vector2>` | :ref:`get_size_override<class_Viewport_get_size_override>` **(** **)** const |
  47. +--------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  48. | :ref:`RID<class_rid>` | :ref:`get_viewport<class_Viewport_get_viewport>` **(** **)** const |
  49. +--------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  50. | :ref:`Rect2<class_rect2>` | :ref:`get_visible_rect<class_Viewport_get_visible_rect>` **(** **)** const |
  51. +--------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  52. | :ref:`World<class_world>` | :ref:`get_world<class_Viewport_get_world>` **(** **)** const |
  53. +--------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  54. | :ref:`World2D<class_world2d>` | :ref:`get_world_2d<class_Viewport_get_world_2d>` **(** **)** const |
  55. +--------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  56. | :ref:`Variant<class_variant>` | :ref:`gui_get_drag_data<class_Viewport_gui_get_drag_data>` **(** **)** const |
  57. +--------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  58. | :ref:`bool<class_bool>` | :ref:`gui_has_modal_stack<class_Viewport_gui_has_modal_stack>` **(** **)** const |
  59. +--------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  60. | :ref:`bool<class_bool>` | :ref:`has_transparent_background<class_Viewport_has_transparent_background>` **(** **)** const |
  61. +--------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  62. | void | :ref:`input<class_Viewport_input>` **(** :ref:`InputEvent<class_inputevent>` local_event **)** |
  63. +--------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  64. | :ref:`bool<class_bool>` | :ref:`is_audio_listener<class_Viewport_is_audio_listener>` **(** **)** const |
  65. +--------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  66. | :ref:`bool<class_bool>` | :ref:`is_audio_listener_2d<class_Viewport_is_audio_listener_2d>` **(** **)** const |
  67. +--------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  68. | :ref:`bool<class_bool>` | :ref:`is_input_disabled<class_Viewport_is_input_disabled>` **(** **)** const |
  69. +--------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  70. | :ref:`bool<class_bool>` | :ref:`is_set_as_render_target<class_Viewport_is_set_as_render_target>` **(** **)** const |
  71. +--------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  72. | :ref:`bool<class_bool>` | :ref:`is_size_override_enabled<class_Viewport_is_size_override_enabled>` **(** **)** const |
  73. +--------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  74. | :ref:`bool<class_bool>` | :ref:`is_size_override_stretch_enabled<class_Viewport_is_size_override_stretch_enabled>` **(** **)** const |
  75. +--------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  76. | :ref:`bool<class_bool>` | :ref:`is_using_own_world<class_Viewport_is_using_own_world>` **(** **)** const |
  77. +--------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  78. | void | :ref:`queue_screen_capture<class_Viewport_queue_screen_capture>` **(** **)** |
  79. +--------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  80. | void | :ref:`render_target_clear<class_Viewport_render_target_clear>` **(** **)** |
  81. +--------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  82. | void | :ref:`set_as_audio_listener<class_Viewport_set_as_audio_listener>` **(** :ref:`bool<class_bool>` enable **)** |
  83. +--------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  84. | void | :ref:`set_as_audio_listener_2d<class_Viewport_set_as_audio_listener_2d>` **(** :ref:`bool<class_bool>` enable **)** |
  85. +--------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  86. | void | :ref:`set_as_render_target<class_Viewport_set_as_render_target>` **(** :ref:`bool<class_bool>` enable **)** |
  87. +--------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  88. | void | :ref:`set_canvas_transform<class_Viewport_set_canvas_transform>` **(** :ref:`Matrix32<class_matrix32>` xform **)** |
  89. +--------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  90. | void | :ref:`set_disable_input<class_Viewport_set_disable_input>` **(** :ref:`bool<class_bool>` disable **)** |
  91. +--------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  92. | void | :ref:`set_global_canvas_transform<class_Viewport_set_global_canvas_transform>` **(** :ref:`Matrix32<class_matrix32>` xform **)** |
  93. +--------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  94. | void | :ref:`set_physics_object_picking<class_Viewport_set_physics_object_picking>` **(** :ref:`bool<class_bool>` enable **)** |
  95. +--------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  96. | void | :ref:`set_rect<class_Viewport_set_rect>` **(** :ref:`Rect2<class_rect2>` rect **)** |
  97. +--------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  98. | void | :ref:`set_render_target_clear_on_new_frame<class_Viewport_set_render_target_clear_on_new_frame>` **(** :ref:`bool<class_bool>` enable **)** |
  99. +--------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  100. | void | :ref:`set_render_target_filter<class_Viewport_set_render_target_filter>` **(** :ref:`bool<class_bool>` enable **)** |
  101. +--------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  102. | void | :ref:`set_render_target_gen_mipmaps<class_Viewport_set_render_target_gen_mipmaps>` **(** :ref:`bool<class_bool>` enable **)** |
  103. +--------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  104. | void | :ref:`set_render_target_to_screen_rect<class_Viewport_set_render_target_to_screen_rect>` **(** :ref:`Rect2<class_rect2>` rect **)** |
  105. +--------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  106. | void | :ref:`set_render_target_update_mode<class_Viewport_set_render_target_update_mode>` **(** :ref:`int<class_int>` mode **)** |
  107. +--------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  108. | void | :ref:`set_render_target_vflip<class_Viewport_set_render_target_vflip>` **(** :ref:`bool<class_bool>` enable **)** |
  109. +--------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  110. | 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) **)** |
  111. +--------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  112. | void | :ref:`set_size_override_stretch<class_Viewport_set_size_override_stretch>` **(** :ref:`bool<class_bool>` enabled **)** |
  113. +--------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  114. | void | :ref:`set_transparent_background<class_Viewport_set_transparent_background>` **(** :ref:`bool<class_bool>` enable **)** |
  115. +--------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  116. | void | :ref:`set_use_own_world<class_Viewport_set_use_own_world>` **(** :ref:`bool<class_bool>` enable **)** |
  117. +--------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  118. | void | :ref:`set_world<class_Viewport_set_world>` **(** :ref:`World<class_world>` world **)** |
  119. +--------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  120. | void | :ref:`set_world_2d<class_Viewport_set_world_2d>` **(** :ref:`World2D<class_world2d>` world_2d **)** |
  121. +--------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  122. | void | :ref:`unhandled_input<class_Viewport_unhandled_input>` **(** :ref:`InputEvent<class_inputevent>` local_event **)** |
  123. +--------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  124. | void | :ref:`update_worlds<class_Viewport_update_worlds>` **(** **)** |
  125. +--------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  126. | void | :ref:`warp_mouse<class_Viewport_warp_mouse>` **(** :ref:`Vector2<class_vector2>` to_pos **)** |
  127. +--------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  128. Signals
  129. -------
  130. - **size_changed** **(** **)**
  131. 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.
  132. Numeric Constants
  133. -----------------
  134. - **RENDER_TARGET_UPDATE_DISABLED** = **0** --- Do not update the render target.
  135. - **RENDER_TARGET_UPDATE_ONCE** = **1** --- Update the render target once, then switch to ``RENDER_TARGET_UPDATE_DISABLED``
  136. - **RENDER_TARGET_UPDATE_WHEN_VISIBLE** = **2** --- Update the render target only when it is visible. This is the default value.
  137. - **RENDER_TARGET_UPDATE_ALWAYS** = **3** --- Update the render target always.
  138. Description
  139. -----------
  140. 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.
  141. Optionally, a viewport can have its own 2D or 3D world, so they don't share what they draw with other viewports.
  142. 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.
  143. Viewports can also choose to be audio listeners, so they generate positional audio depending on a 2D or 3D camera child of it.
  144. Also, viewports can be assigned to different screens in case the devices have multiple screens.
  145. Finally, viewports can also behave as render targets, in which case they will not be visible unless the associated texture is used to draw.
  146. Member Function Description
  147. ---------------------------
  148. .. _class_Viewport_find_world:
  149. - :ref:`World<class_world>` **find_world** **(** **)** const
  150. Return the 3D world of the viewport, or if no such present, the one of the parent viewport.
  151. .. _class_Viewport_find_world_2d:
  152. - :ref:`World2D<class_world2d>` **find_world_2d** **(** **)** const
  153. Return the 2D world of the viewport.
  154. .. _class_Viewport_get_camera:
  155. - :ref:`Camera<class_camera>` **get_camera** **(** **)** const
  156. Return the active 3D camera.
  157. .. _class_Viewport_get_canvas_transform:
  158. - :ref:`Matrix32<class_matrix32>` **get_canvas_transform** **(** **)** const
  159. Get the canvas transform of the viewport.
  160. .. _class_Viewport_get_final_transform:
  161. - :ref:`Matrix32<class_matrix32>` **get_final_transform** **(** **)** const
  162. Get the total transform of the viewport.
  163. .. _class_Viewport_get_global_canvas_transform:
  164. - :ref:`Matrix32<class_matrix32>` **get_global_canvas_transform** **(** **)** const
  165. Get the global canvas transform of the viewport.
  166. .. _class_Viewport_get_mouse_pos:
  167. - :ref:`Vector2<class_vector2>` **get_mouse_pos** **(** **)** const
  168. Get the mouse position, relative to the viewport.
  169. .. _class_Viewport_get_physics_object_picking:
  170. - :ref:`bool<class_bool>` **get_physics_object_picking** **(** **)**
  171. Get whether picking for all physics objects inside the viewport is enabled.
  172. .. _class_Viewport_get_rect:
  173. - :ref:`Rect2<class_rect2>` **get_rect** **(** **)** const
  174. 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.
  175. .. _class_Viewport_get_render_target_clear_on_new_frame:
  176. - :ref:`bool<class_bool>` **get_render_target_clear_on_new_frame** **(** **)** const
  177. Return whether automatic clearing of the render target on each frame is enabled.
  178. .. _class_Viewport_get_render_target_filter:
  179. - :ref:`bool<class_bool>` **get_render_target_filter** **(** **)** const
  180. Get whether the rendered texture has filters enabled.
  181. .. _class_Viewport_get_render_target_gen_mipmaps:
  182. - :ref:`bool<class_bool>` **get_render_target_gen_mipmaps** **(** **)** const
  183. Get whether the rendered texture will have mipmaps generated.
  184. .. _class_Viewport_get_render_target_texture:
  185. - :ref:`RenderTargetTexture<class_rendertargettexture>` **get_render_target_texture** **(** **)** const
  186. Get the render target's texture, for use with various objects that you want to texture with the viewport.
  187. .. _class_Viewport_get_render_target_update_mode:
  188. - :ref:`int<class_int>` **get_render_target_update_mode** **(** **)** const
  189. Get when the render target would be updated, will be one of the ``RENDER_TARGET_UPDATE\_\*`` constants.
  190. .. _class_Viewport_get_render_target_vflip:
  191. - :ref:`bool<class_bool>` **get_render_target_vflip** **(** **)** const
  192. Set whether the render target is flipped on the Y axis.
  193. .. _class_Viewport_get_screen_capture:
  194. - :ref:`Image<class_image>` **get_screen_capture** **(** **)** const
  195. Return the captured screenshot after :ref:`queue_screen_capture<class_Viewport_queue_screen_capture>`. You might need to check more than one frame untill the right image is returned.
  196. .. _class_Viewport_get_size_override:
  197. - :ref:`Vector2<class_vector2>` **get_size_override** **(** **)** const
  198. Get the size override set with :ref:`set_size_override<class_Viewport_set_size_override>`.
  199. .. _class_Viewport_get_viewport:
  200. - :ref:`RID<class_rid>` **get_viewport** **(** **)** const
  201. Get the viewport RID from the visual server.
  202. .. _class_Viewport_get_visible_rect:
  203. - :ref:`Rect2<class_rect2>` **get_visible_rect** **(** **)** const
  204. Return the final, visible rect in global screen coordinates.
  205. .. _class_Viewport_get_world:
  206. - :ref:`World<class_world>` **get_world** **(** **)** const
  207. Return the 3D world of the viewport.
  208. .. _class_Viewport_get_world_2d:
  209. - :ref:`World2D<class_world2d>` **get_world_2d** **(** **)** const
  210. .. _class_Viewport_gui_get_drag_data:
  211. - :ref:`Variant<class_variant>` **gui_get_drag_data** **(** **)** const
  212. Returs the drag data from the GUI, that was previously returned by :ref:`Control.get_drag_data<class_Control_get_drag_data>`.
  213. .. _class_Viewport_gui_has_modal_stack:
  214. - :ref:`bool<class_bool>` **gui_has_modal_stack** **(** **)** const
  215. Returs whether there are shown modals on-screen.
  216. .. _class_Viewport_has_transparent_background:
  217. - :ref:`bool<class_bool>` **has_transparent_background** **(** **)** const
  218. Return whether the viewport lets whatever is behind it to show.
  219. .. _class_Viewport_input:
  220. - void **input** **(** :ref:`InputEvent<class_inputevent>` local_event **)**
  221. .. _class_Viewport_is_audio_listener:
  222. - :ref:`bool<class_bool>` **is_audio_listener** **(** **)** const
  223. Returns whether the viewport sends sounds to the speakers.
  224. .. _class_Viewport_is_audio_listener_2d:
  225. - :ref:`bool<class_bool>` **is_audio_listener_2d** **(** **)** const
  226. Returns whether the viewport sends soundsfrom 2D emitters to the speakers.
  227. .. _class_Viewport_is_input_disabled:
  228. - :ref:`bool<class_bool>` **is_input_disabled** **(** **)** const
  229. Return whether input to the viewport is disabled.
  230. .. _class_Viewport_is_set_as_render_target:
  231. - :ref:`bool<class_bool>` **is_set_as_render_target** **(** **)** const
  232. Return whether the viewport is set as a render target by :ref:`set_as_render_target<class_Viewport_set_as_render_target>`.
  233. .. _class_Viewport_is_size_override_enabled:
  234. - :ref:`bool<class_bool>` **is_size_override_enabled** **(** **)** const
  235. Get the enabled status of the size override set with :ref:`set_size_override<class_Viewport_set_size_override>`.
  236. .. _class_Viewport_is_size_override_stretch_enabled:
  237. - :ref:`bool<class_bool>` **is_size_override_stretch_enabled** **(** **)** const
  238. Get the enabled status of the size strech override set with :ref:`set_size_override_stretch<class_Viewport_set_size_override_stretch>`.
  239. .. _class_Viewport_is_using_own_world:
  240. - :ref:`bool<class_bool>` **is_using_own_world** **(** **)** const
  241. Return whether the viewport is using a world separate from the parent viewport's world.
  242. .. _class_Viewport_queue_screen_capture:
  243. - void **queue_screen_capture** **(** **)**
  244. Queue a multithreaded screenshot, you can retrive it at a later frame via :ref:`get_screen_capture<class_Viewport_get_screen_capture>`.
  245. .. _class_Viewport_render_target_clear:
  246. - void **render_target_clear** **(** **)**
  247. Clear the render target manually.
  248. .. _class_Viewport_set_as_audio_listener:
  249. - void **set_as_audio_listener** **(** :ref:`bool<class_bool>` enable **)**
  250. Makes the viewport send sounds to the speakers.
  251. .. _class_Viewport_set_as_audio_listener_2d:
  252. - void **set_as_audio_listener_2d** **(** :ref:`bool<class_bool>` enable **)**
  253. Makes the viewport send sounds from 2D emitters to the speakers.
  254. .. _class_Viewport_set_as_render_target:
  255. - void **set_as_render_target** **(** :ref:`bool<class_bool>` enable **)**
  256. Set the viewport's render target mode.
  257. .. _class_Viewport_set_canvas_transform:
  258. - void **set_canvas_transform** **(** :ref:`Matrix32<class_matrix32>` xform **)**
  259. 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.
  260. .. _class_Viewport_set_disable_input:
  261. - void **set_disable_input** **(** :ref:`bool<class_bool>` disable **)**
  262. Set whether input to the viewport is disabled.
  263. .. _class_Viewport_set_global_canvas_transform:
  264. - void **set_global_canvas_transform** **(** :ref:`Matrix32<class_matrix32>` xform **)**
  265. Set the global canvas transform of the viewport. The canvas transform is relative to this.
  266. .. _class_Viewport_set_physics_object_picking:
  267. - void **set_physics_object_picking** **(** :ref:`bool<class_bool>` enable **)**
  268. Enable/disable picking for all physics objects inside the viewport.
  269. .. _class_Viewport_set_rect:
  270. - void **set_rect** **(** :ref:`Rect2<class_rect2>` rect **)**
  271. Set the viewport rect. If the viewport is child of a control, it will use the same rect as the parent.
  272. .. _class_Viewport_set_render_target_clear_on_new_frame:
  273. - void **set_render_target_clear_on_new_frame** **(** :ref:`bool<class_bool>` enable **)**
  274. Enable/disable automatic clearing of the render target on each frame. You might find it better to disable this if you are using the viewport for rarely updated textures. To clear manually, check :ref:`render_target_clear<class_Viewport_render_target_clear>`
  275. .. _class_Viewport_set_render_target_filter:
  276. - void **set_render_target_filter** **(** :ref:`bool<class_bool>` enable **)**
  277. Set whether the rendered texture should have filters enabled. Disable if you want the texture's pixels be visible.
  278. .. _class_Viewport_set_render_target_gen_mipmaps:
  279. - void **set_render_target_gen_mipmaps** **(** :ref:`bool<class_bool>` enable **)**
  280. Set whether the rendered texture should have mipmaps generated. Mipmaps allow the texture to have better antialiasing from far away.
  281. .. _class_Viewport_set_render_target_to_screen_rect:
  282. - void **set_render_target_to_screen_rect** **(** :ref:`Rect2<class_rect2>` rect **)**
  283. Map a part of the screen to the render target directly.
  284. .. _class_Viewport_set_render_target_update_mode:
  285. - void **set_render_target_update_mode** **(** :ref:`int<class_int>` mode **)**
  286. Set when the render target should be updated, has to be one of the ``RENDER_TARGET_UPDATE\_\*`` constants.
  287. .. _class_Viewport_set_render_target_vflip:
  288. - void **set_render_target_vflip** **(** :ref:`bool<class_bool>` enable **)**
  289. Set whether the render target should be flipped on the Y axis.
  290. .. _class_Viewport_set_size_override:
  291. - 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) **)**
  292. Set the size 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.
  293. .. _class_Viewport_set_size_override_stretch:
  294. - void **set_size_override_stretch** **(** :ref:`bool<class_bool>` enabled **)**
  295. Set whether the size override affects stretch as well.
  296. .. _class_Viewport_set_transparent_background:
  297. - void **set_transparent_background** **(** :ref:`bool<class_bool>` enable **)**
  298. If this viewport is a child of another viewport, keep the previously drawn background visible.
  299. .. _class_Viewport_set_use_own_world:
  300. - void **set_use_own_world** **(** :ref:`bool<class_bool>` enable **)**
  301. Make the viewport use a world separate from the parent viewport's world.
  302. .. _class_Viewport_set_world:
  303. - void **set_world** **(** :ref:`World<class_world>` world **)**
  304. Change the 3D world of the viewport.
  305. .. _class_Viewport_set_world_2d:
  306. - void **set_world_2d** **(** :ref:`World2D<class_world2d>` world_2d **)**
  307. .. _class_Viewport_unhandled_input:
  308. - void **unhandled_input** **(** :ref:`InputEvent<class_inputevent>` local_event **)**
  309. .. _class_Viewport_update_worlds:
  310. - void **update_worlds** **(** **)**
  311. Force update of the 2D and 3D worlds.
  312. .. _class_Viewport_warp_mouse:
  313. - void **warp_mouse** **(** :ref:`Vector2<class_vector2>` to_pos **)**
  314. Warp the mouse to a position, relative to the viewport.