Curve.xml 7.6 KB

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