Curve.xml 7.6 KB

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