| 1 | <?xml version="1.0" encoding="UTF-8" ?> |
| 2 | <class name="Curve" inherits="Resource" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> |
| 3 | <brief_description> |
| 4 | A mathematical curve. |
| 5 | </brief_description> |
| 6 | <description> |
| 7 | This resource describes a mathematical curve by defining a set of points and tangents at each point. By default, it ranges between [code]0[/code] and [code]1[/code] on the X and Y axes, but these ranges can be changed. |
| 8 | Please note that many resources and nodes assume they are given [i]unit curves[/i]. A unit curve is a curve whose domain (the X axis) is between [code]0[/code] and [code]1[/code]. Some examples of unit curve usage are [member CPUParticles2D.angle_curve] and [member Line2D.width_curve]. |
| 9 | </description> |
| 10 | <tutorials> |
| 11 | </tutorials> |
| 12 | <methods> |
| 13 | <method name="add_point"> |
| 14 | <return type="int" /> |
| 15 | <param index="0" name="position" type="Vector2" /> |
| 16 | <param index="1" name="left_tangent" type="float" default="0" /> |
| 17 | <param index="2" name="right_tangent" type="float" default="0" /> |
| 18 | <param index="3" name="left_mode" type="int" enum="Curve.TangentMode" default="0" /> |
| 19 | <param index="4" name="right_mode" type="int" enum="Curve.TangentMode" default="0" /> |
| 20 | <description> |
| 21 | Adds a point to the curve. For each side, if the [code]*_mode[/code] is [constant TANGENT_LINEAR], the [code]*_tangent[/code] angle (in degrees) uses the slope of the curve halfway to the adjacent point. Allows custom assignments to the [code]*_tangent[/code] angle if [code]*_mode[/code] is set to [constant TANGENT_FREE]. |
| 22 | </description> |
| 23 | </method> |
| 24 | <method name="bake"> |
| 25 | <return type="void" /> |
| 26 | <description> |
| 27 | Recomputes the baked cache of points for the curve. |
| 28 | </description> |
| 29 | </method> |
| 30 | <method name="clean_dupes"> |
| 31 | <return type="void" /> |
| 32 | <description> |
| 33 | Removes duplicate points, i.e. points that are less than 0.00001 units (engine epsilon value) away from their neighbor on the curve. |
| 34 | </description> |
| 35 | </method> |
| 36 | <method name="clear_points"> |
| 37 | <return type="void" /> |
| 38 | <description> |
| 39 | Removes all points from the curve. |
| 40 | </description> |
| 41 | </method> |
| 42 | <method name="get_domain_range" qualifiers="const"> |
| 43 | <return type="float" /> |
| 44 | <description> |
| 45 | Returns the difference between [member min_domain] and [member max_domain]. |
| 46 | </description> |
| 47 | </method> |
| 48 | <method name="get_point_left_mode" qualifiers="const"> |
| 49 | <return type="int" enum="Curve.TangentMode" /> |
| 50 | <param index="0" name="index" type="int" /> |
| 51 | <description> |
| 52 | Returns the left [enum TangentMode] for the point at [param index]. |
| 53 | </description> |
| 54 | </method> |
| 55 | <method name="get_point_left_tangent" qualifiers="const"> |
| 56 | <return type="float" /> |
| 57 | <param index="0" name="index" type="int" /> |
| 58 | <description> |
| 59 | Returns the left tangent angle (in degrees) for the point at [param index]. |
| 60 | </description> |
| 61 | </method> |
| 62 | <method name="get_point_position" qualifiers="const"> |
| 63 | <return type="Vector2" /> |
| 64 | <param index="0" name="index" type="int" /> |
| 65 | <description> |
| 66 | Returns the curve coordinates for the point at [param index]. |
| 67 | </description> |
| 68 | </method> |
| 69 | <method name="get_point_right_mode" qualifiers="const"> |
| 70 | <return type="int" enum="Curve.TangentMode" /> |
| 71 | <param index="0" name="index" type="int" /> |
| 72 | <description> |
| 73 | Returns the right [enum TangentMode] for the point at [param index]. |
| 74 | </description> |
| 75 | </method> |
| 76 | <method name="get_point_right_tangent" qualifiers="const"> |
| 77 | <return type="float" /> |
| 78 | <param index="0" name="index" type="int" /> |
| 79 | <description> |
| 80 | Returns the right tangent angle (in degrees) for the point at [param index]. |
| 81 | </description> |
| 82 | </method> |
| 83 | <method name="get_value_range" qualifiers="const"> |
| 84 | <return type="float" /> |
| 85 | <description> |
| 86 | Returns the difference between [member min_value] and [member max_value]. |
| 87 | </description> |
| 88 | </method> |
| 89 | <method name="remove_point"> |
| 90 | <return type="void" /> |
| 91 | <param index="0" name="index" type="int" /> |
| 92 | <description> |
| 93 | Removes the point at [param index] from the curve. |
| 94 | </description> |
| 95 | </method> |
| 96 | <method name="sample" qualifiers="const"> |
| 97 | <return type="float" /> |
| 98 | <param index="0" name="offset" type="float" /> |
| 99 | <description> |
| 100 | Returns the Y value for the point that would exist at the X position [param offset] along the curve. |
| 101 | </description> |
| 102 | </method> |
| 103 | <method name="sample_baked" qualifiers="const"> |
| 104 | <return type="float" /> |
| 105 | <param index="0" name="offset" type="float" /> |
| 106 | <description> |
| 107 | Returns the Y value for the point that would exist at the X position [param offset] along the curve using the baked cache. Bakes the curve's points if not already baked. |
| 108 | </description> |
| 109 | </method> |
| 110 | <method name="set_point_left_mode"> |
| 111 | <return type="void" /> |
| 112 | <param index="0" name="index" type="int" /> |
| 113 | <param index="1" name="mode" type="int" enum="Curve.TangentMode" /> |
| 114 | <description> |
| 115 | Sets the left [enum TangentMode] for the point at [param index] to [param mode]. |
| 116 | </description> |
| 117 | </method> |
| 118 | <method name="set_point_left_tangent"> |
| 119 | <return type="void" /> |
| 120 | <param index="0" name="index" type="int" /> |
| 121 | <param index="1" name="tangent" type="float" /> |
| 122 | <description> |
| 123 | Sets the left tangent angle for the point at [param index] to [param tangent]. |
| 124 | </description> |
| 125 | </method> |
| 126 | <method name="set_point_offset"> |
| 127 | <return type="int" /> |
| 128 | <param index="0" name="index" type="int" /> |
| 129 | <param index="1" name="offset" type="float" /> |
| 130 | <description> |
| 131 | Sets the offset from [code]0.5[/code]. |
| 132 | </description> |
| 133 | </method> |
| 134 | <method name="set_point_right_mode"> |
| 135 | <return type="void" /> |
| 136 | <param index="0" name="index" type="int" /> |
| 137 | <param index="1" name="mode" type="int" enum="Curve.TangentMode" /> |
| 138 | <description> |
| 139 | Sets the right [enum TangentMode] for the point at [param index] to [param mode]. |
| 140 | </description> |
| 141 | </method> |
| 142 | <method name="set_point_right_tangent"> |
| 143 | <return type="void" /> |
| 144 | <param index="0" name="index" type="int" /> |
| 145 | <param index="1" name="tangent" type="float" /> |
| 146 | <description> |
| 147 | Sets the right tangent angle for the point at [param index] to [param tangent]. |
| 148 | </description> |
| 149 | </method> |
| 150 | <method name="set_point_value"> |
| 151 | <return type="void" /> |
| 152 | <param index="0" name="index" type="int" /> |
| 153 | <param index="1" name="y" type="float" /> |
| 154 | <description> |
| 155 | Assigns the vertical position [param y] to the point at [param index]. |
| 156 | </description> |
| 157 | </method> |
| 158 | </methods> |
| 159 | <members> |
| 160 | <member name="bake_resolution" type="int" setter="set_bake_resolution" getter="get_bake_resolution" default="100"> |
| 161 | The number of points to include in the baked (i.e. cached) curve data. |
| 162 | </member> |
| 163 | <member name="max_domain" type="float" setter="set_max_domain" getter="get_max_domain" default="1.0"> |
| 164 | The maximum domain (x-coordinate) that points can have. |
| 165 | </member> |
| 166 | <member name="max_value" type="float" setter="set_max_value" getter="get_max_value" default="1.0"> |
| 167 | The maximum value (y-coordinate) that points can have. Tangents can cause higher values between points. |
| 168 | </member> |
| 169 | <member name="min_domain" type="float" setter="set_min_domain" getter="get_min_domain" default="0.0"> |
| 170 | The minimum domain (x-coordinate) that points can have. |
| 171 | </member> |
| 172 | <member name="min_value" type="float" setter="set_min_value" getter="get_min_value" default="0.0"> |
| 173 | The minimum value (y-coordinate) that points can have. Tangents can cause lower values between points. |
| 174 | </member> |
| 175 | <member name="point_count" type="int" setter="set_point_count" getter="get_point_count" default="0"> |
| 176 | The number of points describing the curve. |
| 177 | </member> |
| 178 | </members> |
| 179 | <signals> |
| 180 | <signal name="domain_changed"> |
| 181 | <description> |
| 182 | Emitted when [member max_domain] or [member min_domain] is changed. |
| 183 | </description> |
| 184 | </signal> |
| 185 | <signal name="range_changed"> |
| 186 | <description> |
| 187 | Emitted when [member max_value] or [member min_value] is changed. |
| 188 | </description> |
| 189 | </signal> |
| 190 | </signals> |
| 191 | <constants> |
| 192 | <constant name="TANGENT_FREE" value="0" enum="TangentMode"> |
| 193 | The tangent on this side of the point is user-defined. |
| 194 | </constant> |
| 195 | <constant name="TANGENT_LINEAR" value="1" enum="TangentMode"> |
| 196 | The curve calculates the tangent on this side of the point as the slope halfway towards the adjacent point. |
| 197 | </constant> |
| 198 | <constant name="TANGENT_MODE_COUNT" value="2" enum="TangentMode"> |
| 199 | The total number of available tangent modes. |
| 200 | </constant> |
| 201 | </constants> |
| 202 | </class> |