1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
|
<?xml version="1.0" encoding="UTF-8" ?>
<class name="Viewport" inherits="Node" category="Core" version="3.0.alpha.custom_build">
<brief_description>
Creates a sub-view into the screen.
</brief_description>
<description>
A Viewport creates a different view into the screen, or a sub-view inside another viewport. Children 2D Nodes will display on it, and children Camera 3D nodes will render on it too.
Optionally, a viewport can have its own 2D or 3D world, so they don't share what they draw with other viewports.
If a viewport is a child of a [Control], it will automatically take up its same rect and position, otherwise they must be set manually.
Viewports can also choose to be audio listeners, so they generate positional audio depending on a 2D or 3D camera child of it.
Also, viewports can be assigned to different screens in case the devices have multiple screens.
Finally, viewports can also behave as render targets, in which case they will not be visible unless the associated texture is used to draw.
</description>
<tutorials>
</tutorials>
<demos>
</demos>
<methods>
<method name="find_world" qualifiers="const">
<return type="World">
</return>
<description>
Return the 3D world of the viewport, or if no such present, the one of the parent viewport.
</description>
</method>
<method name="find_world_2d" qualifiers="const">
<return type="World2D">
</return>
<description>
Return the 2D world of the viewport.
</description>
</method>
<method name="get_camera" qualifiers="const">
<return type="Camera">
</return>
<description>
Return the active 3D camera.
</description>
</method>
<method name="get_canvas_transform" qualifiers="const">
<return type="Transform2D">
</return>
<description>
Get the canvas transform of the viewport.
</description>
</method>
<method name="get_clear_mode" qualifiers="const">
<return type="int" enum="Viewport.ClearMode">
</return>
<description>
</description>
</method>
<method name="get_debug_draw" qualifiers="const">
<return type="int" enum="Viewport.DebugDraw">
</return>
<description>
</description>
</method>
<method name="get_final_transform" qualifiers="const">
<return type="Transform2D">
</return>
<description>
Get the total transform of the viewport.
</description>
</method>
<method name="get_global_canvas_transform" qualifiers="const">
<return type="Transform2D">
</return>
<description>
Get the global canvas transform of the viewport.
</description>
</method>
<method name="get_hdr" qualifiers="const">
<return type="bool">
</return>
<description>
Get whether the rendered texture has filters enabled.
</description>
</method>
<method name="get_mouse_position" qualifiers="const">
<return type="Vector2">
</return>
<description>
Get the mouse position, relative to the viewport.
</description>
</method>
<method name="get_msaa" qualifiers="const">
<return type="int" enum="Viewport.MSAA">
</return>
<description>
</description>
</method>
<method name="get_physics_object_picking">
<return type="bool">
</return>
<description>
Get whether picking for all physics objects inside the viewport is enabled.
</description>
</method>
<method name="get_render_info">
<return type="int">
</return>
<argument index="0" name="info" type="int" enum="Viewport.RenderInfo">
</argument>
<description>
</description>
</method>
<method name="get_shadow_atlas_quadrant_subdiv" qualifiers="const">
<return type="int" enum="Viewport.ShadowAtlasQuadrantSubdiv">
</return>
<argument index="0" name="quadrant" type="int">
</argument>
<description>
</description>
</method>
<method name="get_shadow_atlas_size" qualifiers="const">
<return type="int">
</return>
<description>
</description>
</method>
<method name="get_size" qualifiers="const">
<return type="Vector2">
</return>
<description>
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.
</description>
</method>
<method name="get_size_override" qualifiers="const">
<return type="Vector2">
</return>
<description>
Get the size override set with [method set_size_override].
</description>
</method>
<method name="get_texture" qualifiers="const">
<return type="ViewportTexture">
</return>
<description>
Get the viewport's texture, for use with various objects that you want to texture with the viewport.
</description>
</method>
<method name="get_update_mode" qualifiers="const">
<return type="int" enum="Viewport.UpdateMode">
</return>
<description>
Get when the viewport would be updated, will be one of the [code]UPDATE_*[/code] constants.
</description>
</method>
<method name="get_usage" qualifiers="const">
<return type="int" enum="Viewport.Usage">
</return>
<description>
</description>
</method>
<method name="get_vflip" qualifiers="const">
<return type="bool">
</return>
<description>
Set whether the render target is flipped on the Y axis.
</description>
</method>
<method name="get_viewport_rid" qualifiers="const">
<return type="RID">
</return>
<description>
Get the viewport RID from the [VisualServer].
</description>
</method>
<method name="get_visible_rect" qualifiers="const">
<return type="Rect2">
</return>
<description>
Return the final, visible rect in global screen coordinates.
</description>
</method>
<method name="get_world" qualifiers="const">
<return type="World">
</return>
<description>
Return the 3D world of the viewport.
</description>
</method>
<method name="get_world_2d" qualifiers="const">
<return type="World2D">
</return>
<description>
Return the 2D world of the viewport.
</description>
</method>
<method name="gui_get_drag_data" qualifiers="const">
<return type="Variant">
</return>
<description>
Returns the drag data from the GUI, that was previously returned by [method Control.get_drag_data].
</description>
</method>
<method name="gui_has_modal_stack" qualifiers="const">
<return type="bool">
</return>
<description>
Returns whether there are shown modals on-screen.
</description>
</method>
<method name="has_transparent_background" qualifiers="const">
<return type="bool">
</return>
<description>
Return whether the viewport lets whatever is behind it to show.
</description>
</method>
<method name="input">
<return type="void">
</return>
<argument index="0" name="local_event" type="InputEvent">
</argument>
<description>
</description>
</method>
<method name="is_3d_disabled" qualifiers="const">
<return type="bool">
</return>
<description>
</description>
</method>
<method name="is_audio_listener" qualifiers="const">
<return type="bool">
</return>
<description>
Returns whether the viewport sends sounds to the speakers.
</description>
</method>
<method name="is_audio_listener_2d" qualifiers="const">
<return type="bool">
</return>
<description>
Returns whether the viewport sends soundsfrom 2D emitters to the speakers.
</description>
</method>
<method name="is_input_disabled" qualifiers="const">
<return type="bool">
</return>
<description>
Return whether input to the viewport is disabled.
</description>
</method>
<method name="is_size_override_enabled" qualifiers="const">
<return type="bool">
</return>
<description>
Get the enabled status of the size override set with [method set_size_override].
</description>
</method>
<method name="is_size_override_stretch_enabled" qualifiers="const">
<return type="bool">
</return>
<description>
Get the enabled status of the size strech override set with [method set_size_override_stretch].
</description>
</method>
<method name="is_snap_controls_to_pixels_enabled" qualifiers="const">
<return type="bool">
</return>
<description>
</description>
</method>
<method name="is_using_own_world" qualifiers="const">
<return type="bool">
</return>
<description>
Return whether the viewport is using a world separate from the parent viewport's world.
</description>
</method>
<method name="set_as_audio_listener">
<return type="void">
</return>
<argument index="0" name="enable" type="bool">
</argument>
<description>
Makes the viewport send sounds to the speakers.
</description>
</method>
<method name="set_as_audio_listener_2d">
<return type="void">
</return>
<argument index="0" name="enable" type="bool">
</argument>
<description>
Makes the viewport send sounds from 2D emitters to the speakers.
</description>
</method>
<method name="set_attach_to_screen_rect">
<return type="void">
</return>
<argument index="0" name="rect" type="Rect2">
</argument>
<description>
</description>
</method>
<method name="set_canvas_transform">
<return type="void">
</return>
<argument index="0" name="xform" type="Transform2D">
</argument>
<description>
Set the canvas transform of the viewport, useful for changing the on-screen positions of all child [CanvasItem]s. This is relative to the global canvas transform of the viewport.
</description>
</method>
<method name="set_clear_mode">
<return type="void">
</return>
<argument index="0" name="mode" type="int" enum="Viewport.ClearMode">
</argument>
<description>
</description>
</method>
<method name="set_debug_draw">
<return type="void">
</return>
<argument index="0" name="debug_draw" type="int" enum="Viewport.DebugDraw">
</argument>
<description>
</description>
</method>
<method name="set_disable_3d">
<return type="void">
</return>
<argument index="0" name="disable" type="bool">
</argument>
<description>
</description>
</method>
<method name="set_disable_input">
<return type="void">
</return>
<argument index="0" name="disable" type="bool">
</argument>
<description>
Set whether input to the viewport is disabled.
</description>
</method>
<method name="set_global_canvas_transform">
<return type="void">
</return>
<argument index="0" name="xform" type="Transform2D">
</argument>
<description>
Set the global canvas transform of the viewport. The canvas transform is relative to this.
</description>
</method>
<method name="set_hdr">
<return type="void">
</return>
<argument index="0" name="enable" type="bool">
</argument>
<description>
</description>
</method>
<method name="set_msaa">
<return type="void">
</return>
<argument index="0" name="msaa" type="int" enum="Viewport.MSAA">
</argument>
<description>
</description>
</method>
<method name="set_physics_object_picking">
<return type="void">
</return>
<argument index="0" name="enable" type="bool">
</argument>
<description>
Enable/disable picking for all physics objects inside the viewport.
</description>
</method>
<method name="set_shadow_atlas_quadrant_subdiv">
<return type="void">
</return>
<argument index="0" name="quadrant" type="int">
</argument>
<argument index="1" name="subdiv" type="int" enum="Viewport.ShadowAtlasQuadrantSubdiv">
</argument>
<description>
</description>
</method>
<method name="set_shadow_atlas_size">
<return type="void">
</return>
<argument index="0" name="size" type="int">
</argument>
<description>
</description>
</method>
<method name="set_size">
<return type="void">
</return>
<argument index="0" name="size" type="Vector2">
</argument>
<description>
Set the size of the viewport.
</description>
</method>
<method name="set_size_override">
<return type="void">
</return>
<argument index="0" name="enable" type="bool">
</argument>
<argument index="1" name="size" type="Vector2" default="Vector2( -1, -1 )">
</argument>
<argument index="2" name="margin" type="Vector2" default="Vector2( 0, 0 )">
</argument>
<description>
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 [code](-1, -1)[/code], it won't update the size.
</description>
</method>
<method name="set_size_override_stretch">
<return type="void">
</return>
<argument index="0" name="enabled" type="bool">
</argument>
<description>
Set whether the size override affects stretch as well.
</description>
</method>
<method name="set_snap_controls_to_pixels">
<return type="void">
</return>
<argument index="0" name="enabled" type="bool">
</argument>
<description>
</description>
</method>
<method name="set_transparent_background">
<return type="void">
</return>
<argument index="0" name="enable" type="bool">
</argument>
<description>
If this viewport is a child of another viewport, keep the previously drawn background visible.
</description>
</method>
<method name="set_update_mode">
<return type="void">
</return>
<argument index="0" name="mode" type="int" enum="Viewport.UpdateMode">
</argument>
<description>
Set when the render target would be updated, using the [code]UPDATE_*[/code] constants
</description>
</method>
<method name="set_usage">
<return type="void">
</return>
<argument index="0" name="usage" type="int" enum="Viewport.Usage">
</argument>
<description>
</description>
</method>
<method name="set_use_arvr">
<return type="void">
</return>
<argument index="0" name="use" type="bool">
</argument>
<description>
If true this viewport will be bound to our ARVR Server.
If this is our main Godot viewport our AR/VR output will be displayed on screen.
If output is redirected to an HMD we'll see the output of just one of the eyes without any distortion applied else we'll see the stereo buffer with distortion applied if applicable
If this is an extra viewport output will only work if redirection to an HMD is supported by the interface. The render target will allow you to use the undistorted output for the right eye in the display.
</description>
</method>
<method name="set_use_own_world">
<return type="void">
</return>
<argument index="0" name="enable" type="bool">
</argument>
<description>
Make the viewport use a world separate from the parent viewport's world.
</description>
</method>
<method name="set_vflip">
<return type="void">
</return>
<argument index="0" name="enable" type="bool">
</argument>
<description>
Set whether the viewport is flipped on the Y axis.
</description>
</method>
<method name="set_world">
<return type="void">
</return>
<argument index="0" name="world" type="World">
</argument>
<description>
Change the 3D world of the viewport.
</description>
</method>
<method name="set_world_2d">
<return type="void">
</return>
<argument index="0" name="world_2d" type="World2D">
</argument>
<description>
</description>
</method>
<method name="unhandled_input">
<return type="void">
</return>
<argument index="0" name="local_event" type="InputEvent">
</argument>
<description>
</description>
</method>
<method name="update_worlds">
<return type="void">
</return>
<description>
Force update of the 2D and 3D worlds.
</description>
</method>
<method name="use_arvr">
<return type="bool">
</return>
<description>
Returns whether this viewport is using our ARVR Server
</description>
</method>
<method name="warp_mouse">
<return type="void">
</return>
<argument index="0" name="to_position" type="Vector2">
</argument>
<description>
Warp the mouse to a position, relative to the viewport.
</description>
</method>
</methods>
<members>
<member name="arvr" type="bool" setter="set_use_arvr" getter="use_arvr">
</member>
<member name="audio_listener_enable_2d" type="bool" setter="set_as_audio_listener_2d" getter="is_audio_listener_2d">
</member>
<member name="audio_listener_enable_3d" type="bool" setter="set_as_audio_listener" getter="is_audio_listener">
</member>
<member name="debug_draw" type="int" setter="set_debug_draw" getter="get_debug_draw" enum="Viewport.DebugDraw">
</member>
<member name="disable_3d" type="bool" setter="set_disable_3d" getter="is_3d_disabled">
</member>
<member name="gui_disable_input" type="bool" setter="set_disable_input" getter="is_input_disabled">
</member>
<member name="gui_snap_controls_to_pixels" type="bool" setter="set_snap_controls_to_pixels" getter="is_snap_controls_to_pixels_enabled">
</member>
<member name="hdr" type="bool" setter="set_hdr" getter="get_hdr">
</member>
<member name="msaa" type="int" setter="set_msaa" getter="get_msaa" enum="Viewport.MSAA">
</member>
<member name="own_world" type="bool" setter="set_use_own_world" getter="is_using_own_world">
</member>
<member name="physics_object_picking" type="bool" setter="set_physics_object_picking" getter="get_physics_object_picking">
</member>
<member name="render_target_clear_mode" type="int" setter="set_clear_mode" getter="get_clear_mode" enum="Viewport.ClearMode">
</member>
<member name="render_target_update_mode" type="int" setter="set_update_mode" getter="get_update_mode" enum="Viewport.UpdateMode">
</member>
<member name="render_target_v_flip" type="bool" setter="set_vflip" getter="get_vflip">
</member>
<member name="shadow_atlas_quad_0" type="int" setter="set_shadow_atlas_quadrant_subdiv" getter="get_shadow_atlas_quadrant_subdiv" enum="Viewport.ShadowAtlasQuadrantSubdiv">
</member>
<member name="shadow_atlas_quad_1" type="int" setter="set_shadow_atlas_quadrant_subdiv" getter="get_shadow_atlas_quadrant_subdiv" enum="Viewport.ShadowAtlasQuadrantSubdiv">
</member>
<member name="shadow_atlas_quad_2" type="int" setter="set_shadow_atlas_quadrant_subdiv" getter="get_shadow_atlas_quadrant_subdiv" enum="Viewport.ShadowAtlasQuadrantSubdiv">
</member>
<member name="shadow_atlas_quad_3" type="int" setter="set_shadow_atlas_quadrant_subdiv" getter="get_shadow_atlas_quadrant_subdiv" enum="Viewport.ShadowAtlasQuadrantSubdiv">
</member>
<member name="shadow_atlas_size" type="int" setter="set_shadow_atlas_size" getter="get_shadow_atlas_size">
</member>
<member name="size" type="Vector2" setter="set_size" getter="get_size">
</member>
<member name="transparent_bg" type="bool" setter="set_transparent_background" getter="has_transparent_background">
</member>
<member name="usage" type="int" setter="set_usage" getter="get_usage" enum="Viewport.Usage">
</member>
<member name="world" type="World" setter="set_world" getter="get_world">
</member>
</members>
<signals>
<signal name="size_changed">
<description>
Emitted when the size of the viewport is changed, whether by [method set_size_override], resize of window, or some other means.
</description>
</signal>
</signals>
<constants>
<constant name="UPDATE_DISABLED" value="0">
Do not update the render target.
</constant>
<constant name="UPDATE_ONCE" value="1">
Update the render target once, then switch to [code]UPDATE_DISABLED[/code]
</constant>
<constant name="UPDATE_WHEN_VISIBLE" value="2">
Update the render target only when it is visible. This is the default value.
</constant>
<constant name="UPDATE_ALWAYS" value="3">
</constant>
<constant name="SHADOW_ATLAS_QUADRANT_SUBDIV_DISABLED" value="0">
</constant>
<constant name="SHADOW_ATLAS_QUADRANT_SUBDIV_1" value="1">
</constant>
<constant name="SHADOW_ATLAS_QUADRANT_SUBDIV_4" value="2">
</constant>
<constant name="SHADOW_ATLAS_QUADRANT_SUBDIV_16" value="3">
</constant>
<constant name="SHADOW_ATLAS_QUADRANT_SUBDIV_64" value="4">
</constant>
<constant name="SHADOW_ATLAS_QUADRANT_SUBDIV_256" value="5">
</constant>
<constant name="SHADOW_ATLAS_QUADRANT_SUBDIV_1024" value="6">
</constant>
<constant name="SHADOW_ATLAS_QUADRANT_SUBDIV_MAX" value="7">
</constant>
<constant name="RENDER_INFO_OBJECTS_IN_FRAME" value="0">
</constant>
<constant name="RENDER_INFO_VERTICES_IN_FRAME" value="1">
</constant>
<constant name="RENDER_INFO_MATERIAL_CHANGES_IN_FRAME" value="2">
</constant>
<constant name="RENDER_INFO_SHADER_CHANGES_IN_FRAME" value="3">
</constant>
<constant name="RENDER_INFO_SURFACE_CHANGES_IN_FRAME" value="4">
</constant>
<constant name="RENDER_INFO_DRAW_CALLS_IN_FRAME" value="5">
</constant>
<constant name="RENDER_INFO_MAX" value="6">
</constant>
<constant name="DEBUG_DRAW_DISABLED" value="0">
</constant>
<constant name="DEBUG_DRAW_UNSHADED" value="1">
</constant>
<constant name="DEBUG_DRAW_OVERDRAW" value="2">
</constant>
<constant name="DEBUG_DRAW_WIREFRAME" value="3">
</constant>
<constant name="MSAA_DISABLED" value="0">
</constant>
<constant name="MSAA_2X" value="1">
</constant>
<constant name="MSAA_4X" value="2">
</constant>
<constant name="MSAA_8X" value="3">
</constant>
<constant name="MSAA_16X" value="4">
</constant>
<constant name="USAGE_2D" value="0">
</constant>
<constant name="USAGE_2D_NO_SAMPLING" value="1">
</constant>
<constant name="USAGE_3D" value="2">
</constant>
<constant name="USAGE_3D_NO_EFFECTS" value="3">
</constant>
<constant name="CLEAR_MODE_ALWAYS" value="0">
</constant>
<constant name="CLEAR_MODE_NEVER" value="1">
</constant>
<constant name="CLEAR_MODE_ONLY_NEXT_FRAME" value="2">
</constant>
</constants>
</class>
|