Curve.xml 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="Curve" inherits="Resource" version="4.0">
  3. <brief_description>
  4. A mathematic curve.
  5. </brief_description>
  6. <description>
  7. A curve that can be saved and re-used for other objects. By default, it ranges between [code]0[/code] and [code]1[/code] on the Y axis and positions points relative to the [code]0.5[/code] Y position.
  8. </description>
  9. <tutorials>
  10. </tutorials>
  11. <methods>
  12. <method name="add_point">
  13. <return type="int" />
  14. <argument index="0" name="position" type="Vector2" />
  15. <argument index="1" name="left_tangent" type="float" default="0" />
  16. <argument index="2" name="right_tangent" type="float" default="0" />
  17. <argument index="3" name="left_mode" type="int" enum="Curve.TangentMode" default="0" />
  18. <argument index="4" name="right_mode" type="int" enum="Curve.TangentMode" default="0" />
  19. <description>
  20. 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].
  21. </description>
  22. </method>
  23. <method name="bake">
  24. <return type="void" />
  25. <description>
  26. Recomputes the baked cache of points for the curve.
  27. </description>
  28. </method>
  29. <method name="clean_dupes">
  30. <return type="void" />
  31. <description>
  32. Removes points that are closer than [code]CMP_EPSILON[/code] (0.00001) units to their neighbor on the curve.
  33. </description>
  34. </method>
  35. <method name="clear_points">
  36. <return type="void" />
  37. <description>
  38. Removes all points from the curve.
  39. </description>
  40. </method>
  41. <method name="get_point_count" qualifiers="const">
  42. <return type="int" />
  43. <description>
  44. Returns the number of points describing the curve.
  45. </description>
  46. </method>
  47. <method name="get_point_left_mode" qualifiers="const">
  48. <return type="int" enum="Curve.TangentMode" />
  49. <argument index="0" name="index" type="int" />
  50. <description>
  51. Returns the left [enum TangentMode] for the point at [code]index[/code].
  52. </description>
  53. </method>
  54. <method name="get_point_left_tangent" qualifiers="const">
  55. <return type="float" />
  56. <argument index="0" name="index" type="int" />
  57. <description>
  58. Returns the left tangent angle (in degrees) for the point at [code]index[/code].
  59. </description>
  60. </method>
  61. <method name="get_point_position" qualifiers="const">
  62. <return type="Vector2" />
  63. <argument index="0" name="index" type="int" />
  64. <description>
  65. Returns the curve coordinates for the point at [code]index[/code].
  66. </description>
  67. </method>
  68. <method name="get_point_right_mode" qualifiers="const">
  69. <return type="int" enum="Curve.TangentMode" />
  70. <argument index="0" name="index" type="int" />
  71. <description>
  72. Returns the right [enum TangentMode] for the point at [code]index[/code].
  73. </description>
  74. </method>
  75. <method name="get_point_right_tangent" qualifiers="const">
  76. <return type="float" />
  77. <argument index="0" name="index" type="int" />
  78. <description>
  79. Returns the right tangent angle (in degrees) for the point at [code]index[/code].
  80. </description>
  81. </method>
  82. <method name="interpolate" qualifiers="const">
  83. <return type="float" />
  84. <argument index="0" name="offset" type="float" />
  85. <description>
  86. Returns the Y value for the point that would exist at the X position [code]offset[/code] along the curve.
  87. </description>
  88. </method>
  89. <method name="interpolate_baked" qualifiers="const">
  90. <return type="float" />
  91. <argument index="0" name="offset" type="float" />
  92. <description>
  93. Returns the Y value for the point that would exist at the X position [code]offset[/code] along the curve using the baked cache. Bakes the curve's points if not already baked.
  94. </description>
  95. </method>
  96. <method name="remove_point">
  97. <return type="void" />
  98. <argument index="0" name="index" type="int" />
  99. <description>
  100. Removes the point at [code]index[/code] from the curve.
  101. </description>
  102. </method>
  103. <method name="set_point_left_mode">
  104. <return type="void" />
  105. <argument index="0" name="index" type="int" />
  106. <argument index="1" name="mode" type="int" enum="Curve.TangentMode" />
  107. <description>
  108. Sets the left [enum TangentMode] for the point at [code]index[/code] to [code]mode[/code].
  109. </description>
  110. </method>
  111. <method name="set_point_left_tangent">
  112. <return type="void" />
  113. <argument index="0" name="index" type="int" />
  114. <argument index="1" name="tangent" type="float" />
  115. <description>
  116. Sets the left tangent angle for the point at [code]index[/code] to [code]tangent[/code].
  117. </description>
  118. </method>
  119. <method name="set_point_offset">
  120. <return type="int" />
  121. <argument index="0" name="index" type="int" />
  122. <argument index="1" name="offset" type="float" />
  123. <description>
  124. Sets the offset from [code]0.5[/code].
  125. </description>
  126. </method>
  127. <method name="set_point_right_mode">
  128. <return type="void" />
  129. <argument index="0" name="index" type="int" />
  130. <argument index="1" name="mode" type="int" enum="Curve.TangentMode" />
  131. <description>
  132. Sets the right [enum TangentMode] for the point at [code]index[/code] to [code]mode[/code].
  133. </description>
  134. </method>
  135. <method name="set_point_right_tangent">
  136. <return type="void" />
  137. <argument index="0" name="index" type="int" />
  138. <argument index="1" name="tangent" type="float" />
  139. <description>
  140. Sets the right tangent angle for the point at [code]index[/code] to [code]tangent[/code].
  141. </description>
  142. </method>
  143. <method name="set_point_value">
  144. <return type="void" />
  145. <argument index="0" name="index" type="int" />
  146. <argument index="1" name="y" type="float" />
  147. <description>
  148. Assigns the vertical position [code]y[/code] to the point at [code]index[/code].
  149. </description>
  150. </method>
  151. </methods>
  152. <members>
  153. <member name="bake_resolution" type="int" setter="set_bake_resolution" getter="get_bake_resolution" default="100">
  154. The number of points to include in the baked (i.e. cached) curve data.
  155. </member>
  156. <member name="max_value" type="float" setter="set_max_value" getter="get_max_value" default="1.0">
  157. The maximum value the curve can reach.
  158. </member>
  159. <member name="min_value" type="float" setter="set_min_value" getter="get_min_value" default="0.0">
  160. The minimum value the curve can reach.
  161. </member>
  162. </members>
  163. <signals>
  164. <signal name="range_changed">
  165. <description>
  166. Emitted when [member max_value] or [member min_value] is changed.
  167. </description>
  168. </signal>
  169. </signals>
  170. <constants>
  171. <constant name="TANGENT_FREE" value="0" enum="TangentMode">
  172. The tangent on this side of the point is user-defined.
  173. </constant>
  174. <constant name="TANGENT_LINEAR" value="1" enum="TangentMode">
  175. The curve calculates the tangent on this side of the point as the slope halfway towards the adjacent point.
  176. </constant>
  177. <constant name="TANGENT_MODE_COUNT" value="2" enum="TangentMode">
  178. The total number of available tangent modes.
  179. </constant>
  180. </constants>
  181. </class>