2020-03-31 03:37:37 +08:00
<?xml version="1.0" encoding="UTF-8" ?>
2023-07-06 16:08:05 +08:00
<class name= "SubViewport" inherits= "Viewport" xmlns:xsi= "http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation= "../class.xsd" >
2020-03-31 03:37:37 +08:00
<brief_description >
2023-04-30 22:26:09 +08:00
An interface to a game world that doesn't create a window or draw to the screen directly.
2020-03-31 03:37:37 +08:00
</brief_description>
<description >
2023-04-30 22:26:09 +08:00
[SubViewport] Isolates a rectangular region of a scene to be displayed independently. This can be used, for example, to display UI in 3D space.
[b]Note:[/b] [SubViewport] is a [Viewport] that isn't a [Window], i.e. it doesn't draw anything by itself. To display anything, [SubViewport] must have a non-zero size and be either put inside a [SubViewportContainer] or assigned to a [ViewportTexture].
2020-03-31 03:37:37 +08:00
</description>
<tutorials >
2021-11-15 17:43:07 +08:00
<link title= "Using Viewports" > $DOCS_URL/tutorials/rendering/viewports.html</link>
<link title= "Viewport and canvas transforms" > $DOCS_URL/tutorials/2d/2d_transforms.html</link>
2020-10-01 16:34:47 +08:00
<link title= "GUI in 3D Demo" > https://godotengine.org/asset-library/asset/127</link>
<link title= "3D in 2D Demo" > https://godotengine.org/asset-library/asset/128</link>
<link title= "2D in 3D Demo" > https://godotengine.org/asset-library/asset/129</link>
<link title= "Screen Capture Demo" > https://godotengine.org/asset-library/asset/130</link>
<link title= "Dynamic Split Screen Demo" > https://godotengine.org/asset-library/asset/541</link>
<link title= "3D Viewport Scaling Demo" > https://godotengine.org/asset-library/asset/586</link>
2020-03-31 03:37:37 +08:00
</tutorials>
<members >
<member name= "render_target_clear_mode" type= "int" setter= "set_clear_mode" getter= "get_clear_mode" enum= "SubViewport.ClearMode" default= "0" >
2020-04-01 11:47:58 +08:00
The clear mode when the sub-viewport is used as a render target.
2020-09-03 01:53:10 +08:00
[b]Note:[/b] This property is intended for 2D usage.
2020-03-31 03:37:37 +08:00
</member>
<member name= "render_target_update_mode" type= "int" setter= "set_update_mode" getter= "get_update_mode" enum= "SubViewport.UpdateMode" default= "2" >
2020-04-01 11:47:58 +08:00
The update mode when the sub-viewport is used as a render target.
</member>
2019-09-25 01:45:03 +08:00
<member name= "size" type= "Vector2i" setter= "set_size" getter= "get_size" default= "Vector2i(512, 512)" >
2021-10-01 22:36:28 +08:00
The width and height of the sub-viewport. Must be set to a value greater than or equal to 2 pixels on both dimensions. Otherwise, nothing will be displayed.
2022-10-05 03:53:18 +08:00
[b]Note:[/b] If the parent node is a [SubViewportContainer] and its [member SubViewportContainer.stretch] is [code]true[/code], the viewport size cannot be changed manually.
2020-04-01 11:47:58 +08:00
</member>
2019-09-25 01:45:03 +08:00
<member name= "size_2d_override" type= "Vector2i" setter= "set_size_2d_override" getter= "get_size_2d_override" default= "Vector2i(0, 0)" >
2020-04-01 11:47:58 +08:00
The 2D size override of the sub-viewport. If either the width or height is [code]0[/code], the override is disabled.
</member>
<member name= "size_2d_override_stretch" type= "bool" setter= "set_size_2d_override_stretch" getter= "is_size_2d_override_stretch_enabled" default= "false" >
If [code]true[/code], the 2D size override affects stretch as well.
2020-03-31 03:37:37 +08:00
</member>
</members>
<constants >
2020-04-20 17:48:00 +08:00
<constant name= "CLEAR_MODE_ALWAYS" value= "0" enum= "ClearMode" >
Always clear the render target before drawing.
</constant>
<constant name= "CLEAR_MODE_NEVER" value= "1" enum= "ClearMode" >
Never clear the render target.
</constant>
2020-12-10 20:19:04 +08:00
<constant name= "CLEAR_MODE_ONCE" value= "2" enum= "ClearMode" >
Clear the render target on the next frame, then switch to [constant CLEAR_MODE_NEVER].
2020-04-20 17:48:00 +08:00
</constant>
2020-03-31 03:37:37 +08:00
<constant name= "UPDATE_DISABLED" value= "0" enum= "UpdateMode" >
2020-04-01 11:47:58 +08:00
Do not update the render target.
2020-03-31 03:37:37 +08:00
</constant>
<constant name= "UPDATE_ONCE" value= "1" enum= "UpdateMode" >
2020-04-01 11:47:58 +08:00
Update the render target once, then switch to [constant UPDATE_DISABLED].
2020-03-31 03:37:37 +08:00
</constant>
<constant name= "UPDATE_WHEN_VISIBLE" value= "2" enum= "UpdateMode" >
2020-04-01 11:47:58 +08:00
Update the render target only when it is visible. This is the default value.
2020-03-31 03:37:37 +08:00
</constant>
<constant name= "UPDATE_WHEN_PARENT_VISIBLE" value= "3" enum= "UpdateMode" >
2020-12-10 20:19:04 +08:00
Update the render target only when its parent is visible.
2020-03-31 03:37:37 +08:00
</constant>
<constant name= "UPDATE_ALWAYS" value= "4" enum= "UpdateMode" >
2020-04-01 11:47:58 +08:00
Always update the render target.
2020-03-31 03:37:37 +08:00
</constant>
</constants>
</class>