2017-09-12 22:42:36 +02:00
<?xml version="1.0" encoding="UTF-8" ?>
2023-07-06 10:08:05 +02:00
<class name= "Line2D" inherits= "Node2D" xmlns:xsi= "http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation= "../class.xsd" >
2017-09-12 22:42:36 +02:00
<brief_description >
2023-08-28 20:44:06 +02:00
A 2D polyline that can optionally be textured.
2017-09-12 22:42:36 +02:00
</brief_description>
<description >
2023-08-28 20:44:06 +02:00
This node draws a 2D polyline, i.e. a shape consisting of several points connected by segments. [Line2D] is not a mathematical polyline, i.e. the segments are not infinitely thin. It is intended for rendering and it can be colored and optionally textured.
[b]Warning:[/b] Certain configurations may be impossible to draw nicely, such as very sharp angles. In these situations, the node uses fallback drawing logic to look decent.
[b]Note:[/b] [Line2D] is drawn using a 2D mesh.
2017-09-12 22:42:36 +02:00
</description>
<tutorials >
2020-10-01 10:34:47 +02:00
<link title= "Matrix Transform Demo" > https://godotengine.org/asset-library/asset/584</link>
<link title= "2.5D Demo" > https://godotengine.org/asset-library/asset/583</link>
2017-09-12 22:42:36 +02:00
</tutorials>
<methods >
<method name= "add_point" >
2021-07-30 15:28:05 +02:00
<return type= "void" />
2022-08-06 20:11:48 +02:00
<param index= "0" name= "position" type= "Vector2" />
2022-08-15 16:31:23 +02:00
<param index= "1" name= "index" type= "int" default= "-1" />
2017-09-12 22:42:36 +02:00
<description >
2023-08-28 20:44:06 +02:00
Adds a point with the specified [param position] relative to the polyline's own position. If no [param index] is provided, the new point will be added to the end of the points array.
If [param index] is given, the new point is inserted before the existing point identified by index [param index]. The indices of the points after the new point get increased by 1. The provided [param index] must not exceed the number of existing points in the polyline. See [method get_point_count].
2017-09-12 22:42:36 +02:00
</description>
</method>
2019-03-19 17:59:24 +01:00
<method name= "clear_points" >
2021-07-30 15:28:05 +02:00
<return type= "void" />
2019-03-19 17:59:24 +01:00
<description >
2023-08-28 20:44:06 +02:00
Removes all points from the polyline, making it empty.
2019-03-19 17:59:24 +01:00
</description>
</method>
2017-09-12 22:42:36 +02:00
<method name= "get_point_count" qualifiers= "const" >
2021-07-30 15:28:05 +02:00
<return type= "int" />
2017-09-12 22:42:36 +02:00
<description >
2023-08-28 20:44:06 +02:00
Returns the number of points in the polyline.
2017-09-12 22:42:36 +02:00
</description>
</method>
2017-09-10 15:37:49 +02:00
<method name= "get_point_position" qualifiers= "const" >
2021-07-30 15:28:05 +02:00
<return type= "Vector2" />
2022-08-15 16:31:23 +02:00
<param index= "0" name= "index" type= "int" />
2017-09-12 22:42:36 +02:00
<description >
2022-08-15 16:31:23 +02:00
Returns the position of the point at index [param index].
2017-09-12 22:42:36 +02:00
</description>
</method>
<method name= "remove_point" >
2021-07-30 15:28:05 +02:00
<return type= "void" />
2022-08-15 16:31:23 +02:00
<param index= "0" name= "index" type= "int" />
2017-09-12 22:42:36 +02:00
<description >
2023-08-28 20:44:06 +02:00
Removes the point at index [param index] from the polyline.
2017-09-12 22:42:36 +02:00
</description>
</method>
2017-09-10 15:37:49 +02:00
<method name= "set_point_position" >
2021-07-30 15:28:05 +02:00
<return type= "void" />
2022-08-15 16:31:23 +02:00
<param index= "0" name= "index" type= "int" />
2022-08-06 20:11:48 +02:00
<param index= "1" name= "position" type= "Vector2" />
2017-09-12 22:42:36 +02:00
<description >
2023-08-28 20:44:06 +02:00
Overwrites the position of the point at the given [param index] with the supplied [param position].
2017-09-12 22:42:36 +02:00
</description>
</method>
</methods>
<members >
2019-11-24 11:00:02 +01:00
<member name= "antialiased" type= "bool" setter= "set_antialiased" getter= "get_antialiased" default= "false" >
2023-08-28 20:44:06 +02:00
If [code]true[/code], the polyline's border will be anti-aliased.
[b]Note:[/b] [Line2D] is not accelerated by batching when being anti-aliased.
2019-11-24 11:00:02 +01:00
</member>
2019-06-29 12:38:01 +02:00
<member name= "begin_cap_mode" type= "int" setter= "set_begin_cap_mode" getter= "get_begin_cap_mode" enum= "Line2D.LineCapMode" default= "0" >
2023-08-28 20:44:06 +02:00
The style of the beginning of the polyline. Use [enum LineCapMode] constants.
2017-09-12 22:42:36 +02:00
</member>
2019-09-24 19:45:03 +02:00
<member name= "default_color" type= "Color" setter= "set_default_color" getter= "get_default_color" default= "Color(1, 1, 1, 1)" >
2023-08-28 20:44:06 +02:00
The color of the polyline. Will not be used if a gradient is set.
2017-09-12 22:42:36 +02:00
</member>
2019-06-29 12:38:01 +02:00
<member name= "end_cap_mode" type= "int" setter= "set_end_cap_mode" getter= "get_end_cap_mode" enum= "Line2D.LineCapMode" default= "0" >
2023-08-28 20:44:06 +02:00
The style of the end of the polyline. Use [enum LineCapMode] constants.
2017-09-12 22:42:36 +02:00
</member>
2019-07-15 20:42:47 +02:00
<member name= "gradient" type= "Gradient" setter= "set_gradient" getter= "get_gradient" >
2017-10-02 00:12:14 +02:00
The gradient is drawn through the whole line from start to finish. The default color will not be used if a gradient is set.
2017-09-12 22:42:36 +02:00
</member>
2019-06-29 12:38:01 +02:00
<member name= "joint_mode" type= "int" setter= "set_joint_mode" getter= "get_joint_mode" enum= "Line2D.LineJointMode" default= "0" >
2023-08-28 20:44:06 +02:00
The style of the connections between segments of the polyline. Use [enum LineJointMode] constants.
2017-09-12 22:42:36 +02:00
</member>
2019-09-24 19:45:03 +02:00
<member name= "points" type= "PackedVector2Array" setter= "set_points" getter= "get_points" default= "PackedVector2Array()" >
2023-08-28 20:44:06 +02:00
The points of the polyline, interpreted in local 2D coordinates. Segments are drawn between the adjacent points in this array.
2017-09-12 22:42:36 +02:00
</member>
2019-06-29 12:38:01 +02:00
<member name= "round_precision" type= "int" setter= "set_round_precision" getter= "get_round_precision" default= "8" >
2023-08-28 20:44:06 +02:00
The smoothness used for rounded joints and caps. Higher values result in smoother corners, but are more demanding to render and update.
2017-09-12 22:42:36 +02:00
</member>
2019-06-29 12:38:01 +02:00
<member name= "sharp_limit" type= "float" setter= "set_sharp_limit" getter= "get_sharp_limit" default= "2.0" >
2023-08-28 20:44:06 +02:00
Determines the miter limit of the polyline. Normally, when [member joint_mode] is set to [constant LINE_JOINT_SHARP], sharp angles fall back to using the logic of [constant LINE_JOINT_BEVEL] joints to prevent very long miters. Higher values of this property mean that the fallback to a bevel joint will happen at sharper angles.
2017-09-12 22:42:36 +02:00
</member>
2020-02-12 09:59:06 +01:00
<member name= "texture" type= "Texture2D" setter= "set_texture" getter= "get_texture" >
2023-08-28 20:44:06 +02:00
The texture used for the polyline. Uses [code]texture_mode[/code] for drawing style.
2017-09-12 22:42:36 +02:00
</member>
2019-06-29 21:45:14 +02:00
<member name= "texture_mode" type= "int" setter= "set_texture_mode" getter= "get_texture_mode" enum= "Line2D.LineTextureMode" default= "0" >
2023-08-28 20:44:06 +02:00
The style to render the [member texture] of the polyline. Use [enum LineTextureMode] constants.
2017-09-12 22:42:36 +02:00
</member>
2019-06-29 12:38:01 +02:00
<member name= "width" type= "float" setter= "set_width" getter= "get_width" default= "10.0" >
2023-08-28 20:44:06 +02:00
The polyline's width
2017-09-12 22:42:36 +02:00
</member>
2019-07-15 20:42:47 +02:00
<member name= "width_curve" type= "Curve" setter= "set_curve" getter= "get_curve" >
2023-08-28 20:44:06 +02:00
The polyline's width curve. The width of the polyline over its length will be equivalent to the value of the width curve over its domain.
2019-05-01 06:50:01 +02:00
</member>
2017-09-12 22:42:36 +02:00
</members>
<constants >
2017-11-24 23:16:30 +01:00
<constant name= "LINE_JOINT_SHARP" value= "0" enum= "LineJointMode" >
2023-08-28 20:44:06 +02:00
Makes the polyline's joints pointy, connecting the sides of the two segments by extending them until they intersect. If the rotation of a joint is too big (based on [member sharp_limit]), the joint falls back to [constant LINE_JOINT_BEVEL] to prevent very long miters.
2017-09-12 22:42:36 +02:00
</constant>
2017-11-24 23:16:30 +01:00
<constant name= "LINE_JOINT_BEVEL" value= "1" enum= "LineJointMode" >
2023-08-28 20:44:06 +02:00
Makes the polyline's joints bevelled/chamfered, connecting the sides of the two segments with a simple line.
2017-09-12 22:42:36 +02:00
</constant>
2017-11-24 23:16:30 +01:00
<constant name= "LINE_JOINT_ROUND" value= "2" enum= "LineJointMode" >
2023-08-28 20:44:06 +02:00
Makes the polyline's joints rounded, connecting the sides of the two segments with an arc. The detail of this arc depends on [member round_precision].
2017-09-12 22:42:36 +02:00
</constant>
2017-11-24 23:16:30 +01:00
<constant name= "LINE_CAP_NONE" value= "0" enum= "LineCapMode" >
2023-08-28 20:44:06 +02:00
Draws no line cap.
2017-09-12 22:42:36 +02:00
</constant>
2017-11-24 23:16:30 +01:00
<constant name= "LINE_CAP_BOX" value= "1" enum= "LineCapMode" >
2023-08-28 20:44:06 +02:00
Draws the line cap as a box, slightly extending the first/last segment.
2017-09-12 22:42:36 +02:00
</constant>
2017-11-24 23:16:30 +01:00
<constant name= "LINE_CAP_ROUND" value= "2" enum= "LineCapMode" >
2023-08-28 20:44:06 +02:00
Draws the line cap as a semicircle attached to the first/last segment.
2017-09-12 22:42:36 +02:00
</constant>
2017-11-24 23:16:30 +01:00
<constant name= "LINE_TEXTURE_NONE" value= "0" enum= "LineTextureMode" >
2023-08-28 20:44:06 +02:00
Takes the left pixels of the texture and renders them over the whole polyline.
2017-09-12 22:42:36 +02:00
</constant>
2017-11-24 23:16:30 +01:00
<constant name= "LINE_TEXTURE_TILE" value= "1" enum= "LineTextureMode" >
2023-08-28 20:44:06 +02:00
Tiles the texture over the polyline. [member CanvasItem.texture_repeat] of the [Line2D] node must be [constant CanvasItem.TEXTURE_REPEAT_ENABLED] or [constant CanvasItem.TEXTURE_REPEAT_MIRROR] for it to work properly.
2017-09-12 22:42:36 +02:00
</constant>
2018-07-16 14:31:19 +02:00
<constant name= "LINE_TEXTURE_STRETCH" value= "2" enum= "LineTextureMode" >
2023-08-28 20:44:06 +02:00
Stretches the texture across the polyline. [member CanvasItem.texture_repeat] of the [Line2D] node must be [constant CanvasItem.TEXTURE_REPEAT_DISABLED] for best results.
2018-07-16 14:31:19 +02:00
</constant>
2017-09-12 22:42:36 +02:00
</constants>
</class>